We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have a monorepo project, and its structure looks like this:
monorepo ├── packages │ ├── packageA │ └── packageB └── index.mjs
I want to run the eslint command in the root directory, like:
eslint
const eslint = new ESLint({ cwd: '/workspace/monorepo/packages/packageA', extensions: ['.ts', '.tsx', '.mts', '.cts'], }); const result = await eslint.lintFiles('/workspace/monorepo/packages/packageA/index.ts'); console.log('result---', result);
The eslint-plugin-import plugin seems to be unable to find the tsconfig.json file of packageA:
eslint-plugin-import
tsconfig.json
packageA
I think eslint’s cwd configuration should be used first, it looks like this:
const tsconfigInfo = tsConfigLoader({ cwd: context.parserOptions && context.parserOptions.tsconfigRootDir || eslint.options.cwd || process.cwd(), getEnv: (key) => process.env[key], });
At first I thought the context was the context configured by eslint, but later I found out that it was the plugin itself.
context
So I tried writing it like this and found that nothing worked 😅:
new ESLint({ cwd: '/workspace/monorepo/packages/packageA', extensions: ['.ts', '.tsx', '.mts', '.cts'], overrideConfig: { parserOptions: { tsconfigRootDir: '/workspace/monorepo/packages/packageA' }, }, })
The text was updated successfully, but these errors were encountered:
Please stop doing this.
Sorry, something went wrong.
Duplicate of import-js/eslint-import-resolver-typescript#274
No branches or pull requests
I have a monorepo project, and its structure looks like this:
I want to run the
eslint
command in the root directory, like:The
eslint-plugin-import
plugin seems to be unable to find thetsconfig.json
file ofpackageA
:I think
eslint
’s cwd configuration should be used first, it looks like this:PS
At first I thought the
context
was the context configured byeslint
, but later I found out that it was the plugin itself.So I tried writing it like this and found that nothing worked 😅:
The text was updated successfully, but these errors were encountered: