| Summary: | [eslint] Annotation for 'not loaded plugin / env directive' is in odd place | ||
|---|---|---|---|
| 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: | 12.0 | ||
| Target Milestone: | 12.0 | ||
| Hardware: | PC | ||
| OS: | Mac OS X | ||
| Whiteboard: | |||
|
Description
Michael Rennie
I was already looking at doing this, but nice to know there is a function already to find the right comment. I'm not going to remove the plugin name from the text: a) The plugin name doesn't always match the env directive and b) The quickfix uses the name from the annotation title for the fix (same as eqeqeq quickfix). findDirective only gets you the entire eslint-env comment. You also can't pass a comment to report as the node. This will require writing a new Finder.findESLintEnv function with tests and then reporting a specific start/end range + line/col the same way unnecessary-nls rule does. (In reply to Curtis Windatt from comment #2) > This will require writing a new > Finder.findESLintEnv function with tests and then reporting a specific > start/end range + line/col the same way unnecessary-nls rule does. Thats overkill. Just use Finder.findDirective to find the comment node (as I mentioned) then look in comment.value for the name you have reported. Use the range array from the comment node to compute the range for the word to mark and create a node to pass in to context.report. Have a look at the no-jslint rule for an example. Fixed in: http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=ce903e4dcf36fcdcea1d091306b140c14a793f64 The fix includes: 1. exported the optional plugins mapping from the tern context 2. removed the unnecessary tern request, which was also causing a timing problem where the linting would only show up 25% of the time 3. stopped re-exporting the entire tern server into the eslint context 4. adds missing mapping of 'mongo' to 'mongodb' - eslint provides mongo, we should detect this and be able to load the mongodb plugin as necessary 5. marks the offending name in the directive correctly 6. fixes the quickfix to not rely on regexing the annotation text (which also would have relied on the warning being in english) 7. updated the tests to check for the new 'EnvNode' instead of 'Program' I did not change the message, I opened bug 490932 for that. All tests pass. |