Skip to content

Commit a46212f

Browse files
committed
eslint config
1 parent 90aa85c commit a46212f

File tree

4 files changed

+45
-28
lines changed

4 files changed

+45
-28
lines changed
Lines changed: 39 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,56 @@
11
// eslint-disable-next-line no-undef
2+
const illegalGlobals = ['localStorage', 'name']
3+
const testGlobals = ['describe', 'it', 'context']
4+
25
module.exports = {
36
env: {
47
browser: true,
58
es2020: true,
69
},
710
extends: [
8-
"eslint:recommended",
9-
"plugin:@typescript-eslint/recommended",
10-
"prettier",
11+
'eslint:recommended',
12+
'plugin:@typescript-eslint/recommended',
13+
'prettier',
14+
],
15+
overrides: [
16+
{
17+
files: ['*.test.*'],
18+
rules: {
19+
'no-restricted-globals': ['warn', ...illegalGlobals],
20+
},
21+
},
1122
],
12-
parser: "@typescript-eslint/parser",
23+
parser: '@typescript-eslint/parser',
1324
parserOptions: {
1425
ecmaVersion: 11,
15-
sourceType: "module",
16-
project: "./tsconfig.json",
26+
sourceType: 'module',
27+
project: './tsconfig.json',
1728
},
18-
plugins: ["@typescript-eslint", "only-warn"],
29+
plugins: ['@typescript-eslint', 'only-warn'],
1930
rules: {
20-
"no-restricted-globals": ["warn", "localStorage"],
21-
"no-restricted-properties": [
22-
"warn",
31+
'no-restricted-globals': ['warn', ...illegalGlobals, ...testGlobals],
32+
'no-restricted-properties': [
33+
'warn',
2334
{
24-
object: "window",
25-
property: "localStorage",
35+
object: 'window',
36+
property: 'localStorage',
2637
},
2738
],
28-
"no-console": ["warn", { allow: ["warn", "error"] }],
39+
'no-console': ['warn', { allow: ['warn', 'error', 'info'] }],
2940

30-
"@typescript-eslint/no-extra-semi": "off",
31-
"@typescript-eslint/no-var-requires": "off",
32-
"@typescript-eslint/no-floating-promises": "warn",
33-
"@typescript-eslint/no-misused-promises": "warn",
34-
"@typescript-eslint/no-unused-vars": "off",
35-
"@typescript-eslint/explicit-module-boundary-types": "off",
36-
"@typescript-eslint/no-explicit-any": "off",
37-
"@typescript-eslint/no-empty-function": "off",
38-
"@typescript-eslint/no-non-null-assertion": "off",
41+
'@typescript-eslint/no-extra-semi': 'off',
42+
'@typescript-eslint/no-var-requires': 'off',
43+
'@typescript-eslint/no-floating-promises': 'warn',
44+
'@typescript-eslint/no-misused-promises': [
45+
'warn',
46+
{
47+
checksVoidReturn: false,
48+
},
49+
],
50+
'@typescript-eslint/no-unused-vars': 'off',
51+
'@typescript-eslint/explicit-module-boundary-types': 'off',
52+
'@typescript-eslint/no-explicit-any': 'off',
53+
'@typescript-eslint/no-empty-function': 'off',
54+
'@typescript-eslint/no-non-null-assertion': 'off',
3955
},
40-
};
56+
}

.yalc/@whitecolor/eslint-config/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@whitecolor/eslint-config",
3-
"version": "1.0.0+e899210a",
3+
"version": "1.0.0+b87bbab0",
44
"main": "index.js",
55
"files": [
66
"index.js"
@@ -11,7 +11,7 @@
1111
},
1212
"scripts": {
1313
"test": "eslint test",
14-
"prepublish": "pnpm test"
14+
"prepublishOnly": "pnpm test"
1515
},
1616
"dependencies": {
1717
"@typescript-eslint/eslint-plugin": "^3.7.1",
@@ -20,5 +20,6 @@
2020
"eslint-config-prettier": "^6.11.0",
2121
"eslint-plugin-only-warn": "^1.0.2",
2222
"typescript-eslint-language-service": "^3.0.0"
23-
}
23+
},
24+
"yalcSig": "b87bbab05aab95b9f7ad2a15fcf6f9fa"
2425
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
e899210a850f3694531a7113cbe29d33
1+
b87bbab05aab95b9f7ad2a15fcf6f9fa

yalc.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"version": "v1",
33
"packages": {
44
"@whitecolor/eslint-config": {
5-
"signature": "e899210a850f3694531a7113cbe29d33",
5+
"signature": "b87bbab05aab95b9f7ad2a15fcf6f9fa",
66
"file": true
77
}
88
}

0 commit comments

Comments
 (0)