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

How to enable 'Typed Linting' in @nuxt/eslint #538

Open
vibonacci opened this issue Feb 5, 2025 · 1 comment
Open

How to enable 'Typed Linting' in @nuxt/eslint #538

vibonacci opened this issue Feb 5, 2025 · 1 comment

Comments

@vibonacci
Copy link

I want to use the rule @typescript-eslint/naming-convention which requires 'Typed Linting' feature to be enabled.

According to the docs, this requires the following steps:

Add TypeChecked to the name of any preset configs you're using, namely recommended, strict, and stylistic.
Add languageOptions.parserOptions to tell our parser how to find the TSConfig for each source file.

But since @nuxt/eslint does not use a standard eslint.config.mjs format, I have no clue how to achieve this.

Has somebody succeeded in getting the Typed Linting to work?

TypeScript ESLint docs:
https://typescript-eslint.io/getting-started/typed-linting/

@zecka
Copy link

zecka commented Feb 11, 2025

@vibonacci I had similar issue and fixed it by adding parserOptions.project to eslint.config

Check related disscussion here: #544 and here antfu/eslint-config#662

// @ts-check
import withNuxt from './.nuxt/eslint.config.mjs'

export default withNuxt(
  // Your custom configs here
).prepend({
+  languageOptions: {
+    parserOptions: {
+      project: './tsconfig.json',
+    }
+  },
  rules: {
    '@typescript-eslint/naming-convention': 'error',
  }
})

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