| Summary: | [eslint] some unused vars reported twice | ||
|---|---|---|---|
| Product: | [ECD] Orion | Reporter: | Michael Rennie <Michael_Rennie> |
| Component: | JS Tools | Assignee: | Michael Rennie <Michael_Rennie> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | curtis.windatt.public |
| Version: | 10.0 | ||
| Target Milestone: | 12.0 | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
I ran into something similar when updating the no use before define rule for ES6. In that case we were looking at the same scope twice, once for function decl and once for block statement. (In reply to Curtis Windatt from comment #1) > I ran into something similar when updating the no use before define rule for > ES6. In that case we were looking at the same scope twice, once for function > decl and once for block statement. This case is pretty simple - when not in module mode (sourceType = "module") the imports are part of the global scope (expected). We just need to update the ignore check to include something like: (node.type === 'ImportDeclaration' && scope.type === 'global') -> ignore |
Use the snippet from the code edit widget example: import "somelib";//Hover on the error marker on "import" and click on the quick fix. The .tern-project file will be updated with new contents. //In the .tern-project file, select all text and press CTRL+X. The error marker on "import" comes back. //In the .tern-project file, press CTRL+V. The error marker on "import" goes away. var foo = "bar"; var bar = foo; /* * test demo */ function test(){ var foo1 = bar.lastIndexOf(char, from);;;;//change line 28 in .eslintrc file to "no-extra-semi": 2. The warning on on ";;;" becomes error. //change line 28 in .eslintrc file to "no-extra-semi": 0. The error on on ";;;" goes away. } //Keep editing in this demo and try the content assist, problem validations and hover service! var foo2 = foo. in a brand new project, and notice that the function name and the decl of foo2 are marked twice as being unused.