-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.mjs
163 lines (160 loc) · 4.63 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
import globals from 'globals';
import pluginJs from '@eslint/js';
import pluginTseslint from 'typescript-eslint';
import pluginVue from 'eslint-plugin-vue';
import pluginCompat from 'eslint-plugin-compat';
import pluginNoLoops from 'eslint-plugin-no-loops';
import pluginSonarjs from 'eslint-plugin-sonarjs';
import pluginNoUseExtendNative from 'eslint-plugin-no-use-extend-native';
import pluginOptimizeRegex from 'eslint-plugin-optimize-regex';
import pluginPromise from 'eslint-plugin-promise';
import pluginJest from 'eslint-plugin-jest';
import pluginPrettierVue from 'eslint-plugin-prettier-vue';
// import pluginImport from 'eslint-plugin-import';
// import pluginImportConfig from 'eslint-plugin-import/config/flat/recommended.js';
/** @type {import('eslint').Linter.Config[]} */
export default [
// Plugins setup
pluginJs.configs['recommended'],
...pluginTseslint.configs['recommended'],
...pluginVue.configs['flat/strongly-recommended'],
pluginCompat.configs['flat/recommended'],
pluginNoUseExtendNative.configs['recommended'],
pluginPromise.configs['flat/recommended'],
pluginJest.configs['flat/recommended'],
// pluginImportConfig, // Not working with .vue files
{
plugins: {
'optimize-regex': pluginOptimizeRegex,
sonarjs: pluginSonarjs,
'no-loops': pluginNoLoops,
'prettier-vue': pluginPrettierVue,
// 'import': pluginImport,
},
settings: {
'prettier-vue': {
SFCBlocks: {
template: true,
script: true,
style: false, // lints by stylelint
},
},
},
},
{
name: 'Global ignores',
ignores: ['dist/', 'certbot/', 'coverage/', 'docs/'],
},
// Custom setup
{
name: 'All es6 code files',
files: ['src/**/*.{js,mjs,cjs,ts,mts,jsx,tsx,vue}'],
languageOptions: {
globals: globals.browser,
parserOptions: {
parser: pluginTseslint.parser,
ecmaVersion: 2020,
ecmaFeatures: {
jsx: true,
},
},
},
rules: {
'@typescript-eslint/no-explicit-any': 'off',
},
},
{
name: 'Node.js builders files',
files: ['vite.config.{js,ts,mjs,mts}', 'jsdoc.config.{js,ts,mjs,mts}'],
languageOptions: {
globals: globals.node,
},
},
{
name: 'Jest test files',
files: ['**/*.(test|spec).?(m)(js|ts)?(x)'],
languageOptions: {
globals: globals.jest,
},
},
{
name: 'Vue files',
files: ['src/**/*.vue'],
rules: {
'vue/multi-word-component-names': 'off',
'vue/no-mutating-props': 'off',
// 'vue/v-for-delimiter-style': ['error', 'of'],
'vue/require-v-for-key': 'off',
'vue/next-tick-style': ['error', 'promise'],
'vue/require-prop-types': 'error',
'vue/prop-name-casing': ['error', 'camelCase'],
'vue/component-name-in-template-casing': ['error', 'PascalCase'],
'vue/component-definition-name-casing': ['error', 'PascalCase'],
'vue/custom-event-name-casing': ['error', 'camelCase'],
'vue/no-duplicate-attr-inheritance': 'error',
'vue/this-in-template': ['error', 'never'],
'vue/v-on-style': ['error', 'shorthand'],
'vue/no-multi-spaces': 'error',
'vue/html-indent': 'error',
'vue/padding-line-between-blocks': 'error',
'vue/component-tags-order': [
'error',
{
order: ['style', 'template', 'script'],
},
],
"vue/max-attributes-per-line": ["error", {
"singleline": {
"max": Infinity
},
"multiline": {
"max": 1
}
}],
'vue/singleline-html-element-content-newline': 'off',
'vue/v-on-event-hyphenation': ['error', 'always'],
'vue/attribute-hyphenation': ['error', 'always'],
'vue/v-bind-style': 'error',
'vue/v-slot-style': ['error', 'shorthand'],
'vue/no-unused-properties': [
'warn',
{
groups: ['props', 'data', 'computed', 'setup'], // 'methods'
ignorePublicMembers: true,
},
],
'max-len': [
'warn',
140,
2,
{
ignoreComments: true,
ignoreRegExpLiterals: true,
ignoreStrings: false,
ignoreTemplateLiterals: false,
},
],
'vue/order-in-components': [
'error',
{
order: [
'name',
'directives',
'components',
'mixins',
['provide', 'inject'],
'model',
'props',
'filters',
'data',
'computed',
'LIFECYCLE_HOOKS',
'ROUTER_GUARDS',
'methods',
'watch',
],
},
],
},
},
];