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
Bug: flat config with "eslint:all" on a .cjs file recommends function form of "use strict" instead of global form #16304
Comments
The docs for The first is to set the environment to The second is to set export default [
"eslint:all",
{
"languageOptions": {
"parserOptions": {
"ecmaFeatures": {
"globalReturn": true
}
}
}
}
]; Setting It would be nice if this were a little easier to set up like by specifying the Perhaps the Just configuring the rule might be best: export default [
"eslint:all",
{
rules: {
strict: ["error", "global"]
}
}
]; |
Hi @jzinn, thanks for the issue!
You're right, this is a bug. The new config system works correctly in this case, as it automatically sets The problem is in the I prepared PR #16308 that should fix this problem. |
|
Environment
Node version:
v16.14.0
npm version:
8.3.1
Local ESLint version:
v8.23.1
Global ESLint version:
zsh: command not found: eslint
Operating System:
Fedora release 36 (Thirty Six)
What parser are you using?
Default (Espree)
What did you do?
package.json
Notice
type
ismodule
.eslint.config.js
Using the new flat config file format. The default
languageOptions
sourceType
should becommonjs
for.cjs
files.index.cjs
A
.cjs
file that ESLint should consider to be acommonjs
file.What did you expect to happen?
Expected: a message to use the global form of
"use strict"
.Why: the docs for rule
strict
say:The file ends with
.cjs
, so ESLint should recommend "global".What actually happened?
A message to use the function form:
Participation
Additional comments
No response
The text was updated successfully, but these errors were encountered: