-
Notifications
You must be signed in to change notification settings - Fork 28
/
eslint.config.js
103 lines (91 loc) · 3 KB
/
eslint.config.js
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
import js from '@eslint/js';
import pluginQuasar from '@quasar/app-vite/eslint';
import skipFormattingConfig from '@vue/eslint-config-prettier/skip-formatting';
import vueTsEslintConfig from '@vue/eslint-config-typescript';
import perfectionist from 'eslint-plugin-perfectionist';
import pluginVue from 'eslint-plugin-vue';
import globals from 'globals';
export default [
{
ignores: [
'**/.DS_Store',
'.yarn/',
'src/css/mmm-icons.css',
'build/',
'!build/svg2font.js',
'src/renderer/',
'src/main/',
'docs/src/**/*',
'!docs/src/en/**/*',
'LICENSE.md',
'docs/.vitepress/dist',
'docs/.vitepress/cache',
],
},
...pluginQuasar.configs.recommended(),
js.configs.recommended,
// https://eslint.vuejs.org
...pluginVue.configs['flat/recommended'],
// https://typescript-eslint.io/rules/
{
files: ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.vue'],
rules: {
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/no-import-type-side-effects': 'error',
},
},
// https://github.com/vuejs/eslint-config-typescript
...vueTsEslintConfig({
// https://typescript-eslint.io/users/configs#recommended-configurations
extends: ['strict', 'stylistic'],
}),
// https://typescript-eslint.io/rules/
{
files: ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.vue'],
rules: {
// Turn off the recommended rules that you don't need.
},
},
perfectionist.configs['recommended-natural'],
{
languageOptions: {
ecmaVersion: 'latest',
globals: {
...globals.browser,
...globals.node, // SSR, Electron, config files
browser: 'readonly', // bex related
Capacitor: 'readonly',
chrome: 'readonly', // bex related
cordova: 'readonly',
ga: 'readonly', // Google Analytics
process: 'readonly', // process.env.*
},
sourceType: 'module',
},
rules: {
// https://eslint.org/docs/latest/rules/
'array-callback-return': 'error',
'no-constant-binary-expression': 'error',
'no-constructor-return': 'error',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-duplicate-imports': 'error',
'no-new-native-nonconstructor': 'error',
'no-promise-executor-return': 'error',
'no-self-compare': 'error',
'no-template-curly-in-string': 'error',
'no-unmodified-loop-condition': 'error',
'no-unreachable-loop': 'error',
'prefer-promise-reject-errors': 'off',
// https://eslint.vuejs.org/rules/
'vue/attributes-order': ['error', { alphabetical: true }],
'vue/block-lang': ['error', { script: { lang: 'ts' } }],
'vue/block-order': 'error',
'vue/component-api-style': ['error', ['script-setup']],
'vue/define-props-declaration': 'error',
'vue/enforce-style-attribute': 'error',
'vue/no-boolean-default': 'error',
'vue/prefer-true-attribute-shorthand': 'error',
},
},
skipFormattingConfig,
];