eslint-config-airbnb-typescript: Invalid configuration for rule "@typescript-eslint/indent"
Getting an error with this plugin which breaks my vim eslint plugin integration:
[Error - 1:08:39 PM] .eslintrc.yml » eslint-config-airbnb-typescript »
/home/dori/Projects/Work/project-v3/client/node_modules/eslint-config-airbnb-typescript/lib/shared.js:
Configuration for rule "@typescript-eslint/indent" is invalid:
Value {"SwitchCase":1,"VariableDeclarator":1,"outerIIFEBody":1,"FunctionDeclaration":{"parameters":1,"body":1},"FunctionExpression":{"parameters":1,"body":1},"CallExpression":{"arguments":1},"ArrayExpression":1,"ObjectExpression":1,"ImportDeclaration":1,"flatTernaryExpressions":false,"ignoredNodes":["JSXElement","JSXElement > *","JSXAttribute","JSXIdentifier","JSXNamespacedName","JSXMemberExpression","JSXSpreadAttribute","JSXExpressionContainer","JSXOpeningElement","JSXClosingElement","JSXFragment","JSXOpeningFragment","JSXClosingFragment","JSXText","JSXEmptyExpression","JSXSpreadChild"],"ignoreComments":false,"offsetTernaryExpressions":false}
should NOT have additional properties.
Using eslint-config-airbnb-typescript 7.2.1
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 17
- Comments: 16 (2 by maintainers)
Also experiencing this, and I looks like the root cause is multiple versions of
@typescript-eslint/eslint-plugin
in the hierarchy ofnode_modules
, and eslint resolving to root node_modules packages that may be in different versions than the expectation.Like airbnb, I encapsulate configs in a package (say
@company/config-eslint
), the package has a dep on@typescript-eslint/eslint-plugin@3.7.1
, but when this package is installed elsewhere with another dep that has an older version, yarn installs both, and the newer is nested undernode_modules/@company/config-eslint/node_modules
:when eslint resolves the plugins by name, it uses the one at the root of node_modules, which is 2.34.0, and the error shows.
In a different repo without the additional older version as a sub dep of one of the deps, v9.0.0 works without the indent config error.
This can possibly be resolved by using full paths (
require.resolve
) in the eslint config, instead of plugin names. A support for this is coming to eslint. See: https://github.com/eslint/rfcs/pull/14 / https://github.com/eslint/rfcs/pull/9I was able to solve it, quite hackishly, using yarn resolutions, in the root package.json of the repo.
and this will also work if I add it as a local dependency.
EDIT: I hit this again in a different project, and the solution was to install
eslint
at the root.Still getting this error when using v9.0.0 of this library
For a temporary fix to this problem use the following package versions.
Still having this using globally installed eslint with typescript-eslint and airbnb-typescript:
This might be caused by updating to ESLint v7, which was not supported.
v9.0.0 of this library has just been released, and includes support for ESLint v7. Hopefully this fixes the issue.