-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.mjs
152 lines (150 loc) · 4.73 KB
/
index.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
import eslint from '@eslint/js'
import tseslint from 'typescript-eslint'
import vueParser from 'vue-eslint-parser'
import pluginVue from 'eslint-plugin-vue'
import stylistic from '@stylistic/eslint-plugin'
import globals from 'globals'
// Compatibility utils
import { FlatCompat } from '@eslint/eslintrc'
import { fixupConfigRules } from '@eslint/compat'
const compat = new FlatCompat()
export default [
eslint.configs.recommended,
...tseslint.configs.recommended,
...pluginVue.configs['flat/recommended'],
// See here for compatibility: https://github.com/eslint-community/eslint-plugin-promise/issues/449#issuecomment-2108572139
...fixupConfigRules(
compat.config({
extends: ['plugin:promise/recommended'],
}),
),
// Global ignores
{
ignores: [
'**/node_modules/',
'**/dist/',
'**/build/',
'**/public/',
'**/bin/',
'**/.nuxt/',
'**/.output/',
'**/.wrangler/',
'**/.vitepress/cache/',
],
},
{
files: [
'**/*.{js,mjs,cjs,jsx,ts,tsx,mts,cts,vue}',
],
languageOptions: {
parser: vueParser,
parserOptions: {
parser: tseslint.parser,
},
ecmaVersion: 'latest',
sourceType: 'module',
globals: {
...globals['shared-node-browser'],
...globals.node,
...globals.browser,
},
},
plugins: {
'@stylistic': stylistic,
},
ignores: [
'**/locales/**/*.json',
],
rules: {
'@stylistic/indent': ['error', 2],
'@stylistic/quotes': ['error', 'single', {
avoidEscape: true,
}],
'@stylistic/semi': ['error', 'never'],
'@stylistic/space-before-function-paren': ['error', {
anonymous: 'never',
named: 'never',
asyncArrow: 'always',
}],
'@stylistic/comma-dangle': ['error', 'always-multiline'],
// Ensures ESLint understands that `defineEmits<{ ... }>()` does _not_ fail this rule.
'@stylistic/function-call-spacing': ['error', 'never'],
'@stylistic/brace-style': ['error', '1tbs'],
'@stylistic/array-bracket-spacing': ['error', 'never', {
singleValue: false,
objectsInArrays: false,
}],
'@stylistic/object-curly-spacing': ['error', 'always', {
arraysInObjects: true,
objectsInObjects: true,
}],
'@stylistic/padded-blocks': 'off',
'@stylistic/no-trailing-spaces': 'error',
'@stylistic/no-multi-spaces': 'error',
'@stylistic/space-before-blocks': ['error', 'always'],
'@stylistic/space-infix-ops': ['error', { 'int32Hint': false }],
'@stylistic/keyword-spacing': ['error', {
before: true,
after: true,
}],
'no-unused-vars': 'off',
camelcase: 'off',
'no-console': 'off',
'no-debugger': 'warn',
'promise/always-return': ['error', {
ignoreLastCallback: true,
}],
'@typescript-eslint/no-explicit-any': 'off',
'vue/attributes-order': ['error', {
alphabetical: true,
}],
'vue/multiline-html-element-content-newline': ['error', {
ignoreWhenEmpty: true,
ignores: ['code', 'pre', 'textarea', 'a', 'span', 'router-link'],
}],
'@typescript-eslint/consistent-type-imports': ['error', {
prefer: 'type-imports',
fixStyle: 'separate-type-imports',
}],
'@typescript-eslint/ban-ts-comment': ['warn', {
'ts-ignore': 'allow-with-description',
'ts-expect-error': 'allow-with-description',
'ts-nocheck': 'allow-with-description',
minimumDescriptionLength: 10,
}],
'@typescript-eslint/no-unused-vars': 'warn',
'vue/no-restricted-static-attribute': ['error',
{
key: 'data-test-id',
message: 'Using "data-test-id" is not allowed. Use "data-testid" instead.',
},
{
key: 'data-tracking-id',
message: 'Using "data-tracking-id" is not allowed. Use "data-testid" instead.',
},
{
key: 'data-allow-mismatch',
message: 'Using "data-allow-mismatch" to prevent hydration errors is _very_ discouraged. \nPlease attempt to resolve the underlying hydration issue. If you are unable to resolve the issue and must use this attribute, please only disable the error for the impacted line.',
},
],
'vue/no-restricted-v-bind': ['error',
{
argument: 'data-test-id',
message: 'Using "data-test-id" is not allowed. Use "data-testid" instead.',
},
{
argument: 'data-tracking-id',
message: 'Using "data-tracking-id" is not allowed. Use "data-testid" instead.',
},
],
},
},
{
files: [
'**/*.{js,cjs,jsx}',
],
rules: {
'@typescript-eslint/no-var-requires': 'off',
},
},
]