Closed svoren258 closed 3 months ago
today I try an attempt to migrate config to flat and got incorrect migration (nx 18.3.1):
got:
languageSettings: { parserOptions: { project: ["./tsconfig.*?.json"] } }
got languageSettings
, which is not exist in eslint schema. But when I manually correct to languageOptions
in main eslint.config.js
, I got message that:
Error: You have attempted to use the lint rule @typescript-eslint/prefer-optional-chain which requires the full TypeScript type-checker to be available, but you do not have `parserOptions.project` configured to point at your project tsconfig.json files in the relevant TypeScript file "overrides" block of your project ESLint config /Users/iam/org-folder/project-folder/libs/app-layout/eslint.config.js
Please see https://nx.dev/guides/eslint for full guidance on how to resolve this issue.
Looks like global override in main eslint.config.js
for languageOptions not working.
Also when I run the migration and change the languageSettings
by hand to be languageOptions
and add the tsParser
, eslint will still not work properly.
no-unused-vars will error with every var, even if they are used
@jahusa02 please open a new issue with full details of your situation and setup, that does not sound related to the OP
We are also seeing the following error, even though the parsetOptions.project is correctly set (I think)
Error: You have attempted to use the lint rule @typescript-eslint/naming-convention which requires the full TypeScript type-checker to be available, but you do not have parserOptions.project configured to point at your project tsconfig.json files in the relevant TypeScript file "overrides" block of your project ESLint config C:\Users\joe.williams\Projects\Megatron\frontend\src\libs\shared\ui\atom\button\eslint.config.js
Any ideas on how to get round this?
@joewIST you should provide languageOptions to your libs with project. Something like that:
languageOptions: {
parserOptions: { project: 'tsconfig.*?.ts'"}
}
@pumano I have already done that, still no luck.
@joewIST that should be in each lib, global override not working
Also Try to set It in latest in each lib
@pumano This is what Nx generated for this library, plus the languageOptions that you suggest:
const baseConfig = require('../../../../../eslint.config.js');
module.exports = [
...baseConfig,
{
ignores: [
'**/*.stories.ts',
'**/*.spec.ts'
],
languageOptions: {
parserOptions: {
project: 'tsconfig.*?.ts'
}
}
}
];
However, this still doesn't work and I get the same errors!
I also had to convert the file to .cjs to prevent errors.
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.
Current Behavior
Currently, the migration generator moves the
parserOptions
property value from the old configuration file next to thefiles
andrules
properties within the neweslint.config.js
file.Before
The
.eslintrc.json
file before the migration:After (wrong)
The
eslint.config.json
file after the migration:The current state produces following linting error:
Expected Behavior
The flat configuration model has changed so that it expects the
parserOptions
property under the top-levellanguageOptions
property as stated in the official docs.Before
The
.eslintrc.json
file before the migration:After (correct)
The
eslint.config.json
file after the migration:GitHub Repo
No response
Steps to Reproduce
.eslintrc.json
) specify theparserOptions
property and run the following migration generatornx g @nx/eslint:convert-to-flat-config
Nx Report
Failure Logs
No response
Package Manager Version
No response
Operating System
Additional Information
No response