Forgetting "use strict" results in the entire file being underlined
See original GitHub issueOverview
With the rule configuration strict: ['warn', 'global']
If you forget to include the 'use strict'
directive at top of the file, it highlights the entire file, rather than just the first line.
Expected behavior would be to only show the warning on the first line.
What rule do you want to change?
strict
Does this change cause the rule to produce more or fewer warnings?
Yes
How will the change be implemented? (New option, new default behavior, etc.)?
new option
Please provide some example code that this change will affect:
With the rule configuration strict: ['warn', 'global']
let x = 1;
let y = 2;
let z = 3;
What does the rule currently do for this code?
The entire file is underlined. Making it difficult to see/count other issues.
What will the rule do after it’s changed?
It will only underline the first line.
Are you willing to submit a pull request to implement this change?
Yes.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top GitHub Comments
I don’t think we need a new option to control where the violation is reported…
The rule doesn’t know if its configured as an error or a warning, and that’s by design, because we don’t want rules to behave differently depending on how they are configured.
Given that it seems there’s agreement that the current behavior is mostly correct, I don’t see us making a change here.