no-undef rule applies to Flow type annotations
See original GitHub issueIn my codebase I have the lines:
warnInProgressUpload(e: UnloadEvent) {
if (!this.state.uploadingUploads.size) return undefined;
var confirmationMessage = 'You have an upload in progress, if you leave the page your upload will be cancelled.';
(e || window.event).returnValue = confirmationMessage;
return confirmationMessage;
}
UnloadEvent
is a type declaration defined in a separate file
declare class UnloadEvent extends Event {
returnValue: string;
}
This produces the error:
107:27 error "UnloadEvent" is not defined no-undef
Can eslint skip running no-undef on type annotations?
Issue Analytics
- State:
- Created 8 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Type Annotations | Flow
Adding type annotations is an important part of your interaction with Flow. Flow has a powerful ability to infer the types of your...
Read more >eslint-plugin-flowtype - npm
This rule requires an empty line after the Flow annotation. Options. The rule has a string option: "always" (default): Enforces that @flow ......
Read more >D81678 Introduce noundef attribute at call sites for ... - LLVM
This change adds a new IR noundef attribute, which denotes when a function call argument or return val may never contain uninitialized bits....
Read more >Flow – JavaScript Type Checker | Object Computing, Inc.
Flow is a static type checker, designed to find type errors in JavaScript programs. ... Node.js cannot directly run code that is annotated...
Read more >Lighthouse: flow-report/.eslintrc.cjs | Fossies
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 4 * Unless required by applicable law or agreed to in writing, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Check out eslint-plugin-flowtype: An eslint plugin that makes flow type annotations global variables and marks declarations as used. Solves the problem of false positives with no-undef and no-unused-vars.
Ah thanks everyone!