-
Notifications
You must be signed in to change notification settings - Fork 26
/
.eslintrc.cjs
108 lines (104 loc) · 3.45 KB
/
.eslintrc.cjs
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
/**
* @type {import("eslint").Linter.Config}
*/
module.exports = {
root: true,
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:@typescript-eslint/strict',
],
env: {
browser: true,
es2017: true,
node: true,
},
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
parserOptions: {
tsconfigRootDir: __dirname,
project: './tsconfig.lint.json',
extraFileExtensions: ['.svelte'],
},
globals: {
svelte: 'readonly',
$$Generic: 'readonly',
},
ignorePatterns: ['src/routes/*', 'src/tests/*', '*.cjs'],
rules: {
// TODO: work on removing these
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-misused-promises': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-floating-promises': 'off',
'no-extra-semi': 'off',
},
overrides: [
{
files: ['*.svelte'],
extends: ['plugin:svelte/recommended'],
parser: 'svelte-eslint-parser',
parserOptions: {
sourceType: 'module',
ecmaVersion: 'latest',
parser: '@typescript-eslint/parser',
extraFileExtensions: ['.svelte'],
tsconfigRootDir: __dirname,
project: './tsconfig.lint.json',
},
settings: {
// https://ota-meshi.github.io/eslint-plugin-svelte/user-guide/#settings-svelte
svelte: {
ignoreWarnings: [
'@typescript-eslint/no-unsafe-assignment', // reduce false positives
'@typescript-eslint/no-unsafe-member-access', // reduce false positives
],
},
},
rules: {
// incompatible with svelte's generic props
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
// not consistent in svelte files
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unnecessary-condition': 'off',
// Svelte
'svelte/no-dupe-use-directives': 'error',
'svelte/no-dom-manipulating': 'warn',
'svelte/no-export-load-in-svelte-module-in-kit-pages': 'error',
'svelte/no-store-async': 'error',
'svelte/require-store-callbacks-use-set-param': 'error',
// 'svelte/valid-prop-names-in-kit-pages': 'error',
'svelte/no-target-blank': 'error',
'svelte/no-reactive-functions': 'error',
'svelte/no-reactive-literals': 'error',
'svelte/no-useless-mustaches': 'error',
'svelte/require-optimized-style-attribute': 'error',
'svelte/require-stores-init': 'error',
'no-trailing-spaces': 'off', // superseded
'svelte/no-trailing-spaces': 'error',
// Stylistic
'svelte/derived-has-same-inputs-outputs': 'error',
// 'svelte/first-attribute-linebreak': 'error',
'svelte/html-closing-bracket-spacing': 'error',
'svelte/html-quotes': 'error',
// 'svelte/max-attributes-per-line': 'error',
'svelte/mustache-spacing': 'error',
'svelte/no-extra-reactive-curlies': 'error',
'svelte/no-spaces-around-equal-signs-in-attribute': 'error',
'svelte/prefer-class-directive': 'error',
'svelte/prefer-style-directive': 'error',
'svelte/shorthand-attribute': 'error',
'svelte/shorthand-directive': 'error',
// 'svelte/sort-attributes': 'error',
'svelte/spaced-html-comment': 'error',
},
},
],
}