Skip to content

Commit f07c975

Browse files
committed
chore: add prettier-eslint.
1 parent 3320fe3 commit f07c975

File tree

6 files changed

+68
-20
lines changed

6 files changed

+68
-20
lines changed

.eslintrc.json

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"parser": "@typescript-eslint/parser",
3+
"parserOptions": {
4+
"project": "./tsconfig.eslint.json"
5+
},
6+
"env": {
7+
"node": true,
8+
"es6": true
9+
},
10+
"plugins": ["@typescript-eslint"],
11+
"extends": [
12+
"eslint:recommended",
13+
"plugin:@typescript-eslint/eslint-recommended",
14+
"plugin:@typescript-eslint/recommended",
15+
"prettier",
16+
"prettier/@typescript-eslint"
17+
],
18+
"rules": {
19+
"@typescript-eslint/explicit-function-return-type": "off",
20+
"@typescript-eslint/no-explicit-any": "off",
21+
22+
// non-null assertions compromise the type safety somewhat, but many
23+
// our types are still imprecisely defined and we don't use noImplicitAny
24+
// anyway, so for the time being assertions are allowed
25+
"@typescript-eslint/no-non-null-assertion": "warn",
26+
"@typescript-eslint/no-empty-function": "warn",
27+
"@typescript-eslint/no-inferrable-types": "off",
28+
"@typescript-eslint/no-var-requires": "off",
29+
"@typescript-eslint/no-use-before-define": "off",
30+
"@typescript-eslint/no-unused-vars": "error",
31+
"no-prototype-builtins": "off",
32+
"require-atomic-updates": "off",
33+
"no-buffer-constructor": "error"
34+
},
35+
"overrides": [
36+
{
37+
"files": ["*.ts"],
38+
"rules": {
39+
"id-blacklist": ["error", "exports"] // in TS, use "export" instead of Node's "module.exports"
40+
}
41+
}
42+
]
43+
}

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ npm-debug.log
33
# output
44
dist
55
.DS_Store
6+
.eslintcache
67
*.log
78
/package-lock.json

.prettierrc.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"arrowParens": "always",
3+
"trailingComma": "all",
4+
"singleQuote": true
5+
}

package.json

+9-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
"parse-nodejs-lockfile": "./bin/index.js"
77
},
88
"scripts": {
9-
"test": "npm run lint && npm run unit-test",
9+
"test": "npm run unit-test",
1010
"unit-test": "tap -Rspec ./test/lib/*.test.[tj]s --timeout=300",
11-
"lint": "tslint -p tsconfig.json",
11+
"lint": "eslint --color --cache '{lib,test}/**/*.{js,ts}' && prettier --check '{lib,test}/**/*.{js,ts}'",
12+
"format": "prettier --write '{lib,test}/**/*.{js,ts}'",
1213
"build": "tsc",
1314
"build-watch": "tsc -w",
1415
"prepare": "npm run build"
@@ -42,8 +43,13 @@
4243
"@types/lodash": "^4.14.136",
4344
"@types/node": "^6.14.7",
4445
"@types/uuid": "^3.4.4",
46+
"@typescript-eslint/eslint-plugin": "^2.29.0",
47+
"@typescript-eslint/parser": "^2.29.0",
48+
"eslint": "6.8.0",
49+
"eslint-config-prettier": "^6.11.0",
50+
"eslint-plugin-prettier": "^3.1.3",
51+
"prettier": "^1.19.1",
4552
"tap": "^12.6.1",
46-
"tslint": "5.11.0",
4753
"typescript": "3.8.3"
4854
}
4955
}

tsconfig.eslint.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "/dev/null",
5+
},
6+
"include": [
7+
"./lib/**/*",
8+
"./test/**/*"
9+
]
10+
}

tslint.json

-17
This file was deleted.

0 commit comments

Comments
 (0)