| Summary: | [eslint] update "semi" rule. | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [ECD] Orion | Reporter: | Olivier Thomann <Olivier_Thomann> | ||||||
| Component: | JS Tools | Assignee: | Olivier Thomann <Olivier_Thomann> | ||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | curtis.windatt.public, Michael_Rennie | ||||||
| Version: | 12.0 | ||||||||
| Target Milestone: | 13.0 | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows 7 | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
Olivier Thomann
So with the new implementation of this rule, "semi" can now return extra semicolon or missing semicolon.
Our quickfix only checks the annotation id to be triggered. So I need to "emulate" a new rule id (extra-semi) when reporting errors for extra semicolons even if I report a "semi" problem.
For example,
/*eslint semi: ["error", "always", { "omitLastInOneLineBlock": true}] */
if (foo) { bar(); }
This is now a problem for having an extra semicolon. I'll try to reuse the "no-extra-semi" rule to report this one.
I can reuse the existing "no-extra-semi" rule and quickfix. My only issue is that if this has been disabled by the user in the settings page, it can still appear as the severity is based on the severity set for the "semi" rule. Our existing quickfix for "semi" is only expecting to "add" missing semi-colon. It doesn't expect to remove some. Also in the validator code, we "get" again the error message based on the key we pass in (rule id). I don't like that. We should rely on the rule implementation to report the appropriate message. It looks like this has been done to support substitution into the error message like to the eqeqeq rule. Created attachment 263603 [details]
Current patch
Created attachment 263617 [details]
Proposed patch
|