Error starting eslint when using the object option in the no-extra-boolean-cast rule
See original GitHub issueEnvironment
Node version: v14.18.3 npm version: 6.14.15 Local ESLint version: 8.16.0 Global ESLint version: - Operating System: macOS Monterey 12.4
What parser are you using?
Default (Espree)
What did you do?
Configuration
{
"extends": [
"react-app",
"plugin:react-hooks/recommended",
"prettier",
"plugin:import/typescript"
],
"plugins": [
"sort-keys-fix"
],
"ignorePatterns": [
"**/core/api/**/*",
"react-app-env.d.ts",
".eslintrc.js"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json"
},
"rules": {
"@typescript-eslint/brace-style": "warn",
"@typescript-eslint/comma-spacing": "warn",
"@typescript-eslint/default-param-last": "warn",
"@typescript-eslint/dot-notation": "warn",
"@typescript-eslint/func-call-spacing": "warn",
"@typescript-eslint/keyword-spacing": "warn",
"@typescript-eslint/no-array-constructor": "warn",
"@typescript-eslint/no-dupe-class-members": "warn",
"@typescript-eslint/no-unused-vars": "warn",
"@typescript-eslint/no-useless-constructor": "warn",
"@typescript-eslint/quotes": [
"warn",
"single",
{
"avoidEscape": true
}
],
"array-bracket-spacing": [
"warn",
"never"
],
"array-callback-return": "warn",
"arrow-body-style": "warn",
"arrow-parens": "warn",
"arrow-spacing": "warn",
"block-spacing": [
"warn",
"always"
],
"comma-dangle": [
"warn",
{
"arrays": "always-multiline",
"objects": "always-multiline",
"exports": "always-multiline",
"imports": "always-multiline",
"functions": "never"
}
],
"comma-style": "warn",
"computed-property-spacing": "warn",
"eol-last": "warn",
"eqeqeq": "warn",
"import/first": "warn",
"import/no-duplicates": "warn",
"import/no-mutable-exports": "warn",
"import/no-cycle": "error",
"key-spacing": "warn",
"newline-before-return": "warn",
"no-else-return": "warn",
"no-eval": "warn",
"no-extra-boolean-cast": ["warn", {"enforceForLogicalOperands": true}],
"no-iterator": "warn",
"no-mixed-operators": "warn",
"no-multi-assign": "warn",
"no-multiple-empty-lines": "warn",
"no-nested-ternary": "warn",
"no-new-func": "warn",
"no-new-object": "warn",
"no-new-wrappers": "warn",
"no-param-reassign": "warn",
"no-plusplus": "warn",
"no-prototype-builtins": "warn",
"no-restricted-globals": "warn",
"no-restricted-properties": "warn",
"no-restricted-syntax": "warn",
"no-trailing-spaces": "warn",
"no-undef": "warn",
"no-unneeded-ternary": "warn",
"no-useless-escape": "warn",
"no-use-before-define": [
"warn",
{
"functions": true,
"classes": true,
"variables": true
}
],
"no-var": "warn",
"no-whitespace-before-property": "warn",
"nonblock-statement-body-position": [
"warn",
"any"
],
"object-curly-spacing": [
"warn",
"always"
],
"object-shorthand": "warn",
"padded-blocks": [
"warn",
"never"
],
"prefer-arrow-callback": "warn",
"prefer-const": "warn",
"prefer-object-spread": "warn",
"prefer-rest-params": "warn",
"prefer-spread": "warn",
"prefer-template": "warn",
"quote-props": [
"warn",
"as-needed",
{
"keywords": false,
"unnecessary": true,
"numbers": false
}
],
"react/jsx-no-literals": [
"warn",
{
"noStrings": false,
"ignoreProps": true,
"noAttributeStrings": false
}
],
"space-before-blocks": "warn",
"space-in-parens": "warn",
"space-infix-ops": "warn",
"spaced-comment": "warn",
"template-curly-spacing": [
"warn",
"never"
],
"yoda": "warn"
},
"overrides": [
{
"files": [
"*.ts",
"*.tsx"
],
"rules": {
"constructor-super": "off",
"getter-return": "off",
"no-const-assign": "off",
"no-dupe-args": "off",
"no-dupe-class-members": "off",
"no-dupe-keys": "off",
"no-func-assign": "off",
"no-new-symbol": "off",
"no-obj-calls": "off",
"no-redeclare": "off",
"no-this-before-super": "off",
"no-undef": "off",
"no-unreachable": "off",
"no-unsafe-negation": "off",
"valid-typeof": "off",
"import/named": "off",
"import/no-unresolved": "off"
}
},
{
"files": [
"**/core/local/**/*"
],
"excludedFiles": [
"local.config.ts"
],
"rules": {
"sort-keys-fix/sort-keys-fix": "warn"
}
}
]
}
<!-- Paste your code here -->
What did you expect to happen?
ESLint is running, the object option is working
What actually happened?
/Users/maksim/Projects/lms/frontend/lms
eslint ./src --ext .js,.jsx,.ts,.tsx
Error: .eslintrc.json: Configuration for rule “no-extra-boolean-cast” is invalid: Value [{“enforceForLogicalOperands”:true}] should NOT have more than 0 items.
at validateRuleOptions (/Users/maksim/Projects/lms/frontend/lms/node_modules/eslint/lib/shared/config-validator.js:138:19)
at /Users/maksim/Projects/lms/frontend/lms/node_modules/eslint/lib/shared/config-validator.js:193:9
at Array.forEach (<anonymous>)
at validateRules (/Users/maksim/Projects/lms/frontend/lms/node_modules/eslint/lib/shared/config-validator.js:190:30)
at validateConfigArray (/Users/maksim/Projects/lms/frontend/lms/node_modules/eslint/lib/shared/config-validator.js:337:9)
at CascadingConfigArrayFactory._finalizeConfigArray (/Users/maksim/Projects/lms/frontend/lms/node_modules/eslint/lib/cli-engine/cascading-config-array-factory.js:417:13)
at CascadingConfigArrayFactory.getConfigArrayForFile (/Users/maksim/Projects/lms/frontend/lms/node_modules/eslint/lib/cli-engine/cascading-config-array-factory.js:271:21)
at FileEnumerator._iterateFilesRecursive (/Users/maksim/Projects/lms/frontend/lms/node_modules/eslint/lib/cli-engine/file-enumerator.js:396:49)
at _iterateFilesRecursive.next (<anonymous>)
at FileEnumerator.iterateFiles (/Users/maksim/Projects/lms/frontend/lms/node_modules/eslint/lib/cli-engine/file-enumerator.js:251:49)
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! lms@0.1.0 lint: eslint ./src --ext .js,.jsx,.ts,.tsx
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the lms@0.1.0 lint script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in: npm ERR! /Users/maksim/.npm/_logs/2022-06-02T10_41_20_905Z-debug.log
Participation
- I am willing to submit a pull request for this issue.
Additional comments
No response
Issue Analytics
- State:
- Created a year ago
- Comments:9 (4 by maintainers)
The
enforceForLogicalOperands
option was added in ESLint v7.0.0, so you can only use this option with ESLint >= 7.ESLint < 7 will throw a configuration error, as in the original post. Since you have ESLint v6.8.0, this is the expected behavior.
Thank you for helping me figure it out