-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.js
136 lines (135 loc) · 3.39 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
import globals from 'globals';
import js from '@eslint/js';
import markdownlint from 'eslint-plugin-markdownlint';
import markdownlintParser from 'eslint-plugin-markdownlint/parser.js';
import ts from 'typescript-eslint';
import vue from 'eslint-plugin-vue';
import vueParser from 'vue-eslint-parser';
export default [
{
ignores: [
'.vitepress/cache/',
'.vitepress/dist/',
],
},
{
files: ['README.md', 'notes/**/*.md'],
languageOptions: {
parser: markdownlintParser,
},
plugins: {
markdownlint,
},
rules: {
...markdownlint.configs.recommended.rules,
'markdownlint/md010': [
'error', {
code_blocks: false,
spaces_per_tab: 2,
},
],
'markdownlint/md013': [
'error', {
code_blocks: false,
line_length: 100,
tables: false,
},
],
'markdownlint/md033': [
'error', {
allowed_elements: ['br', 'span'],
},
],
},
},
{
files: [
'.vitepress/config.ts',
'.vitepress/theme/**/*.ts',
'shims.d.ts',
],
languageOptions: {
parser: ts.parser,
},
rules: {
...js.configs.all.rules,
...ts.configs.recommended.rules,
},
},
{
files: ['.vitepress/theme/**/*.vue'],
languageOptions: {
parser: vueParser,
parserOptions: {
parser: ts.parser,
},
},
plugins: {
vue,
},
processor: 'vue/vue',
rules: {
...js.configs.all.rules,
...vue.configs.base.rules,
...vue.configs.essential.rules,
...vue.configs['vue3-strongly-recommended'].rules,
...vue.configs['vue3-recommended'].rules,
'no-useless-assignment': 'off',
'vue/html-self-closing': ['error', { html: { normal: 'any' } }],
},
},
{
files: ['eslint.config.js'],
rules: js.configs.all.rules,
},
{
files: [
'.vitepress/config.ts',
'.vitepress/theme/**/*.ts',
'.vitepress/theme/**/*.vue',
'eslint.config.js',
'shims.d.ts',
],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
sourceType: 'module',
},
rules: {
'array-element-newline': ['error', 'consistent'],
'comma-dangle': ['error', 'always-multiline'],
'dot-location': ['error', 'property'],
'func-style': ['error', 'declaration'],
'function-call-argument-newline': ['error', 'consistent'],
'indent': ['error', 2, { SwitchCase: 1 }],
'init-declarations': 'off',
'max-len': ['error', { code: 100 }],
'multiline-ternary': 'off',
'no-extra-parens': ['error', 'all', { nestedBinaryExpressions: false }],
'no-magic-numbers': [
'error', {
enforceConst: true,
ignore: [-1, 0, 1],
},
],
'no-plusplus': 'off',
'no-ternary': 'off',
'no-warning-comments': 'warn',
'object-curly-spacing': ['error', 'always'],
'one-var': ['error', 'never'],
'operator-linebreak': ['error', 'before'],
'padded-blocks': ['error', 'never'],
'prefer-object-has-own': 'off',
'quote-props': ['error', 'consistent-as-needed'],
'quotes': ['error', 'single', { avoidEscape: true }],
'space-before-function-paren': ['error', { named: 'never' }],
},
},
{
files: ['eslint.config.js'],
rules: {
'camelcase': 'off',
'no-magic-numbers': 'off',
},
},
];