-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.mjs
82 lines (70 loc) · 3.44 KB
/
eslint.config.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import eslint from "@eslint/js";
import tseslint from "typescript-eslint";
import configPrettier from "eslint-config-prettier";
import vueParser from "vue-eslint-parser";
import pluginVue from "eslint-plugin-vue";
import pluginPrettier from "eslint-plugin-prettier";
import pluginImportPath from "eslint-plugin-no-relative-import-paths";
import pluginUnusedImports from "eslint-plugin-unused-imports";
export default [
{
ignores: [
"*.config.{js,ts,mjs}",
"*.json",
"**/proto/",
"*.d.ts",
"dist/"
],
},
eslint.configs.recommended,
...tseslint.configs.strict,
...pluginVue.configs["flat/recommended"],
configPrettier,
{
//files: ["./src/**/*.{vue,js,ts,jsx,tsx}"],
languageOptions: {
parser: vueParser,
parserOptions: {
parser: tseslint.parser,
project: './tsconfig.json',
extraFileExtensions: [".vue"],
}
},
plugins: {
'prettier': pluginPrettier,
'no-relative-import-paths': pluginImportPath,
'unused-imports': pluginUnusedImports,
},
rules: {
'vue/component-tags-order': ['error', { order: ['template', 'script', 'style'] }],
"vue/multi-word-component-names": "off",
"vue/singleline-html-element-content-newline": "off",
'vue/component-api-style': ['error', ['script-setup']], // Use script setup
'vue/component-name-in-template-casing': ['error', 'PascalCase'], // PascalCase component names
'vue/v-for-delimiter-style': ['error', 'in'], // Use 'in' delimiter for v-for
radix: ['error', 'always'], // Enforce radix when using parseInt()
curly: 1, // Enforce curly braces for control statements
'@typescript-eslint/explicit-function-return-type': [2], // Enforce explicit return types for functions
'@typescript-eslint/prefer-ts-expect-error': [2], // Prefer @ts-expect-error over @ts-ignore
'@typescript-eslint/ban-ts-comment': [0], // Allow @ts-comment
'ordered-imports': [0], // Allow/disallow ordered imports
'object-literal-sort-keys': [0], // Allow/disallow sorting of object literal keys
'new-parens': 1, // Enforce parentheses with 'new'
'no-bitwise': 1, // Disallow bitwise operators
'no-cond-assign': 1, // Disallow assignment within conditionals
'no-trailing-spaces': 0, // Allow/disallow trailing spaces
'eol-last': 1, // Enforce newline at end of files
'func-style': ['error', 'declaration', { allowArrowFunctions: true }], // Enforce function style
'no-var': 2, // Disallow 'var' keyword
'prettier/prettier': 'warn', // Integrate Prettier and warn about style discrepancies
'no-void': ['error', { allowAsStatement: true }], // Disallow 'void' operator, except as a statement
'no-relative-import-paths/no-relative-import-paths': ['warn', { allowSameFolder: true, rootDir: 'src', prefix: '@' }], // No relative imports
"@typescript-eslint/no-explicit-any": "off", // Disallow 'any' type
"sort-imports": ["error", { "ignoreCase": true, "ignoreDeclarationSort": true}], // Enforce sorted import declarations within modules
// Find and remove unused ES6 module imports.
'no-unused-vars': 'off', // Disable ESLint's 'no-unused-vars'
'unused-imports/no-unused-imports': 'error', // Disallow unused imports
'unused-imports/no-unused-vars': ['error', { vars: 'all', varsIgnorePattern: '^_', args: 'after-used', argsIgnorePattern: '^_' }] // Disallow unused variables and arguments
}
}
];