Skip to content
New issue

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

lint: eslintrc rules difficult to override #1134

Open
samchungy opened this issue Mar 23, 2023 · 1 comment
Open

lint: eslintrc rules difficult to override #1134

samchungy opened this issue Mar 23, 2023 · 1 comment

Comments

@samchungy
Copy link
Contributor

samchungy commented Mar 23, 2023

Error: Error while loading rule '@typescript-eslint/no-unsafe-member-access':
You have used a rule which requires parserServices to be generated.
You must therefore provide a value for the "parserOptions.project" property for @typescript-eslint/parser.

Putting this here for visibility as I've seen it on a few repos now and have had a few questions.

It's currently fairly clunky to change a rule right now. The typical way would be to set a rule in .eslintrc file:

.eslintrc

rules: {
  '@typescript-eslint/no-unsafe-assignment': 'warn',
}

But with the latest update you need to declare it using overrides:

.eslintrc

const tsExtensions = ['ts', 'cts', 'mts', 'tsx'];
overrides: [
    {
      files: [`*.{${tsExtensions.join(',')}}`],
      rules: {
        '@typescript-eslint/no-unsafe-assignment': 'warn',
      },
    },
]
@72636c
Copy link
Member

72636c commented May 1, 2023

This may be improved by ESLint flat config:

#1157

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants