-
Notifications
You must be signed in to change notification settings - Fork 955
how to load an ESlint config file eslintrc.js #6182
Copy link
Copy link
Closed
Labels
Description
Description
I have created a new environment extension from node-env (customize the base Node env with your configs and tools).
I already know I can override the ESLint default config like so:
node.useEslint({
transformers: [
(config) => {
config.setRule('no-console', ['error']);
return config;
},
],
}),
but based on my requirements, I would like to load a custom eslintrc.js file to to set up lint. How to do it?
This is my approach based on https://github.com/teambit/bit/blob/bf6114a2134f7c5cc1d39e371f4cc1da4fbbcdaa/scopes/envs/aspect-docs/envs/envs.mdx:
//node-env.main.runtime.ts
const eslintConfig = require('./eslint/eslintrc.js');
....
envs.override({
getLinter: (context: LinterContext, transformers: any[]) => {
return eslint.createLinter(context, {
config: eslintConfig,
// resolve all plugins from the react environment.
pluginPath: __dirname,
}, transformers);
},
}),
but I got this error:
$ bit lint
✖ service "linter" of env "extensions/custom-node-env" has failed. error: Cannot read properties of undefined (reading 'createLinter')
Specifications
- Bit version: 0.0.79
- Node version: v18.3.0
- npm / yarn version: 8.11.0
- Platform: Windows
- Bit compiler (include version):
- Bit tester (include version):
Context and additional information
Reactions are currently unavailable