New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The "safe" option of the "strict" rule doesn't work as documented #8953
Comments
I think you're correct. |
i'd like to help on this issue, but i'd need guidance on how to go about fixing it. |
Hi @williamolojede, thanks for being willing to help. Are you looking for guidance on submitting a PR in general, or are you unsure about the details of this particular issue? If it's the former, our pull request guide could be useful. |
The PR isn't the issue, i understand that to an extent. I'm unsure about the details of the issue but i'd like to help. |
Basically, the issue is as follows: In "regular" JavaScript, it's not possible to use a if (foo) {
return; // syntax error
} However, it is possible to do this in Node.js. This is because when Node.js runs your code, it essentially wraps the entire module in a function, so For similar reasons, The The Node.js semantics are usually in effect when the user specifies the The issue is that the documentation here is currently misleading. It states that the Does that make sense? The issue is a bit nuanced, so there is probably something I didn't explain clearly. |
It looks like this issue is still open, so I'll take a shot at it if that's fine. |
Changes: - Turn on the "strict" rule The "globalReturn" property in the "ecmaFeatures" object of parser options brakes the "strict" rule, so we had to remove it from the config. Having the "strict" rule turned on is more valuable than having the "globalReturn" property set to false. See the relevant discussion: eslint/eslint#8953
The documentation says:
It says either, but if I set
node
totrue
andglobalReturn
tofalse
, the"safe"
option corresponds to the"function"
option.What parser (default, Babel-ESLint, etc.) are you using?
default
Please show your full configuration:
Configuration
What did you do? Please include the actual source code causing the issue.
What did you expect to happen?
No warnings.
What actually happened? Please include the actual, raw output from ESLint.
1:1 - Use the function form of 'use strict'. (strict)
3:18 - Use the function form of 'use strict'. (strict)
The text was updated successfully, but these errors were encountered: