Javascript: Invalid rule configurations compiled by "eslint --print-config" on eslint-config-airbnb-typescript

Created on 16 May 2020  Â·  14Comments  Â·  Source: airbnb/javascript

I recently ran eslint --print-config example.js > output.json on my eslint config extending from airbnb-typescript-prettier and some of the rules extracted from packages such as eslint-config-airbnb-base are invalid. Example: -

"import/no-cycle": [
    "error",
    {
        "maxDepth": null
    }
]

Results in the error: -

Error: .eslintrc.js:
Configuration for rule "import/no-cycle" is invalid:
Value null should be integer.

There are a number of other rules that have invalid config: -

"react/destructuring-assignment": [
  "always",
  "error"
],
"react/jsx-closing-bracket-location": [
  "line-aligned",
  "off"
],
"react/jsx-curly-spacing": [
  "never",
  "off",
  {
    "allowMultiline": true
  }
],
"react/jsx-equals-spacing": [
  "never",
  "off"
],
"react/jsx-first-prop-new-line": [
  "multiline-multiprop",
  "off"
],
"react/jsx-space-before-closing": [
  "always",
  "off"
],
"react/prefer-es6-class": [
  "always",
  "error"
],
"react/sort-prop-types": [
  "off",
  {
    "callbacksLast": false,
    "ignoreCase": true,
    "requiredFirst": false,
    "sortShapeProp": true
  }
],
"react/state-in-constructor": [
  "always",
  "error"
],
"array-bracket-newline": [
  "consistent",
  "off"
],
"array-bracket-spacing": [
  "never",
  "off"
],
"arrow-body-style": [
  "as-needed",
  0,
  {
    "requireReturnForObjectLiteral": false
  }
],
"arrow-parens": [
  "always",
  "off"
],
"block-spacing": [
  "always",
  "off"
],
"brace-style": [
  "1tbs",
  "off",
  {
    "allowSingleLine": true
  }
],
"capitalized-comments": [
  "never",
  "off",
  {
    "block": {
      "ignoreConsecutiveComments": true,
      "ignoreInlineComments": true,
      "ignorePattern": ".*"
    },
    "line": {
      "ignoreConsecutiveComments": true,
      "ignoreInlineComments": true,
      "ignorePattern": ".*"
    }
  }
],
"comma-style": [
  "last",
  "off",
  {
    "exceptions": {
      "ArrayExpression": false,
      "ArrayPattern": false,
      "ArrowFunctionExpression": false,
      "CallExpression": false,
      "FunctionDeclaration": false,
      "FunctionExpression": false,
      "ImportDeclaration": false,
      "NewExpression": false,
      "ObjectExpression": false,
      "ObjectPattern": false,
      "VariableDeclaration": false
    }
  }
],
"computed-property-spacing": [
  "never",
  "off"
],
"curly": [
  "multi-line",
  0
],
"eol-last": [
  "always",
  "off"
],
"eqeqeq": [
  "always",
  "error",
  {
    "null": "ignore"
  }
],
"func-call-spacing": [
  "never",
  "off"
],
"func-name-matching": [
  "always",
  "off",
  {
    "considerPropertyDescriptor": true,
    "includeCommonJSModuleExports": false
  }
],
"func-style": [
  "expression",
  "off"
],
"function-call-argument-newline": [
  "consistent",
  "off"
],
"function-paren-newline": [
  "consistent",
  "off"
],
"implicit-arrow-linebreak": [
  "beside",
  "off"
],
"lines-between-class-members": [
  "always",
  "error",
  {
    "exceptAfterSingleLine": false
  }
],
"multiline-ternary": [
  "never",
  "off"
],
"no-cond-assign": [
  "always",
  "error"
],
"no-extra-parens": [
  "all",
  "off",
  {
    "conditionalAssign": true,
    "enforceForArrowConditionals": false,
    "ignoreJSX": "all",
    "nestedBinaryExpressions": false,
    "returnAssign": false
  }
],
"no-restricted-globals": [
  "addEventListener",
  "blur",
  "close",
  "closed",
  "confirm",
  "defaultStatus",
  "defaultstatus",
  "error",
  "event",
  "external",
  "find",
  "focus",
  "frameElement",
  "frames",
  "history",
  "innerHeight",
  "innerWidth",
  "isFinite",
  "isNaN",
  "length",
  "location",
  "locationbar",
  "menubar",
  "moveBy",
  "moveTo",
  "name",
  "onblur",
  "onerror",
  "onfocus",
  "onload",
  "onresize",
  "onunload",
  "open",
  "opener",
  "opera",
  "outerHeight",
  "outerWidth",
  "pageXOffset",
  "pageYOffset",
  "parent",
  "print",
  "removeEventListener",
  "resizeBy",
  "resizeTo",
  "screen",
  "screenLeft",
  "screenTop",
  "screenX",
  "screenY",
  "scroll",
  "scrollBy",
  "scrollTo",
  "scrollX",
  "scrollY",
  "scrollbars",
  "self",
  "status",
  "statusbar",
  "stop",
  "toolbar",
  "top"
],
"no-return-assign": [
  "always",
  "error"
],
"nonblock-statement-body-position": [
  "beside",
  "off",
  {
    "overrides": {}
  }
],
"object-curly-newline": [
  "off",
  {
    "ExportDeclaration": {
      "consistent": true,
      "minProperties": 4,
      "multiline": true
    },
    "ImportDeclaration": {
      "consistent": true,
      "minProperties": 4,
      "multiline": true
    },
    "ObjectExpression": {
      "consistent": true,
      "minProperties": 4,
      "multiline": true
    },
    "ObjectPattern": {
      "consistent": true,
      "minProperties": 4,
      "multiline": true
    }
  }
],
"object-curly-spacing": [
  "always",
  "off"
],
"object-shorthand": [
  "always",
  "error",
  {
    "avoidQuotes": true,
    "ignoreConstructors": false
  }
],
"one-var-declaration-per-line": [
  "always",
  "off"
],
"operator-assignment": [
  "always",
  "error"
],
"operator-linebreak": [
  "before",
  "off",
  {
    "overrides": {
      "=": "none"
    }
  }
],
"quote-props": [
  "as-needed",
  "off",
  {
    "keywords": false,
    "numbers": false,
    "unnecessary": true
  }
],
"quotes": [
  "single",
  0,
  {
    "avoidEscape": true
  }
],
"rest-spread-spacing": [
  "never",
  "off"
],
"semi": [
  "always",
  "off"
],
"semi-style": [
  "last",
  "off"
],
"sort-keys": [
  "asc",
  "off",
  {
    "caseSensitive": false,
    "natural": true
  }
],
"space-in-parens": [
  "never",
  "off"
],
"spaced-comment": [
  "always",
  "error",
  {
    "block": {
      "balanced": true,
      "exceptions": [
        "+",
        "-"
      ],
      "markers": [
        "!",
        ":",
        "::",
        "="
      ]
    },
    "line": {
      "exceptions": [
        "+",
        "-"
      ],
      "markers": [
        "!",
        "="
      ]
    }
  }
],
"template-tag-spacing": [
  "never",
  "off"
],
"unicode-bom": [
  "never",
  "off"
],
"yield-star-spacing": [
  "after",
  "off"
],
invalid

Most helpful comment

This is indeed a bug in eslint v7.3.0; downgrade to v7.2 for now.

All 14 comments

eslint-config-airbnb-typescript and airbnb-typescript-prettier are different packages that we do not maintain or necessarily endorse. We provide Infinity as the maxDepth value, which is valid: https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/imports.js#L236

Perhaps one of these packages is processing our config incorrectly?

@U-4-E-A did you get to the bottom of this? we are using eslint-config-airbnb-base directly and this suddenly started happening

I also ran into this this morning after running eslint.js --init to setup a new package.

Can both of you perhaps file a new issue and provide a bit more information, including your configs?

Having issues too with this

eslint 7.3.0 was released only an hour ago. It seems to contain something that causes this error.

I fixed this by re-installing eslint 7.2.0

Same here. Started to appear this morning. Looks like something related to this package: https://www.npmjs.com/package/eslint ... 7.3.0 • Public • Published an hour ago.

This is indeed a bug in eslint v7.3.0; downgrade to v7.2 for now.

I have the same issue since this morning.

I have the same issue since upgrading to 7.3.0, the only workaround is to downgrade to 7.2.0

I have the same issue

Vue-cli 4.4.4, downgraded Es lint to 7.2.0 and I am still getting this error...

Module build failed (from ./node_modules/eslint-loader/index.js):
Error: .eslintrc.js » @vue/eslint-config-airbnb » C:\WebProjects\GitHub\project\node_moduleseslint-config-airbnb-base\index.js » C:\WebProjects\GitHub\project\node_moduleseslint-config-airbnb-base\rules\imports.js:
Configuration for rule "import/no-cycle" is invalid:
Value null should be integer.

Should I downgrade anything here as well?
"@vue/cli-plugin-babel": "^4.4.4",
"@vue/cli-plugin-eslint": "^4.4.4",
"@vue/cli-plugin-pwa": "^4.4.4",
"@vue/cli-plugin-router": "^4.4.4",
"@vue/cli-plugin-vuex": "^4.4.4",
"@vue/cli-service": "^4.4.4",
"@vue/eslint-config-airbnb": "^5.0.2",
"babel-eslint": "^10.1.0",
"eslint": "^7.2.0",
"eslint-plugin-vue": "^6.2.2"

Thanks,
Taras

Follow up to the comment above:

Temporary disable es lint until the fix is in.
vue.config.js:
module.exports = {
lintOnSave: false,
}

Turn back on when the issue is resolved.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

olalonde picture olalonde  Â·  3Comments

stephenkingsley picture stephenkingsley  Â·  3Comments

zurfyx picture zurfyx  Â·  3Comments

weihongyu12 picture weihongyu12  Â·  3Comments

ryankask picture ryankask  Â·  3Comments