Skip to content

Commit 8973e46

Browse files
committed
chore: using eslint instead of tslint
1 parent d526464 commit 8973e46

File tree

7 files changed

+419
-185
lines changed

7 files changed

+419
-185
lines changed

Diff for: .eslintignore

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# from .gitignore
2+
node_modules/
3+
coverage/
4+
dist/
5+
.idea
6+
.cache
7+
*.tgz
8+
.DS_Store
9+
esm
10+
esnext
11+
12+
# custom ignore pattern
13+
*.html

Diff for: .eslintrc.json

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"plugins": ["@typescript-eslint"],
3+
"parser": "@typescript-eslint/parser",
4+
"extends": [
5+
"plugin:react/recommended",
6+
"plugin:@typescript-eslint/recommended",
7+
"prettier"
8+
],
9+
"globals": {
10+
"Atomics": "readonly",
11+
"SharedArrayBuffer": "readonly"
12+
},
13+
"rules": {
14+
"@typescript-eslint/explicit-member-accessibility": [
15+
"error",
16+
{
17+
"accessibility": "no-public",
18+
"overrides": {
19+
"parameterProperties": "explicit"
20+
}
21+
}
22+
],
23+
"@typescript-eslint/explicit-function-return-type": "off",
24+
"@typescript-eslint/no-non-null-assertion": "off",
25+
"@typescript-eslint/no-parameter-properties": "off",
26+
"@typescript-eslint/no-use-before-define": ["error", { "functions": false, "classes": false }],
27+
"@typescript-eslint/no-explicit-any": "off",
28+
"@typescript-eslint/no-var-requires": "off",
29+
"@typescript-eslint/ban-ts-comment": "off",
30+
"no-console": ["error", { "allow": ["warn", "error"] }]
31+
},
32+
"settings": {
33+
"react": {
34+
"version": "detect"
35+
}
36+
},
37+
"env": {
38+
"browser": true,
39+
"es6": true
40+
},
41+
"parserOptions": {
42+
"project": "./tsconfig.json",
43+
"extraFileExtensions": [".html"],
44+
"ecmaFeatures": {
45+
"jsx": true
46+
},
47+
"ecmaVersion": 2018,
48+
"sourceType": "module"
49+
}
50+
}

Diff for: package.json

+12-10
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@
1212
"build": "yarn build:esm && yarn build:cjs",
1313
"build:esm": "rm -rf dist/esm && tsc -p src/tsconfig.json --module es2015 --target es5 --outDir dist/esm",
1414
"build:cjs": "rm -rf dist/cjs && tsc -p src/tsconfig.json --module commonjs --target es5 --outDir dist/cjs",
15-
"lint": "tslint -c tslint.json -p src/tsconfig.json",
1615
"start": "webpack-dev-server --config ./tools/webpack.config.js --progress --color",
17-
"test": "NODE_ENV=test jest --no-cache --ci"
16+
"test": "NODE_ENV=test jest --no-cache --ci",
17+
"lint": "yarn lint:eslint && yarn lint:tsc",
18+
"lint:eslint": "eslint . --ext .ts,.tsx --fix --max-warnings 0",
19+
"lint:tsc": "tsc -p ./tsconfig.json --noEmit"
1820
},
1921
"repository": {
2022
"type": "git",
@@ -28,8 +30,13 @@
2830
"@types/sinon": "^9.0.0",
2931
"@types/sinon-chai": "^3.2.3",
3032
"@types/webpack": "^4.41.0",
33+
"@typescript-eslint/eslint-plugin": "^4.19.0",
34+
"@typescript-eslint/parser": "^4.19.0",
3135
"browser-resolve": "^2.0.0",
3236
"codecov": "^3.6.1",
37+
"eslint": "^7.22.0",
38+
"eslint-config-prettier": "^8.1.0",
39+
"eslint-plugin-react": "^7.23.1",
3340
"fork-ts-checker-webpack-plugin": "^6.0.0",
3441
"happypack": "^5.0.1",
3542
"html-webpack-plugin": "^5.0.0",
@@ -46,18 +53,13 @@
4653
"standard": "^16.0.0",
4754
"ts-jest": "^26.0.0",
4855
"ts-loader": "^8.0.0",
49-
"tslint": "^5.20.1",
50-
"tslint-config-prettier": "^1.18.0",
51-
"tslint-eslint-rules": "^5.4.0",
52-
"tslint-react": "^4.1.0",
53-
"tslint-sonarts": "^1.9.0",
54-
"typescript": "^3.7.3",
56+
"typescript": "^4.2.0",
5557
"webpack": "^5.0.0",
5658
"webpack-cli": "^4.0.0",
5759
"webpack-dev-server": "^3.9.0"
5860
},
5961
"dependencies": {
60-
"tslib": "^2.0.0",
62+
"tslib": "^2.1.0",
6163
"use-constant": "^1.0.0"
6264
},
6365
"lint-staged": {
@@ -67,7 +69,7 @@
6769
],
6870
"*.@(ts|tsx)": [
6971
"prettier --write",
70-
"tslint -c tslint.json --fix"
72+
"yarn lint:eslint"
7173
]
7274
},
7375
"prettier": {

Diff for: src/__test__/find.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ReactTestInstance } from 'react-test-renderer'
22

3-
export function find(node: ReactTestInstance, type: string) {
3+
export function find(node: ReactTestInstance, type: string): ReactTestInstance {
44
return node.find((node) => node.type === type)
55
}

Diff for: src/__test__/use-event-callback.spec.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ describe('useEventCallback specs', () => {
8787
const factory = (event$: Observable<React.MouseEvent<HTMLButtonElement>>, state$: Observable<number>) =>
8888
event$.pipe(
8989
withLatestFrom(state$),
90-
map(([_, state]) => {
90+
map(([, state]) => {
9191
return state + value
9292
}),
9393
delay(timeToDelay),
@@ -130,7 +130,7 @@ describe('useEventCallback specs', () => {
130130
): Observable<number> =>
131131
event$.pipe(
132132
combineLatest(inputs$),
133-
map(([_, [count]]) => {
133+
map(([, [count]]) => {
134134
return value + count
135135
}),
136136
delay(timeToDelay),

Diff for: tslint.json

-63
This file was deleted.

0 commit comments

Comments
 (0)