-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.js
117 lines (112 loc) · 2.74 KB
/
eslint.config.js
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
const process = require('node:process')
const antfu = require('@antfu/eslint-config').default
const cspell = require('@cspell/eslint-plugin')
const prettier = require('eslint-plugin-prettier')
const tailwindcss = require('eslint-plugin-tailwindcss')
const testingLibrary = require('eslint-plugin-testing-library')
const isCi = require('is-ci')
const ignores = [
'dist',
'**/dist/**',
'public',
'**/public/**',
'article-templates/templates',
'article-templates/templates/**',
'article-templates/sources',
'article-templates/sources/**',
'block/blocks/',
'block/blocks/**/',
'src/graphql-operations.ts',
'src/graphql-operations.ts/**',
'storybook-static',
'**/storybook-static/**',
'.vscode',
'**/.vscode/**',
'.yarn/**/',
'*.jsonc',
'**/*.jsonc/**',
'*.toml',
'*.yml',
'**/*.yml/**',
'.moon/**/*',
'playwright/utils/*.json',
'playwright/utils/*.json/**',
'tsconfig.json',
]
const isInEditor = !!((process.env.VSCODE_PID || process.env.JETBRAINS_IDE || process.env.VIM) && !isCi)
module.exports = antfu(
{
ignores,
stylistic: false,
typescript: true,
rules: {
'antfu/top-level-function': 'error',
'vue/component-tags-order': 'off',
'vue/component-name-in-template-casing': 'off',
'vue/singleline-html-element-content-newline': 'off',
'vue/html-closing-bracket-newline': 'off',
'vue/multiline-html-element-content-newline': 'off',
'vue/html-indent': 'off',
'vue/html-self-closing': 'off',
},
},
{
ignores,
plugins: { tailwindcss },
rules: {
'tailwindcss/enforces-negative-arbitrary-values': 'warn',
'tailwindcss/enforces-shorthand': 'error',
'tailwindcss/no-custom-classname': [
'warn',
{
whitelist: [
// our utilities
'icon-.*',
// allowed custom class
'custom-input',
'has-dark',
],
},
],
'tailwindcss/no-contradicting-classname': 'error',
},
},
{
name: 'setup-testing-library',
plugins: {
'testing-library': testingLibrary,
},
},
{
files: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
ignores,
rules: {
...testingLibrary.configs.vue.rules,
'testing-library/prefer-screen-queries': 'off',
},
},
// it will stuck in CI, so disable it
...(isCi
? []
: [
{
ignores,
plugins: { '@cspell': cspell },
rules: {
...cspell.configs.recommended.rules,
},
},
]),
...(isInEditor
? []
: [
{
ignores,
plugins: { prettier },
rules: {
'prettier/prettier': 'error',
},
},
]),
{ ignores },
)