Skip to content

Commit

Permalink
refactor(grpc-js): convert from gts to eslint/prettier/tsconfig
Browse files Browse the repository at this point in the history
GTS provides config for ESLint, Prettier and TSConfig; this commit removes GTS, but brings over the configuration details

Fixes grpc#2464
  • Loading branch information
dancrumb authored and sergiitk committed Jun 28, 2023
1 parent 6c78108 commit 7372f61
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 11 deletions.
58 changes: 54 additions & 4 deletions packages/grpc-js/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,11 +1,61 @@
{
"root": true,
"extends": "./node_modules/gts",

"extends": [
"eslint:recommended",
"plugin:node/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
],
"plugins": ["node", "prettier", "@typescript-eslint"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"ignorePatterns": ["**/generated/**", "**/node_modules/**", "**/build/**"],
"rules": {
"node/no-unpublished-import": ["error", {
"node/no-unpublished-import": [
"error",
{
"tryExtensions": [".ts", ".js", ".json", ".node"]
}],
}
],
"@typescript-eslint/no-unused-vars": "off",
"node/no-unpublished-require": "off"
"node/no-unpublished-require": "off",
"prettier/prettier": "error",
"block-scoped-var": "error",
"eqeqeq": "error",
"no-var": "error",
"prefer-const": "error",
"no-case-declarations": "warn",
"no-restricted-properties": [
"error",
{
"object": "describe",
"property": "only"
},
{
"object": "it",
"property": "only"
}
],

"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-warning-comments": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/camelcase": "off",
"node/no-missing-import": "off",
"node/no-empty-function": "off",
"node/no-unsupported-features/es-syntax": "off",
"node/no-missing-require": "off",
"node/shebang": "off",
"no-dupe-class-members": "off",
"require-atomic-updates": "off"
}
}
19 changes: 13 additions & 6 deletions packages/grpc-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,27 @@
"@types/ncp": "^2.0.1",
"@types/pify": "^3.0.2",
"@types/semver": "^7.3.9",
"@typescript-eslint/eslint-plugin": "^5.59.11",
"@typescript-eslint/parser": "^5.59.11",
"@typescript-eslint/typescript-estree": "^5.59.11",
"clang-format": "^1.0.55",
"eslint": "^8.42.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^4.2.1",
"execa": "^2.0.3",
"gts": "^3.1.1",
"gulp": "^4.0.2",
"gulp-mocha": "^6.0.0",
"lodash": "^4.17.4",
"madge": "^5.0.1",
"mocha-jenkins-reporter": "^0.4.1",
"ncp": "^2.0.0",
"pify": "^4.0.1",
"prettier": "^2.8.8",
"rimraf": "^3.0.2",
"semver": "^7.3.5",
"ts-node": "^8.3.0",
"typescript": "^4.8.4"
"ts-node": "^10.9.1",
"typescript": "^5.1.3"
},
"contributors": [
{
Expand All @@ -47,11 +54,11 @@
"clean": "rimraf ./build",
"compile": "tsc -p .",
"format": "clang-format -i -style=\"{Language: JavaScript, BasedOnStyle: Google, ColumnLimit: 80}\" src/*.ts test/*.ts",
"lint": "npm run check",
"lint": "eslint src/*.ts test/*.ts",
"prepare": "npm run generate-types && npm run compile",
"test": "gulp test",
"check": "gts check src/**/*.ts",
"fix": "gts fix src/*.ts",
"check": "npm run lint",
"fix": "eslint --fix src/*.ts test/*.ts",
"pretest": "npm run generate-types && npm run generate-test-types && npm run compile",
"posttest": "npm run check && madge -c ./build/src",
"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",
Expand Down
2 changes: 2 additions & 0 deletions packages/grpc-js/prettier.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ module.exports = {
proseWrap: 'always',
singleQuote: true,
trailingComma: 'es5',
bracketSpacing: true,
arrowParens: 'avoid',
};
14 changes: 13 additions & 1 deletion packages/grpc-js/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
{
"extends": "./node_modules/gts/tsconfig-google.json",
"compilerOptions": {
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"declaration": true,
"forceConsistentCasingInFileNames": true,
"noEmitOnError": true,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"pretty": true,
"sourceMap": true,
"strict": true,
"lib": ["es2017"],
"outDir": "build",
"target": "es2017",
Expand All @@ -12,5 +21,8 @@
"include": [
"src/**/*.ts",
"test/**/*.ts"
],
"exclude": [
"node_modules"
]
}

0 comments on commit 7372f61

Please sign in to comment.