Skip to content

Commit 4d7492b

Browse files
committed
setup eslint with tslint-to-eslint-config
1 parent 50f73bd commit 4d7492b

File tree

7 files changed

+1140
-48
lines changed

7 files changed

+1140
-48
lines changed

.eslintrc.js

Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
/*
2+
👋 Hi! This file was autogenerated by tslint-to-eslint-config.
3+
https://github.com/typescript-eslint/tslint-to-eslint-config
4+
5+
It represents the closest reasonable ESLint configuration to this
6+
project's original TSLint configuration.
7+
8+
We recommend eventually switching this configuration to extend from
9+
the recommended rulesets in typescript-eslint.
10+
https://github.com/typescript-eslint/tslint-to-eslint-config/blob/master/docs/FAQs.md
11+
12+
Happy linting! 💖
13+
*/
14+
module.exports = {
15+
"env": {
16+
"node": true
17+
},
18+
"extends": [
19+
"plugin:@typescript-eslint/recommended",
20+
"plugin:@typescript-eslint/recommended-requiring-type-checking",
21+
"prettier",
22+
"prettier/@typescript-eslint"
23+
],
24+
"parser": "@typescript-eslint/parser",
25+
"parserOptions": {
26+
"project": "tsconfig.json",
27+
"sourceType": "module"
28+
},
29+
"plugins": [
30+
"@typescript-eslint",
31+
"import",
32+
"jsdoc",
33+
"prefer-arrow"
34+
],
35+
"rules": {
36+
"@typescript-eslint/adjacent-overload-signatures": "error",
37+
"@typescript-eslint/array-type": [
38+
"error",
39+
{
40+
"default": "array"
41+
}
42+
],
43+
"@typescript-eslint/ban-types": [
44+
"error",
45+
{
46+
"types": {
47+
"Object": {
48+
"message": "Avoid using the `Object` type. Did you mean `object`?"
49+
},
50+
"Function": {
51+
"message": "Avoid using the `Function` type. Prefer a specific function type, like `() => void`."
52+
},
53+
"Boolean": {
54+
"message": "Avoid using the `Boolean` type. Did you mean `boolean`?"
55+
},
56+
"Number": {
57+
"message": "Avoid using the `Number` type. Did you mean `number`?"
58+
},
59+
"String": {
60+
"message": "Avoid using the `String` type. Did you mean `string`?"
61+
},
62+
"Symbol": {
63+
"message": "Avoid using the `Symbol` type. Did you mean `symbol`?"
64+
}
65+
}
66+
}
67+
],
68+
"@typescript-eslint/consistent-type-assertions": "error",
69+
"@typescript-eslint/dot-notation": "off",
70+
"@typescript-eslint/member-delimiter-style": [
71+
"off",
72+
{
73+
"multiline": {
74+
"delimiter": "none",
75+
"requireLast": true
76+
},
77+
"singleline": {
78+
"delimiter": "semi",
79+
"requireLast": false
80+
}
81+
}
82+
],
83+
"@typescript-eslint/naming-convention": "off",
84+
"@typescript-eslint/no-empty-function": "error",
85+
"@typescript-eslint/no-empty-interface": "error",
86+
"@typescript-eslint/no-explicit-any": "off",
87+
"@typescript-eslint/no-misused-new": "error",
88+
"@typescript-eslint/no-namespace": "error",
89+
"@typescript-eslint/no-parameter-properties": "off",
90+
"@typescript-eslint/no-unused-expressions": "error",
91+
"@typescript-eslint/no-use-before-define": "off",
92+
"@typescript-eslint/no-var-requires": "error",
93+
"@typescript-eslint/prefer-for-of": "off",
94+
"@typescript-eslint/prefer-function-type": "error",
95+
"@typescript-eslint/prefer-namespace-keyword": "error",
96+
"@typescript-eslint/semi": [
97+
"off",
98+
null
99+
],
100+
"@typescript-eslint/triple-slash-reference": [
101+
"error",
102+
{
103+
"path": "always",
104+
"types": "prefer-import",
105+
"lib": "always"
106+
}
107+
],
108+
"@typescript-eslint/unified-signatures": "error",
109+
"arrow-parens": [
110+
"off",
111+
"always"
112+
],
113+
"brace-style": [
114+
"off",
115+
"off"
116+
],
117+
"comma-dangle": "off",
118+
"complexity": "off",
119+
"constructor-super": "error",
120+
"eqeqeq": [
121+
"error",
122+
"smart"
123+
],
124+
"guard-for-in": "error",
125+
"id-blacklist": [
126+
"error",
127+
"any",
128+
"Number",
129+
"number",
130+
"String",
131+
"string",
132+
"Boolean",
133+
"boolean",
134+
"Undefined",
135+
"undefined"
136+
],
137+
"id-match": "error",
138+
"import/no-default-export": "error",
139+
"import/order": "off",
140+
"jsdoc/check-alignment": "error",
141+
"jsdoc/check-indentation": "error",
142+
"jsdoc/newline-after-description": "error",
143+
"max-classes-per-file": [
144+
"error",
145+
1
146+
],
147+
"max-len": "off",
148+
"new-parens": "error",
149+
"no-bitwise": "error",
150+
"no-caller": "error",
151+
"no-cond-assign": "error",
152+
"no-console": "off",
153+
"no-debugger": "error",
154+
"no-empty": "error",
155+
"no-eval": "error",
156+
"no-fallthrough": "off",
157+
"no-invalid-this": "off",
158+
"no-new-wrappers": "error",
159+
"no-shadow": [
160+
"error",
161+
{
162+
"hoist": "all"
163+
}
164+
],
165+
"no-throw-literal": "error",
166+
"no-trailing-spaces": "off",
167+
"no-undef-init": "error",
168+
"no-underscore-dangle": "error",
169+
"no-unsafe-finally": "error",
170+
"no-unused-labels": "error",
171+
"no-var": "error",
172+
"object-shorthand": "error",
173+
"one-var": [
174+
"error",
175+
"never"
176+
],
177+
"prefer-arrow/prefer-arrow-functions": "error",
178+
"prefer-const": "error",
179+
"quote-props": "off",
180+
"radix": "error",
181+
"spaced-comment": [
182+
"error",
183+
"always",
184+
{
185+
"markers": [
186+
"/"
187+
]
188+
}
189+
],
190+
"use-isnan": "error",
191+
"valid-typeof": "off"
192+
}
193+
};

package.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
},
2525
"lint-staged": {
2626
"*.ts": [
27-
"tslint -c tslint.json -p tsconfig.json",
27+
"eslint",
2828
"prettier --no-semi --trailing-comma=all --list-different"
2929
]
3030
},
@@ -55,6 +55,13 @@
5555
"@types/rimraf": "^2.0.2",
5656
"@types/semver": "^5.5.0",
5757
"@types/tmp": "^0.0.34",
58+
"@typescript-eslint/eslint-plugin": "^4.1.0",
59+
"@typescript-eslint/parser": "^4.1.0",
60+
"eslint": "^7.8.1",
61+
"eslint-config-prettier": "^6.11.0",
62+
"eslint-plugin-import": "^2.22.0",
63+
"eslint-plugin-jsdoc": "^30.4.0",
64+
"eslint-plugin-prefer-arrow": "^1.2.2",
5865
"husky": "^1.3.1",
5966
"jest": "^24.5.0",
6067
"lint-staged": "^8.1.5",
@@ -63,7 +70,7 @@
6370
"randomstring": "^1.1.5",
6471
"ts-jest": "^24.0.0",
6572
"ts-node": "8.0.3",
66-
"tslint": "^5.14.0",
73+
"tslint": "^6.1.3",
6774
"typescript": "^3.6.3"
6875
},
6976
"dependencies": {

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const packageNames = argv._
2626

2727
console.log(
2828
chalk.bold("patch-package"),
29-
// tslint:disable-next-line:no-var-requires
29+
// eslint-disable-next-line @typescript-eslint/no-var-requires
3030
require(join(__dirname, "../package.json")).version,
3131
)
3232

src/patch/apply.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export const executeEffects = (
7171
}
7272

7373
function isExecutable(fileMode: number) {
74-
// tslint:disable-next-line:no-bitwise
74+
// eslint-disable-next-line no-bitwise
7575
return (fileMode & 0b001_000_000) > 0
7676
}
7777

src/patch/parse.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// tslint:disable
1+
/* eslint-disable */
22

33
import { parsePatchFile } from "../patch/parse"
44

src/patch/parse.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ export function interpretParsedPatchFile(files: FileDeets[]): ParsedPatchFile {
394394
}
395395

396396
function parseFileMode(mode: string): FileMode {
397-
// tslint:disable-next-line:no-bitwise
397+
// eslint-disable-next-line no-bitwise
398398
const parsedMode = parseInt(mode, 8) & 0o777
399399
if (
400400
parsedMode !== NON_EXECUTABLE_FILE_MODE &&

0 commit comments

Comments
 (0)