Last active
August 28, 2025 12:39
-
-
Save mityaua/247e6bbafd75e5d36fe854f2473c3ac1 to your computer and use it in GitHub Desktop.
ESLint 9 Flat config example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import type { Linter } from "eslint"; | |
import { globalIgnores } from "eslint/config"; | |
import { defineConfigWithVueTs, vueTsConfigs } from "@vue/eslint-config-typescript"; | |
import pluginVue from "eslint-plugin-vue"; | |
import pluginVitest from "@vitest/eslint-plugin"; | |
import skipFormatting from "@vue/eslint-config-prettier/skip-formatting"; | |
const commonRules = { | |
"@typescript-eslint/no-explicit-any": "off", | |
"@typescript-eslint/no-unused-expressions": "off", | |
"no-unused-vars": "off", | |
"@typescript-eslint/no-unused-vars": "warn", | |
"@typescript-eslint/await-thenable": "error", | |
} satisfies Linter.RulesRecord; | |
export default defineConfigWithVueTs( | |
{ | |
name: "files-to-lint", | |
files: ["**/*.{js,ts,vue}"], | |
}, | |
pluginVue.configs["flat/essential"], | |
vueTsConfigs.recommended, | |
{ | |
name: "js-rules", | |
files: ["**/*.js"], | |
rules: {}, | |
}, | |
{ | |
name: "ts-rules", | |
files: ["**/*.ts"], | |
rules: commonRules, | |
}, | |
{ | |
name: "vue-rules", | |
files: ["**/*.vue"], | |
rules: commonRules, | |
}, | |
{ | |
...pluginVitest.configs.recommended, | |
files: ["src/**/__tests__/**"], | |
rules: { | |
"vitest/no-commented-out-tests": "warn", | |
"@typescript-eslint/await-thenable": "error", | |
}, | |
}, | |
globalIgnores(["**/dist/**", "**/coverage/**"]), | |
skipFormatting | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment