Rudo Kemper
Rudo Kemper
NNuxt
Created by Rudo Kemper on 2/17/2025 in #❓・help
Does anyone have a great eslint+typescript Nuxt 3 setup?
I've been trying to set up eslint and typescript for my Nuxt 3 projects for a while now and not getting this right. There is so much conflicting information online. Does anyone have a great working example where eslint is able to lint with typescript (in js/ts/vue)? For posterity, here is my setup... In my latest attempt I've installed @eslint/js, @nuxt/eslint, @typescript-eslint/parser, eslint, eslint-config-flat-ignore, and typescript. My tsconfig.json is standard:
{
// https://nuxt.com/docs/guide/concepts/typescript
"extends": "./.nuxt/tsconfig.json"
}
{
// https://nuxt.com/docs/guide/concepts/typescript
"extends": "./.nuxt/tsconfig.json"
}
My eslint.config.js looks like this:
import globals from "globals";
import js from "@eslint/js";
import gitignore from "eslint-config-flat-gitignore";
import withNuxt from "./.nuxt/eslint.config.mjs";

export default withNuxt(
gitignore(),
{ files: ["**/*.{js,ts,vue}"] },
{ languageOptions: { globals: globals.browser } },
js.configs.recommended,
{
files: ["**/*.{js,ts,vue}"],
rules: {
// removed for brevity
},
},
{
ignores: ["public/"],
},
);
import globals from "globals";
import js from "@eslint/js";
import gitignore from "eslint-config-flat-gitignore";
import withNuxt from "./.nuxt/eslint.config.mjs";

export default withNuxt(
gitignore(),
{ files: ["**/*.{js,ts,vue}"] },
{ languageOptions: { globals: globals.browser } },
js.configs.recommended,
{
files: ["**/*.{js,ts,vue}"],
rules: {
// removed for brevity
},
},
{
ignores: ["public/"],
},
);
In my nuxt.config.ts I have added @nuxt/eslint to modules. Typescript works just fine in VScode but none of the rules are applied when linting. If I try to add e.g. @typescript-eslint/esplint-plugin to my eslint config, I get a not super helpful complaint: "A config object is using the "extends" key, which is not supported in flat config system." -- Any help appreciated, either links to working eslint+typescript Nuxt3 repos, or specific pointers on what might be going wrong. Thanks!
10 replies