Skip to content

Commit e3522bb

Browse files
committed
refactor(grpc-js): convert from gts to eslint/prettier/tsconfig
GTS provides config for ESLint, Prettier and TSConfig; this commit removes GTS, but brings over the configuration details Fixes #2464
1 parent 1880faf commit e3522bb

File tree

4 files changed

+82
-11
lines changed

4 files changed

+82
-11
lines changed

packages/grpc-js/.eslintrc

Lines changed: 54 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,61 @@
11
{
22
"root": true,
3-
"extends": "./node_modules/gts",
3+
4+
"extends": [
5+
"eslint:recommended",
6+
"plugin:node/recommended",
7+
"plugin:@typescript-eslint/recommended",
8+
"plugin:prettier/recommended"
9+
],
10+
"plugins": ["node", "prettier", "@typescript-eslint"],
11+
"parser": "@typescript-eslint/parser",
12+
"parserOptions": {
13+
"ecmaVersion": 2018,
14+
"sourceType": "module"
15+
},
16+
"ignorePatterns": ["**/generated/**", "**/node_modules/**", "**/build/**"],
417
"rules": {
5-
"node/no-unpublished-import": ["error", {
18+
"node/no-unpublished-import": [
19+
"error",
20+
{
621
"tryExtensions": [".ts", ".js", ".json", ".node"]
7-
}],
22+
}
23+
],
824
"@typescript-eslint/no-unused-vars": "off",
9-
"node/no-unpublished-require": "off"
25+
"node/no-unpublished-require": "off",
26+
"prettier/prettier": "error",
27+
"block-scoped-var": "error",
28+
"eqeqeq": "error",
29+
"no-var": "error",
30+
"prefer-const": "error",
31+
"no-case-declarations": "warn",
32+
"no-restricted-properties": [
33+
"error",
34+
{
35+
"object": "describe",
36+
"property": "only"
37+
},
38+
{
39+
"object": "it",
40+
"property": "only"
41+
}
42+
],
43+
44+
"@typescript-eslint/no-non-null-assertion": "off",
45+
"@typescript-eslint/no-use-before-define": "off",
46+
"@typescript-eslint/no-warning-comments": "off",
47+
"@typescript-eslint/no-empty-function": "off",
48+
"@typescript-eslint/no-var-requires": "off",
49+
"@typescript-eslint/explicit-function-return-type": "off",
50+
"@typescript-eslint/explicit-module-boundary-types": "off",
51+
"@typescript-eslint/ban-types": "off",
52+
"@typescript-eslint/camelcase": "off",
53+
"node/no-missing-import": "off",
54+
"node/no-empty-function": "off",
55+
"node/no-unsupported-features/es-syntax": "off",
56+
"node/no-missing-require": "off",
57+
"node/shebang": "off",
58+
"no-dupe-class-members": "off",
59+
"require-atomic-updates": "off"
1060
}
1161
}

packages/grpc-js/package.json

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,27 @@
2222
"@types/ncp": "^2.0.1",
2323
"@types/pify": "^3.0.2",
2424
"@types/semver": "^7.3.9",
25+
"@typescript-eslint/eslint-plugin": "^5.59.11",
26+
"@typescript-eslint/parser": "^5.59.11",
27+
"@typescript-eslint/typescript-estree": "^5.59.11",
2528
"clang-format": "^1.0.55",
29+
"eslint": "^8.42.0",
30+
"eslint-config-prettier": "^8.8.0",
31+
"eslint-plugin-node": "^11.1.0",
32+
"eslint-plugin-prettier": "^4.2.1",
2633
"execa": "^2.0.3",
27-
"gts": "^3.1.1",
2834
"gulp": "^4.0.2",
2935
"gulp-mocha": "^6.0.0",
3036
"lodash": "^4.17.4",
3137
"madge": "^5.0.1",
3238
"mocha-jenkins-reporter": "^0.4.1",
3339
"ncp": "^2.0.0",
3440
"pify": "^4.0.1",
41+
"prettier": "^2.8.8",
3542
"rimraf": "^3.0.2",
3643
"semver": "^7.3.5",
37-
"ts-node": "^8.3.0",
38-
"typescript": "^4.8.4"
44+
"ts-node": "^10.9.1",
45+
"typescript": "^5.1.3"
3946
},
4047
"contributors": [
4148
{
@@ -47,11 +54,11 @@
4754
"clean": "rimraf ./build",
4855
"compile": "tsc -p .",
4956
"format": "clang-format -i -style=\"{Language: JavaScript, BasedOnStyle: Google, ColumnLimit: 80}\" src/*.ts test/*.ts",
50-
"lint": "npm run check",
57+
"lint": "eslint src/*.ts test/*.ts",
5158
"prepare": "npm run generate-types && npm run compile",
5259
"test": "gulp test",
53-
"check": "gts check src/**/*.ts",
54-
"fix": "gts fix src/*.ts",
60+
"check": "npm run lint",
61+
"fix": "eslint --fix src/*.ts test/*.ts",
5562
"pretest": "npm run generate-types && npm run generate-test-types && npm run compile",
5663
"posttest": "npm run check && madge -c ./build/src",
5764
"generate-types": "proto-loader-gen-types --keepCase --longs String --enums String --defaults --oneofs --includeComments --includeDirs proto/ --include-dirs test/fixtures/ -O src/generated/ --grpcLib ../index channelz.proto",

packages/grpc-js/prettier.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@ module.exports = {
22
proseWrap: 'always',
33
singleQuote: true,
44
trailingComma: 'es5',
5+
bracketSpacing: true,
6+
arrowParens: 'avoid',
57
};

packages/grpc-js/tsconfig.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
{
2-
"extends": "./node_modules/gts/tsconfig-google.json",
32
"compilerOptions": {
3+
"allowUnreachableCode": false,
4+
"allowUnusedLabels": false,
5+
"declaration": true,
6+
"forceConsistentCasingInFileNames": true,
7+
"noEmitOnError": true,
8+
"noFallthroughCasesInSwitch": true,
9+
"noImplicitReturns": true,
10+
"pretty": true,
11+
"sourceMap": true,
12+
"strict": true,
413
"lib": ["es2017"],
514
"outDir": "build",
615
"target": "es2017",
@@ -12,5 +21,8 @@
1221
"include": [
1322
"src/**/*.ts",
1423
"test/**/*.ts"
24+
],
25+
"exclude": [
26+
"node_modules"
1527
]
1628
}

0 commit comments

Comments
 (0)