Skip to content

Commit 4cf3752

Browse files
committed
Replace .eslintrc.ts with eslint.config.ts
1 parent 686ace6 commit 4cf3752

File tree

3 files changed

+56
-24
lines changed

3 files changed

+56
-24
lines changed

.eslintrc.ts

Lines changed: 0 additions & 24 deletions
This file was deleted.

eslint.config.ts

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import js from "@eslint/js";
2+
import * as tseslint from "typescript-eslint";
3+
import vuePlugin from "eslint-plugin-vue";
4+
import prettierPlugin from "eslint-plugin-prettier";
5+
import prettierConfig from "eslint-config-prettier";
6+
7+
const isProduction = import.meta.env?.PROD || process.env.NODE_ENV === "production";
8+
9+
export default [
10+
js.configs.recommended,
11+
...tseslint.configs.recommended,
12+
13+
// Vue configuration
14+
{
15+
files: ["**/*.vue"],
16+
plugins: {
17+
vue: vuePlugin,
18+
},
19+
languageOptions: {
20+
parser: "vue-eslint-parser",
21+
parserOptions: {
22+
parser: tseslint.parser,
23+
ecmaVersion: 2022,
24+
extraFileExtensions: [".vue"],
25+
sourceType: "module",
26+
},
27+
},
28+
rules: {
29+
...vuePlugin.configs.essential.rules,
30+
"vue/multi-word-component-names": "off",
31+
"vue/script-setup-uses-vars": "warn",
32+
"vue/no-unused-components": "off",
33+
},
34+
},
35+
36+
// Global configuration
37+
{
38+
languageOptions: {
39+
ecmaVersion: 2022,
40+
sourceType: "module",
41+
},
42+
plugins: {
43+
prettier: prettierPlugin,
44+
},
45+
rules: {
46+
"no-console": isProduction ? "warn" : "off",
47+
"no-debugger": isProduction ? "warn" : "off",
48+
"no-unused-vars": "off",
49+
"@typescript-eslint/no-var-requires": "off",
50+
"prettier/prettier": "warn",
51+
},
52+
},
53+
54+
prettierConfig, // Turn off rules that conflict with prettier
55+
];

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"lib": ["esnext", "dom", "dom.iterable", "scripthost"]
2222
},
2323
"include": [
24+
"eslint.config.ts",
2425
"src/**/*.ts",
2526
"src/**/*.tsx",
2627
"src/**/*.vue",

0 commit comments

Comments
 (0)