Set up eslint with type information
This commit is contained in:
parent
4aeb9eb8bd
commit
fba72e723f
2 changed files with 22 additions and 6 deletions
|
|
@ -1,3 +1,5 @@
|
|||
// @ts-check
|
||||
|
||||
// https://eslint.org/docs/latest/use/configure/
|
||||
// https://eslint.vuejs.org/user-guide/
|
||||
|
||||
|
|
@ -7,15 +9,29 @@ import pluginVue from "eslint-plugin-vue";
|
|||
import configPrettier from "eslint-config-prettier";
|
||||
|
||||
export default tseslint.config(
|
||||
{ ignores: ["dist/", "src/vite-env.d.ts"] },
|
||||
{ ignores: ["dist/", "eslint.config.js", "vite.config.ts", "src/vite-env.d.ts"] },
|
||||
|
||||
eslint.configs.recommended,
|
||||
...tseslint.configs.recommended,
|
||||
...tseslint.configs.stylistic,
|
||||
...tseslint.configs.strictTypeChecked,
|
||||
...tseslint.configs.stylisticTypeChecked,
|
||||
...pluginVue.configs["flat/recommended"],
|
||||
|
||||
// We don't want prettier's formatting decisions being second-guessed by eslint.
|
||||
// Prettier's formatting decisions should not be second-guessed by eslint.
|
||||
configPrettier,
|
||||
|
||||
// We need to tell the vue parser that it should use the ts parser instead of the js parser.
|
||||
// Set up the ts parser to use type info and understand vue files.
|
||||
{
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
projectService: true,
|
||||
tsconfigRootDir: import.meta.dirname,
|
||||
|
||||
// Otherwise the parser will complain that it doesn't know vue files.
|
||||
extraFileExtensions: ["vue"],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// Tell the vue parser that it should use the ts parser instead of the js parser.
|
||||
{ files: ["**/*.vue"], languageOptions: { parserOptions: { parser: tseslint.parser } } },
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue