Skip to content

Commit 874a7f6

Browse files
authored
test: Unify eslint configs (#210)
1 parent ebd72a0 commit 874a7f6

File tree

4 files changed

+114
-121
lines changed

4 files changed

+114
-121
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/build
12
/cjs
23
/docs
34
/esm

.eslintrc.json

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,117 @@
11
{
2+
"env": {
3+
"jest": true
4+
},
25
"extends": ["eslint:recommended", "standard", "plugin:import/recommended", "prettier"],
6+
"overrides": [
7+
{
8+
"extends": [
9+
"plugin:@typescript-eslint/recommended",
10+
"plugin:@typescript-eslint/recommended-requiring-type-checking",
11+
"plugin:import/typescript"
12+
],
13+
"files": ["*.ts"],
14+
"parserOptions": {
15+
"project": ["./tsconfig.json"],
16+
"sourceType": "module",
17+
"tsconfigRootDir": "."
18+
},
19+
"rules": {
20+
"@typescript-eslint/array-type": [
21+
"error",
22+
{
23+
"default": "array"
24+
}
25+
],
26+
"@typescript-eslint/ban-ts-comment": [
27+
"error",
28+
{
29+
"minimumDescriptionLength": 5,
30+
"ts-expect-error": "allow-with-description",
31+
"ts-ignore": true,
32+
"ts-nocheck": false,
33+
"ts-check": true
34+
}
35+
],
36+
"@typescript-eslint/ban-types": "warn",
37+
"@typescript-eslint/brace-style": [
38+
"error",
39+
"1tbs",
40+
{
41+
"allowSingleLine": true
42+
}
43+
],
44+
"@typescript-eslint/consistent-type-assertions": [
45+
"warn",
46+
{
47+
"assertionStyle": "as"
48+
}
49+
],
50+
"@typescript-eslint/explicit-function-return-type": [
51+
"warn",
52+
{
53+
"allowExpressions": true,
54+
"allowTypedFunctionExpressions": true,
55+
"allowHigherOrderFunctions": true
56+
}
57+
],
58+
"@typescript-eslint/explicit-member-accessibility": [
59+
"error",
60+
{
61+
"accessibility": "no-public"
62+
}
63+
],
64+
"@typescript-eslint/explicit-module-boundary-types": "warn",
65+
"@typescript-eslint/member-delimiter-style": "warn",
66+
"@typescript-eslint/method-signature-style": "error",
67+
"@typescript-eslint/member-ordering": "error",
68+
"@typescript-eslint/no-dynamic-delete": "warn",
69+
"@typescript-eslint/no-empty-interface": "off",
70+
"@typescript-eslint/no-extraneous-class": "error",
71+
"@typescript-eslint/no-extra-parens": ["error", "functions"],
72+
"@typescript-eslint/no-extra-semi": "error",
73+
"@typescript-eslint/no-parameter-properties": "error",
74+
"@typescript-eslint/no-unused-expressions": "error",
75+
"@typescript-eslint/no-unused-vars": [
76+
"warn",
77+
{
78+
"vars": "all",
79+
"args": "none",
80+
"argsIgnorePattern": "^_",
81+
"ignoreRestSiblings": true
82+
}
83+
],
84+
"@typescript-eslint/no-unnecessary-type-constraint": "error",
85+
"@typescript-eslint/no-useless-constructor": "warn",
86+
"@typescript-eslint/object-curly-spacing": ["error", "always"],
87+
"@typescript-eslint/prefer-for-of": "error",
88+
"@typescript-eslint/prefer-optional-chain": "error",
89+
"@typescript-eslint/prefer-ts-expect-error": "error",
90+
"@typescript-eslint/quotes": [
91+
"error",
92+
"single",
93+
{
94+
"allowTemplateLiterals": true
95+
}
96+
],
97+
"@typescript-eslint/require-await": "off",
98+
"@typescript-eslint/semi": "error",
99+
"@typescript-eslint/type-annotation-spacing": "error",
100+
"@typescript-eslint/unified-signatures": "error",
101+
"indent": "off"
102+
}
103+
},
104+
{
105+
"files": ["**.test.ts"],
106+
"rules": {
107+
"@typescript-eslint/no-unsafe-member-access": "off",
108+
"@typescript-eslint/no-unused-expressions": "off",
109+
"@typescript-eslint/no-unsafe-assignment": "off",
110+
"@typescript-eslint/unbound-method": "off",
111+
"no-unused-expressions": "off"
112+
}
113+
}
114+
],
3115
"parser": "@typescript-eslint/parser",
4116
"rules": {
5117
"import/no-named-as-default-member": "off",

.eslintrc.ts.json

Lines changed: 0 additions & 120 deletions
This file was deleted.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"build": "./build.sh",
4242
"docs": "node docs/build.js && docsify serve ./docs",
4343
"benchmark": "yarn build && node --experimental-specifier-resolution=node ./benchmark/run.js",
44-
"lint": "eslint --config ./.eslintrc.ts.json --ext .ts ./example ./src && eslint --ext .js,.mjs ./benchmark ./tests",
44+
"lint": "eslint --ext .js,.mjs,.ts .",
4545
"prepack": "yarn build",
4646
"prepare": "husky install",
4747
"pretty": "prettier '**/*.{md,ts}' --write",

0 commit comments

Comments
 (0)