Skip to content

Commit caebe0d

Browse files
43081jRich-Harris
authored andcommitted
Introduce ESLint to svelte sources (sveltejs#2958)
* introduce eslint * add lint npm script * first eslint run * use tsc stronger checks for unused vars * fix strict typescript unused checks * reintroduce unicode oddities * revert ordering changes * revert whitespace changes * set indent lint rule as error and ignore outliers * revert some more unicode * reintroduce scissors unicode again
1 parent 0dde4f5 commit caebe0d

File tree

98 files changed

+1442
-428
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+1442
-428
lines changed

.eslintignore

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
src/shared
2-
shared.js
3-
store.js
4-
test/test.js
5-
test/setup.js
61
**/_actual.js
7-
**/expected.js
2+
**/expected.js
3+
test/*/samples/*/output.js

.eslintrc.json

+74-41
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,76 @@
11
{
2-
"root": true,
3-
"rules": {
4-
"indent": [2, "tab", { "SwitchCase": 1 }],
5-
"semi": [2, "always"],
6-
"keyword-spacing": [2, { "before": true, "after": true }],
7-
"space-before-blocks": [2, "always"],
8-
"no-mixed-spaces-and-tabs": [2, "smart-tabs"],
9-
"no-cond-assign": 0,
10-
"no-unused-vars": 2,
11-
"object-shorthand": [2, "always"],
12-
"no-const-assign": 2,
13-
"no-class-assign": 2,
14-
"no-this-before-super": 2,
15-
"no-var": 2,
16-
"no-unreachable": 2,
17-
"valid-typeof": 2,
18-
"quote-props": [2, "as-needed"],
19-
"one-var": [2, "never"],
20-
"prefer-arrow-callback": 2,
21-
"prefer-const": [2, { "destructuring": "all" }],
22-
"arrow-spacing": 2,
23-
"no-inner-declarations": 0
24-
},
25-
"env": {
26-
"es6": true,
27-
"browser": true,
28-
"node": true,
29-
"mocha": true
30-
},
31-
"extends": [
32-
"eslint:recommended",
33-
"plugin:import/errors",
34-
"plugin:import/warnings"
35-
],
36-
"parserOptions": {
37-
"ecmaVersion": 9,
38-
"sourceType": "module"
39-
},
40-
"settings": {
41-
"import/core-modules": ["svelte"]
42-
}
2+
"root": true,
3+
"rules": {
4+
"indent": "off",
5+
"no-unused-vars": "off",
6+
"semi": [2, "always"],
7+
"keyword-spacing": [2, { "before": true, "after": true }],
8+
"space-before-blocks": [2, "always"],
9+
"no-mixed-spaces-and-tabs": [2, "smart-tabs"],
10+
"no-cond-assign": 0,
11+
"object-shorthand": [2, "always"],
12+
"no-const-assign": 2,
13+
"no-class-assign": 2,
14+
"no-this-before-super": 2,
15+
"no-var": 2,
16+
"no-unreachable": 2,
17+
"valid-typeof": 2,
18+
"quote-props": [2, "as-needed"],
19+
"one-var": [2, "never"],
20+
"prefer-arrow-callback": 2,
21+
"prefer-const": [2, { "destructuring": "all" }],
22+
"arrow-spacing": 2,
23+
"no-inner-declarations": 0,
24+
"@typescript-eslint/indent": ["error", "tab", {
25+
"SwitchCase": 1,
26+
"ignoredNodes": ["TemplateLiteral"]
27+
}],
28+
"@typescript-eslint/camelcase": "off",
29+
"@typescript-eslint/no-use-before-define": "off",
30+
"@typescript-eslint/array-type": ["error", "array-simple"],
31+
"@typescript-eslint/explicit-function-return-type": "off",
32+
"@typescript-eslint/no-explicit-any": "off",
33+
"@typescript-eslint/explicit-member-accessibility": "off",
34+
"@typescript-eslint/no-unused-vars": ["error", {
35+
"argsIgnorePattern": "^_"
36+
}],
37+
"@typescript-eslint/no-object-literal-type-assertion": ["error", {
38+
"allowAsParameter": true
39+
}],
40+
"@typescript-eslint/no-unused-vars": "off"
41+
},
42+
"env": {
43+
"es6": true,
44+
"browser": true,
45+
"node": true,
46+
"mocha": true
47+
},
48+
"extends": [
49+
"eslint:recommended",
50+
"plugin:import/errors",
51+
"plugin:import/warnings",
52+
"plugin:import/typescript",
53+
"plugin:@typescript-eslint/recommended"
54+
],
55+
"parserOptions": {
56+
"ecmaVersion": 9,
57+
"sourceType": "module"
58+
},
59+
"settings": {
60+
"import/core-modules": [
61+
"svelte",
62+
"svelte/internal",
63+
"svelte/store",
64+
"svelte/easing",
65+
"estree"
66+
]
67+
},
68+
"overrides": [
69+
{
70+
"files": ["*.js"],
71+
"rules": {
72+
"@typescript-eslint/no-var-requires": "off"
73+
}
74+
}
75+
]
4376
}

0 commit comments

Comments
 (0)