-
Notifications
You must be signed in to change notification settings - Fork 1
/
eslint.config.js
109 lines (108 loc) · 4.46 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
import js from '@eslint/js';
import stylistic from '@stylistic/eslint-plugin';
import html from '@html-eslint/eslint-plugin';
import htmlparser from '@html-eslint/parser';
import globals from 'globals';
export default [
{
ignores: ['example/dist/*'],
languageOptions: {
globals: {
...globals.browser,
...globals.mocha
}
},
plugins: {
'@stylistic': stylistic
},
linterOptions: {
reportUnusedDisableDirectives: 'error'
},
//include recommended rules directly in the rules object
//it's better to expand the recommended rules here instead of adding them as one of the configuration in the root configurations array
//that's because if other configuration options are specified (especially included and excluded files), they will be applied globally
rules: {
//base rules
...js.configs.recommended.rules,
'array-callback-return': 'error', //possible problem
'consistent-return': 'error', //suggestion
'curly': 'error', //suggestion
'default-case-last': 'error', //suggestion
'default-param-last': 'error', //suggestion
'eqeqeq': 'error', //suggestion
'no-array-constructor': 'error', //suggestion
'no-await-in-loop': 'error', //possible problem
'no-console': 'off', //suggestion
'no-constructor-return': 'error', //possible problem
'no-duplicate-imports': 'error', //possible problem
'no-inner-declarations': 'error', //possible problem
'no-new-wrappers': 'error', //suggestion
'no-promise-executor-return': 'error', //possible problem
'no-proto': 'error', //suggestion
'no-prototype-builtins': 'off', //default possible problem, but disabled
'no-unmodified-loop-condition': 'error', //possible problem
'no-unreachable-loop': 'error', //possible problem
'no-use-before-define': 'error', //possible problem
'no-useless-assignment': 'error', //possible problem
'no-self-compare': 'error', //possible problem
'no-template-curly-in-string': 'error', //possible problem
'no-var': 'error', //suggestion
'no-with': 'error', //suggestion
'prefer-const': 'error', //suggestion
'prefer-template': 'error', //suggestion
'require-atomic-updates': 'error', //possible problem
'require-await': 'error', //suggestion
'strict': 'error', //suggestion
'yoda': 'error', //suggestion
//stylistic rules
...stylistic.configs['recommended-flat'].rules,
'@stylistic/arrow-parens': ['error', 'as-needed'],
'@stylistic/comma-dangle': ['error', 'never'],
'@stylistic/eol-last': ['error', 'always'],
'@stylistic/indent': ['error', 'tab', {SwitchCase: 1}],
'@stylistic/key-spacing': 'error',
'@stylistic/keyword-spacing': ['error', {overrides: {if: {after: false}, for: {after: false}, switch: {after: false}, while: {after: false}}}],
'@stylistic/linebreak-style': 'error',
'@stylistic/member-delimiter-style': ['error', {multiline: {delimiter: 'semi'}}],
'@stylistic/no-extra-semi': 'error',
'@stylistic/no-multi-spaces': 'error',
'@stylistic/no-multiple-empty-lines': 'error',
'@stylistic/no-tabs': ['error', {allowIndentationTabs: true}],
'@stylistic/no-trailing-spaces': 'error',
'@stylistic/object-curly-spacing': ['error', 'never'],
'@stylistic/quotes': ['error', 'single'],
'@stylistic/semi': ['error', 'always', {omitLastInOneLineBlock: false}],
'@stylistic/space-before-function-paren': ['error', 'never'],
'@stylistic/spaced-comment': ['error', 'never']
}
},
{
files: ['**/*.html'],
ignores: ['example/dist/*'],
languageOptions: {
parser: htmlparser
},
plugins: {
'@html-eslint': html
},
rules: {
'@stylistic/spaced-comment': 'off', //disable the base rule because it conflicts HTML rules
...html.configs['flat/recommended'].rules,
'@html-eslint/attrs-newline': ['error', {ifAttrsMoreThan: 4}],
'@html-eslint/element-newline': ['error', {skip: ['a', 'code', 'p', 'pre', 'span', 'strong', 'time']}],
'@html-eslint/id-naming-convention': ['error'],
'@html-eslint/indent': ['error', 'tab'],
'@html-eslint/lowercase': 'error',
'@html-eslint/no-extra-spacing-attrs': 'error',
'@html-eslint/no-multiple-empty-lines': 'error',
'@html-eslint/no-non-scalable-viewport': 'error',
'@html-eslint/no-skip-heading-levels': 'error',
'@html-eslint/no-target-blank': 'error',
'@html-eslint/no-trailing-spaces': 'error',
'@html-eslint/quotes': 'error',
'@html-eslint/require-closing-tags': ['error', {selfClosing: 'always'}],
'@html-eslint/require-meta-charset': 'error',
'@html-eslint/require-meta-description': 'error'
}
}
];