forked from Aetherinox/obsidian-dataview-snippets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.js
151 lines (133 loc) · 5.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
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
const tsParser = require('@typescript-eslint/parser');
const js = require('@eslint/js');
const globals = require('globals');
const ts = require('@typescript-eslint/eslint-plugin');
const eslintConfigPrettier = require('eslint-config-prettier');
const prettier = require('eslint-plugin-prettier');
const stylisticJs = require('@stylistic/eslint-plugin-js');
const stylisticTs = require('@stylistic/eslint-plugin-ts');
const stylisticPlus = require('@stylistic/eslint-plugin-plus')
module.exports = [
{
files: [
'**/*.ts',
'./src/**/*.ts',
'./test/**/*.ts'
],
plugins: {
'@typescript-eslint': ts,
'prettier': prettier,
'@stylistic/js': stylisticJs,
'@stylistic/ts': stylisticTs,
'@stylistic/plus': stylisticPlus
},
languageOptions: {
parser: tsParser,
globals: {
...globals.browser,
},
parserOptions: {
project: ['tsconfig.json'],
},
},
rules: {
...js.configs.recommended.rules,
...ts.configs['stylistic-type-checked'].rules,
// eslint/js rules
'indent': [1, 4],
'space-before-function-paren': 0,
'prefer-const': 1,
'comma-dangle': 0,
'keyword-spacing': ['error', { before: true, after: true }],
'comma-spacing': ['error', { before: false, after: true }],
'indent': 0,
'prefer-spread': 1,
'eqeqeq': ['error', 'smart'],
'no-unexpected-multiline': 0,
'no-prototype-builtins': 0,
'no-useless-escape': 1,
'no-mixed-operators': 1,
'no-control-regex': 0,
'no-console': 2,
'no-var': 2,
'no-undef': 0,
'no-redeclare': 'error',
'no-unused-vars': [
'error',
{
'argsIgnorePattern': '^_',
'varsIgnorePattern': '^_',
'ignoreRestSiblings': true
}
],
'@stylistic/js/no-multi-spaces': [ 0, { ignoreEOLComments: true } ],
'@stylistic/js/arrow-spacing': [ 'error', { before: true, after: true } ],
'@stylistic/js/arrow-parens': [ 'error', 'always' ],
'@stylistic/js/block-spacing': [ 'error', 'always' ],
'@stylistic/ts/block-spacing': [ 'error', 'always' ],
'@stylistic/js/brace-style': [ 'error', 'allman', { allowSingleLine: true } ],
'@stylistic/ts/brace-style': [ 'error', 'allman', { allowSingleLine: true } ],
'@stylistic/js/comma-dangle': [ 'error', 'never' ],
'@stylistic/ts/comma-dangle': [ 'error', 'never' ],
'@stylistic/js/comma-spacing': [ 'error', { before: false, after: true }],
'@stylistic/ts/comma-spacing': [ 'error', { before: false, after: true }],
'@stylistic/js/keyword-spacing': [ 'error', {
before: true,
after: true,
'overrides':
{
return: { before: true, after: true },
throw: { before: true, after: true },
case: { before: true, after: true },
as: { before: true, after: true },
if: { before: true, after: true },
for: { before: true, after: true },
while: { before: true, after: true },
static: { before: true, after: true }
},
}],
'@stylistic/ts/keyword-spacing': ['error', {
before: true,
after: true,
'overrides':
{
return: { before: true, after: true },
throw: { before: true, after: true },
case: { before: true, after: true },
as: { before: true, after: true },
if: { before: true, after: true },
for: { before: true, after: true },
while: { before: true, after: true },
static: { before: true, after: true }
},
}],
'@stylistic/js/computed-property-spacing': ['error', 'always'],
'@stylistic/js/eol-last': ['error', 'always'],
'@stylistic/js/jsx-quotes': ['error', 'prefer-single'],
'@stylistic/js/linebreak-style': ['error', 'unix'],
'@stylistic/js/no-mixed-spaces-and-tabs': ['error'],
'@stylistic/js/no-tabs': ['error'],
'@stylistic/js/no-trailing-spaces': ['error', { 'skipBlankLines': true, 'ignoreComments': true }],
'@stylistic/js/no-whitespace-before-property': ['error'],
'@stylistic/js/object-curly-spacing': ['error', 'always'],
'@stylistic/ts/object-curly-spacing': ['error', 'always'],
'@stylistic/js/quote-props': ['error', 'as-needed'],
'@stylistic/ts/quote-props': ['error', 'as-needed'],
'@stylistic/js/quotes': ['error', 'single', { 'allowTemplateLiterals': true }],
'@stylistic/ts/quotes': ['error', 'single', { 'allowTemplateLiterals': true }],
'@stylistic/js/semi': ['error', 'never'],
'@stylistic/ts/semi': ['error', 'never'],
'@stylistic/js/space-in-parens': ['error', 'always'],
'@stylistic/js/space-infix-ops': ['error'],
'@stylistic/ts/space-infix-ops': ['error'],
'@stylistic/js/spaced-comment': ['error', 'always'],
'@stylistic/js/template-curly-spacing': ['error', 'always'],
'@stylistic/js/template-tag-spacing': ['error', 'always'],
'@stylistic/js/wrap-iife': [2, "inside", { functionPrototypeMethods: true }],
'@stylistic/plus/type-named-tuple-spacing': ["error"],
'@stylistic/plus/type-generic-spacing': ["error"],
// 'prettier/prettier': ['error'],
// @typescript-eslint rules
'@typescript-eslint/prefer-nullish-coalescing': 'off' // require `strictNullChecks`
},
}];