-
-
Notifications
You must be signed in to change notification settings - Fork 173
Expand file tree
/
Copy patheslint.config.js
More file actions
120 lines (107 loc) · 3.24 KB
/
Copy patheslint.config.js
File metadata and controls
120 lines (107 loc) · 3.24 KB
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
import { defineConfig } from 'eslint/config'
import js from '@eslint/js'
import globals from 'globals'
import pluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
import pluginPromise from 'eslint-plugin-promise'
import pluginVue from 'eslint-plugin-vue'
const isProduction = process.env.NODE_ENV === 'production'
export default defineConfig([
// Global ignores
{
name: 'global-ignores',
ignores: [
'build/*.js',
'config/*.js',
'src/locales/*',
'!src/locales/en.js',
'!src/locales/en_nft.js',
'!src/locales/en_video-game.js',
'src/stories/*'
]
},
// ESLint recommended rules
js.configs.recommended,
// Vue 3 recommended rules
...pluginVue.configs['flat/recommended'],
// Promise recommended rules
pluginPromise.configs['flat/recommended'],
// Prettier recommended rules
pluginPrettierRecommended,
// Source files configuration
{
name: 'source-files',
files: ['src/**/*.{js,vue}'],
linterOptions: {
reportUnusedDisableDirectives: 'off'
},
languageOptions: {
ecmaVersion: 2020,
sourceType: 'module',
globals: {
...globals.browser,
...globals.es2020
}
},
rules: {
// Console & debugger (production only)
'no-console': isProduction
? ['error', { allow: ['error', 'warn'] }]
: 'off',
'no-debugger': isProduction ? 'error' : 'off',
// Code quality
eqeqeq: ['error', 'always', { null: 'ignore' }],
'no-constant-binary-expression': 'off',
'no-empty-pattern': ['error', { allowObjectPatternsAsParameters: true }],
'no-unused-vars': ['error', { args: 'none', caughtErrors: 'none' }],
'no-var': 'error',
'prefer-const': ['error', { destructuring: 'all' }],
// Promise rules
'promise/always-return': 'off',
'promise/catch-or-return': 'off',
'promise/no-callback-in-promise': 'off',
'promise/no-nesting': 'off',
'promise/no-promise-in-callback': 'off',
'promise/no-return-wrap': 'error',
// Additional rules for Vue
'vue/component-definition-name-casing': ['error', 'kebab-case'],
'vue/component-name-in-template-casing': ['error', 'kebab-case'],
'vue/custom-event-name-casing': ['error', 'kebab-case'],
'vue/eqeqeq': ['error', 'always', { null: 'ignore' }],
'vue/no-unused-emit-declarations': 'error',
'vue/prop-name-casing': ['error', 'camelCase'],
'vue/require-explicit-emits': 'error',
// Disabled vue/recommended rules
'vue/attributes-order': 'off',
'vue/multi-word-component-names': 'off',
'vue/no-required-prop-with-default': 'off',
'vue/no-v-html': 'off',
'vue/order-in-components': 'off',
'vue/require-default-prop': 'off',
'vue/require-prop-types': 'off',
'vue/no-template-shadow': 'off'
}
},
// Test files configuration
{
name: 'test-files',
files: ['tests/**/*.{js,vue}'],
languageOptions: {
globals: {
...globals.vitest,
...globals.browser,
cy: 'readonly'
}
}
},
// ESM config files
{
name: 'config-esm',
files: ['*.config.js'],
languageOptions: {
sourceType: 'module',
globals: {
...globals.node
}
}
}
])