-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy patheslint.config.js
More file actions
155 lines (142 loc) · 4.27 KB
/
eslint.config.js
File metadata and controls
155 lines (142 loc) · 4.27 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
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
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',
'app/locales/*',
'!app/locales/en.js',
'!app/locales/en_nft.js',
'!app/locales/en_video-game.js',
'app/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: ['app/**/*.{js,vue}'],
linterOptions: {
reportUnusedDisableDirectives: 'off'
},
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
globals: {
...globals.browser,
...globals.es2021,
// Vue
ref: 'readonly',
reactive: 'readonly',
computed: 'readonly',
watch: 'readonly',
onMounted: 'readonly',
watchEffect: 'readonly',
nextTick: 'readonly',
toValue: 'readonly',
// Nuxt
defineNuxtPlugin: 'readonly',
definePageMeta: 'readonly',
useHead: 'readonly',
useRoute: 'readonly',
useRouter: 'readonly',
useImage: 'readonly',
useAsyncData: 'readonly',
queryCollection: 'readonly',
// i18n
useI18n: 'readonly',
useLocaleHead: 'readonly',
useLocalePath: 'readonly',
useSetI18nParams: 'readonly',
// Project utils (auto-imported)
buildPageMeta: 'readonly',
usePageHead: 'readonly',
usePage: 'readonly',
usePages: 'readonly',
useSEO: 'readonly',
useI18NSlug: 'readonly',
useStudio: 'readonly',
useStudios: 'readonly',
useMarkdownPage: 'readonly'
}
},
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', varsIgnorePattern: '^(props|emit|name)$' }
],
'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,
cy: 'readonly'
}
}
},
// ESM config files
{
name: 'config-esm',
files: ['*.config.js'],
languageOptions: {
sourceType: 'module',
globals: {
...globals.node
}
}
}
])