Skip to content

Commit 141c033

Browse files
committed
add eslint and new tsconfig
1 parent 96af31b commit 141c033

File tree

11 files changed

+1313
-526
lines changed

11 files changed

+1313
-526
lines changed

.eslintrc

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,3 @@
11
{
2-
"extends": [
3-
"airbnb-base/legacy"
4-
],
5-
"rules": {
6-
"comma-dangle": [2, "never"],
7-
"consistent-return": 0,
8-
"eqeqeq": 0,
9-
"func-names": 0,
10-
"guard-for-in": 0,
11-
"global-require": 0,
12-
"one-var": [2, "never"],
13-
"padded-blocks": 0,
14-
"vars-on-top": 0,
15-
"no-console": 0,
16-
"no-param-reassign": 0,
17-
"no-use-before-define": 0
18-
}
2+
"extends": ["@whitecolor/eslint-config"]
193
}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.DS_Store
22
/node_modules
3+
/lib
34
*.log
45
.ts-node
56
.tmp

.vscode/tasks.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@
77
"label": "tsc",
88
"command": "node",
99
// "isShellCommand": true,
10-
"args": ["./node_modules/typescript/lib/tsc.js", "-w", "-p", "."],
10+
"args": [
11+
"./node_modules/typescript/lib/tsc.js",
12+
"-w",
13+
"-p",
14+
"./tsconfig.build.json"
15+
],
1116
"presentation": {
1217
"echo": true,
1318
"reveal": "silent",
@@ -17,6 +22,9 @@
1722
"clear": false,
1823
"revealProblems": "always"
1924
},
25+
"runOptions": {
26+
"runOn": "folderOpen"
27+
},
2028
//"showOutput": "silent",
2129
"isBackground": true,
2230
"problemMatcher": "$tsc-watch"
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// eslint-disable-next-line no-undef
2+
module.exports = {
3+
env: {
4+
browser: true,
5+
es2020: true,
6+
},
7+
extends: [
8+
"eslint:recommended",
9+
"plugin:@typescript-eslint/recommended",
10+
"prettier",
11+
],
12+
parser: "@typescript-eslint/parser",
13+
parserOptions: {
14+
ecmaVersion: 11,
15+
sourceType: "module",
16+
project: "./tsconfig.json",
17+
},
18+
plugins: ["@typescript-eslint", "only-warn"],
19+
rules: {
20+
"no-restricted-globals": ["warn", "localStorage"],
21+
"no-restricted-properties": [
22+
"warn",
23+
{
24+
object: "window",
25+
property: "localStorage",
26+
},
27+
],
28+
"no-console": ["warn", { allow: ["warn", "error"] }],
29+
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",
39+
},
40+
};
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "@whitecolor/eslint-config",
3+
"version": "1.0.0+e899210a",
4+
"main": "index.js",
5+
"files": [
6+
"index.js"
7+
],
8+
"prettier": {
9+
"semi": false,
10+
"singleQuote": true
11+
},
12+
"scripts": {
13+
"test": "eslint test",
14+
"prepublish": "pnpm test"
15+
},
16+
"dependencies": {
17+
"@typescript-eslint/eslint-plugin": "^3.7.1",
18+
"@typescript-eslint/parser": "^3.7.1",
19+
"eslint": "^7.6.0",
20+
"eslint-config-prettier": "^6.11.0",
21+
"eslint-plugin-only-warn": "^1.0.2",
22+
"typescript-eslint-language-service": "^3.0.0"
23+
}
24+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
e899210a850f3694531a7113cbe29d33

package.json

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@
1515
},
1616
"license": "MIT",
1717
"bin": {
18-
"ts-node-dev": "./bin/ts-node-dev",
19-
"tsnd": "./bin/ts-node-dev"
18+
"ts-node-dev": "./lib/bin.js",
19+
"tsnd": "./lib/bin.js"
2020
},
2121
"main": "./lib",
2222
"files": [
23-
"bin",
2423
"icons",
2524
"lib"
2625
],
@@ -33,10 +32,10 @@
3332
"node": ">=0.8.0"
3433
},
3534
"scripts": {
36-
"ts-node-dev": "node ./bin/ts-node-dev",
35+
"ts-node-dev": "node ./lib/bin",
3736
"tsnd": "yarn ts-node-dev",
38-
"test": "ts-node -T test/index.ts",
39-
"test-dev": "ts-node-dev -T --respawn --deps --watch lib test/index.ts --output",
37+
"test": "ts-node -T node_modules/mocha/bin/mocha test/*.test.ts",
38+
"test-dev": "yarn ts-node-dev -T --respawn --deps --watch lib node_modules/mocha/bin/mocha test/*.test.ts --output",
4039
"test-docker": "docker-compose up",
4140
"ci": "yarn test",
4241
"ci-local": "docker run --name travis-debug -dit quay.io/travisci/ci-nodejs",
@@ -56,18 +55,24 @@
5655
"tsconfig": "^7.0.0"
5756
},
5857
"devDependencies": {
58+
"@types/chai": "^4.2.12",
59+
"@types/chokidar": "^2.1.3",
5960
"@types/fs-extra": "^9.0.1",
6061
"@types/minimist": "^1.2.0",
61-
"@types/node": "^8.0.4",
62+
"@types/mkdirp": "^1.0.1",
63+
"@types/mocha": "github:whitecolor/mocha-types",
64+
"@types/node": "^14.6.0",
65+
"@types/rimraf": "^3.0.0",
6266
"@types/tape": "^4.13.0",
6367
"@types/touch": "^3.1.1",
6468
"@types/ts-nameof": "^4.2.1",
69+
"@whitecolor/eslint-config": "file:.yalc/@whitecolor/eslint-config",
70+
"chai": "^4.2.0",
6571
"coffee-script": "^1.8.0",
66-
"eslint": "^2.0.0",
67-
"eslint-config-airbnb-base": "^3.0.1",
68-
"eslint-plugin-import": "^1.8.1",
72+
"eslint": "^7.7.0",
6973
"esm": "^3.2.22",
7074
"fs-extra": "^9.0.1",
75+
"mocha": "^8.1.1",
7176
"tap": "^5.2.0",
7277
"tape": "^5.0.1",
7378
"touch": "^1.0.0",

tsconfig.build.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "./tsconfig",
3+
"compilerOptions": {
4+
"outDir": "./lib",
5+
"noEmit": false
6+
},
7+
"include": ["src/**/*"]
8+
}

tsconfig.json

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,13 @@
33
"target": "es5",
44
"lib": ["es2015"],
55
"module": "commonjs",
6-
"declaration": true,
7-
"sourceMap": true,
8-
"strict": true,
9-
"noFallthroughCasesInSwitch": true,
10-
"experimentalDecorators": true,
11-
"emitDecoratorMetadata": true,
12-
"outDir": "lib",
13-
"allowJs": false,
14-
"newLine": "LF",
15-
"plugins": [
16-
{
17-
"name": "typescript-tslint-plugin",
18-
"alwaysShowRuleFailuresAsWarnings": true
19-
}
20-
]
21-
},
22-
"formatCodeOptions": {
23-
"indentSize": 2,
24-
"tabSize": 2
25-
},
26-
"exclude": ["**/node_modules/*"]
6+
"declaration": false,
7+
"skipLibCheck": true,
8+
"sourceMap": false,
9+
"strict": true,
10+
"noEmit": true,
11+
"resolveJsonModule": true,
12+
"esModuleInterop": true,
13+
"newLine": "LF",
14+
}
2715
}

yalc.lock

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"version": "v1",
3+
"packages": {
4+
"@whitecolor/eslint-config": {
5+
"signature": "e899210a850f3694531a7113cbe29d33",
6+
"file": true
7+
}
8+
}
9+
}

0 commit comments

Comments
 (0)