-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.cjs
172 lines (170 loc) · 5.3 KB
/
eslint.config.cjs
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
164
165
166
167
168
169
170
171
172
const { FlatCompat } = require('@eslint/eslintrc');
const compat = new FlatCompat();
const isProduction = process.env.NODE_ENV === 'production';
module.exports = [
{
ignores: [
'**/node_modules/**',
'**/dist/**',
'**/frontend/dist/**',
'**/build/**',
'**/new_venv/**',
'**/coverage/**',
'**/*.min.js',
'**/language-plugins/**',
'**/static/**',
'**/logs/**',
'**/*.d.ts',
'**/*.min.css',
'**/docs/**',
'**/public/**',
'**/html-report/**',
'**/reports/jest-html-reporters-attach/report/**',
],
files: [
'**/*.js',
'**/*.jsx',
'**/*.ts',
'**/*.tsx',
'**/*.vue',
'**/*.cjs',
],
languageOptions: {
ecmaVersion: 2021,
sourceType: 'module',
parser: require('@babel/eslint-parser'),
parserOptions: {
requireConfigFile: false,
babelOptions: {
configFile: './babel.config.cjs',
},
},
globals: {
browser: true,
node: true,
es2021: true,
require: true,
module: true,
exports: true,
process: true,
__dirname: true,
beforeAll: true,
afterAll: true,
describe: true,
it: true,
expect: true,
jest: true,
beforeEach: true,
afterEach: true,
global: true,
window: true,
document: true,
console: true,
},
},
plugins: {
import: require('eslint-plugin-import'),
react: require('eslint-plugin-react'),
'react-hooks': require('eslint-plugin-react-hooks'),
'jsx-a11y': require('eslint-plugin-jsx-a11y'),
prettier: require('eslint-plugin-prettier'),
vue: require('eslint-plugin-vue'),
node: require('eslint-plugin-node'),
jest: require('eslint-plugin-jest'),
},
rules: {
'no-console': isProduction ? 'warn' : 'off',
'no-debugger': 'warn',
semi: ['error', 'always'],
quotes: ['error', 'single'],
indent: ['error', 2],
'linebreak-style': ['error', 'unix'],
eqeqeq: ['error', 'always'],
'no-trailing-spaces': 'error',
'space-before-blocks': 'error',
'keyword-spacing': ['error', { before: true, after: true }],
'space-infix-ops': 'error',
'comma-spacing': ['error', { before: false, after: true }],
'key-spacing': ['error', { beforeColon: false, afterColon: true }],
'space-unary-ops': ['error', { words: true, nonwords: false }],
'no-unused-vars': 'warn',
'no-undef': 'error',
'consistent-return': 'error',
'no-param-reassign': 'error',
'prefer-const': 'error',
'no-var': 'error',
'no-use-before-define': 'error',
'arrow-spacing': ['error', { before: true, after: true }],
'no-multi-spaces': 'error',
'import/order': ['error', { 'newlines-between': 'always' }],
'import/newline-after-import': 'off',
'import/no-unresolved': 'off',
'import/no-duplicates': 'error',
'react/jsx-uses-react': 'error',
'react/jsx-uses-vars': 'error',
'react/react-in-jsx-scope': 'off',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'jsx-a11y/accessible-emoji': 'warn',
'jsx-a11y/alt-text': 'warn',
'jsx-a11y/anchor-has-content': 'warn',
'jsx-a11y/anchor-is-valid': 'warn',
'jsx-a11y/aria-activedescendant-has-tabindex': 'warn',
'jsx-a11y/aria-props': 'warn',
'jsx-a11y/aria-proptypes': 'warn',
'jsx-a11y/aria-role': 'warn',
'jsx-a11y/aria-unsupported-elements': 'warn',
'jsx-a11y/heading-has-content': 'warn',
'jsx-a11y/html-has-lang': 'warn',
'jsx-a11y/iframe-has-title': 'warn',
'jsx-a11y/img-redundant-alt': 'warn',
'jsx-a11y/no-access-key': 'warn',
'jsx-a11y/no-distracting-elements': 'warn',
'jsx-a11y/no-redundant-roles': 'warn',
'jsx-a11y/role-has-required-aria-props': 'warn',
'jsx-a11y/role-supports-aria-props': 'warn',
'prettier/prettier': ['error', { endOfLine: 'auto' }],
'vue/no-unused-vars': 'warn',
'vue/html-indent': ['error', 2],
'vue/max-attributes-per-line': ['error', { singleline: 1, multiline: 1 }],
'vue/multiline-html-element-content-newline': [
'error',
{ ignoreWhenEmpty: true, allowEmptyLines: false },
],
'vue/singleline-html-element-content-newline': 'error',
'vue/html-self-closing': [
'error',
{
html: {
void: 'always',
normal: 'never',
component: 'always',
},
},
],
'node/no-missing-require': 'off',
'node/no-unpublished-require': 'off',
'node/no-extraneous-require': 'off',
'jest/no-disabled-tests': 'warn',
'jest/no-focused-tests': 'error',
'jest/no-identical-title': 'error',
'jest/prefer-to-have-length': 'warn',
'jest/valid-expect': 'error',
},
settings: {
react: {
version: 'detect',
},
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx', '.vue', '.json'],
},
},
node: {
tryExtensions: ['.js', '.json', '.node', '.cjs', '.mjs'],
},
},
},
...compat.extends('plugin:vue/vue3-recommended'),
...compat.extends('plugin:prettier/recommended'),
];