8000 Upgrade from TSLint to ESLint · ethereumjs/ethereumjs-config@f61dc1e · GitHub
[go: up one dir, main page]

Skip 8000 to content
This repository was archived by the owner on Oct 30, 2024. It is now read-only.

Commit f61dc1e

Browse files
committed
Upgrade from TSLint to ESLint
1 parent ecef835 commit f61dc1e

File tree

18 files changed

+117
-101
lines changed

18 files changed

+117
-101
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
package-lock.json
3+
packages/*/**/node_modules
4+
packages/*/**/package-lock.json
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
module.exports = {
2+
parser: "@typescript-eslint/parser",
3+
plugins: ["@typescript-eslint"],
4+
env: {
5+
es6: true,
6+
node: true
7+
},
8+
ignorePatterns: ["node_modules/**/*", "**/node_modules/**/*", "dist/**/*"],
9+
extends: [
10+
"typestrict",
11+
"eslint:recommended",
12+
"plugin:@typescript-eslint/eslint-recommended",
13+
"plugin:@typescript-eslint/recommended",
14+
"plugin:@typescript-eslint/recommended-requiring-type-checking",
15+
"plugin:prettier/recommended"
16+
],
17+
rules: {
18+
"no-console": "warn",
19+
"no-debugger": "error",
20+
"prefer-const": "error",
21+
"no-var": "error",
22+
"@typescript-eslint/no-use-before-define": "error",
23+
"@typescript-eslint/interface-name-prefix": [
24+
"error",
25+
{
26+
prefixWithI: "never"
27+
}
28+
]
29+
},
30+
parserOptions: {
31+
sourceType: "module"
32+
}
33+
};
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# @ethereumjs/config-eslint
2+
3+
Common linting configuration for `EthereumJS` libraries utilizing:
4+
5+
- [ESLint](https://eslint.org/)
6+
- [TypeScript ESLint](https://github.com/typescript-eslint/typescript-eslint)
7+
- [TypeStrict](https://github.com/krzkaczor/TypeStrict)
8+
- [Prettier](https://prettier.io/docs/en/integrating-with-linters.html)
9+
10+
Exposed CLI commands:
11+
12+
- `ethereumjs-config-lint`
13+
- `ethereumjs-config-lint-fix`
14+
15+
## Usage
16+
17+
Add `.eslintrc.js`:
18+
19+
```json
20+
{
21+
"extends": "@ethereumjs/config-lint"
22+
}
23+
```
24+
25+
Use CLI commands above in your `package.json`:
26+
27+
```json
28+
"scripts": {
29+
"lint": "ethereumjs-config-lint",
30+
"lint:fix": "ethereumjs-config-lint-fix",
31+
}
32+
```
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
set -o xtrace
3+
exec npm run format:fix && exec eslint --fix --config ./eslintrc.js . --ext .js,.jsx,.ts,.tsx && exec npm run tsc
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
set -o xtrace
3+
exec npm run format && exec eslint --config ./eslintrc.js . --ext .js,.jsx,.ts,.tsx && exec npm run tsc
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"name": "@ethereumjs/config-lint",
3+
"version": "1.1.1",
4+
"main": ".eslintrc.js",
5+
"license": "MIT",
6+
"repository": "git@github.com:ethereumjs/ethereumjs-config.git",
7+
"author": "Krzysztof Kaczor <chris@kaczor.io>",
8+
"files": [
9+
".eslintrc.js",
10+
"cli"
11+
],
12+
"bin": {
13+
"ethereumjs-config-lint": "./cli/eslint.sh",
14+
"ethereumjs-config-lint-fix": "./cli/eslint-fix.sh"
15+
},
16+
"publishConfig": {
17+
"access": "public"
18+
},
19+
"peerDependencies": {
20+
"typescript": "3.x",
21+
"eslint": "6.x"
22+
},
23+
"devDependencies": {
24+
"@typescript-eslint/parser": "^2.26.0",
25+
"@typescript-eslint/eslint-plugin": "^2.26.0",
26+
"eslint-config-typestrict": "^1.0.0",
27+
"eslint-config-prettier": "^6.10.0",
28+
"eslint-plugin-prettier": "^3.1.2",
29+
"eslint-plugin-sonarjs": "^0.5.0"
30+
}
31+
}

packages/ethereumjs-config-nyc/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Add `.nycrc`:
2121
}
2222
```
2323

24-
Use CLI commands above in `package.json`:
24+
Use CLI commands above in your `package.json`:
2525

2626
```json
2727
"scripts": {

packages/ethereumjs-config-prettier/README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Exposed CLI commands:
1616
Add `prettier.config.js`:
1717

1818
```javascript
19-
module.exports = require('@ethereumjs/config-prettier')
19+
module.exports = require("@ethereumjs/config-prettier");
2020
```
2121

2222
Add `.prettierignore`:
@@ -29,14 +29,11 @@ dist
2929
.nyc_output
3030
```
3131

32-
Use CLI commands above in `package.json`:
32+
Use CLI commands above in your `package.json`:
3333

3434
```json
3535
"scripts": {
3636
"format": "ethereumjs-config-format",
37-
"format-fix": "ethereumjs-config-format-fix"
37+
"format:fix": "ethereumjs-config-format-fix"
3838
}
3939
```
40-
41-
42-

packages/ethereumjs-config-prettier/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,8 @@
1515
},
1616
"publishConfig": {
1717
"access": "public"
18+
},
19+
"peerDependencies": {
20+
"prettier": "1.x"
1821
}
1922
}

packages/ethereumjs-config-tsc/README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,11 @@ Add `tsconfig.prod.json`:
3434
}
3535
```
3636

37-
Use CLI commands above in `package.json`:
37+
Use CLI commands above in your `package.json`:
3838

3939
```json
4040
"scripts": {
4141
"tsc": "ethereumjs-config-tsc",
4242
"build": "ethereumjs-config-build"
4343
}
4444
```
45-
46-
47-

0 commit comments

Comments
 (0)
0