Extending ESLint is not supporting overrides
Created by: Andarist
Extending ESLint got introduced originally in https://github.com/facebook/create-react-app/pull/7036 by @mrmckeb. It's stated that this is limited currently to users configuring their ESLint in package.json:
- this ain't quite true - because used
eslintCli.getConfigForFile
is not limited to package.json configs - there is no such mention in the docs - not a biggie but brought a little bit of confusion for me.
What is actually stated in the docs and what doesn't actually hold true is that overrides
can be used to support TS rules etc (there is example of that).
This is not quite true, because whatever config gets loaded & resolved through that eslintCli.getConfigForFile
call (with paths.appIndexJs
as argument) gets set as "global" config for the whole eslint-loader.
So depending on what paths.appIndexJs
is we either can get:
- all TS-related rules being applied to ALL files (including JS) - when
paths.appIndexJs
is TS - no TS rules are applied at all - when
paths.appIndexJs
is JS
For this to work correctly it would be the easiest to allow ESLint to load configs on its own - without passing explicit single config to the eslint-loader.