diff --git a/packages/grpc-js/.eslintrc b/packages/grpc-js/.eslintrc index 64585682..2f6bfd62 100644 --- a/packages/grpc-js/.eslintrc +++ b/packages/grpc-js/.eslintrc @@ -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" } } diff --git a/packages/grpc-js/package.json b/packages/grpc-js/package.json index dd341ef0..c068b0e9 100644 --- a/packages/grpc-js/package.json +++ b/packages/grpc-js/package.json @@ -22,9 +22,15 @@ "@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", @@ -32,10 +38,11 @@ "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": [ { @@ -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", diff --git a/packages/grpc-js/prettier.config.js b/packages/grpc-js/prettier.config.js index 92747c8c..ecd1f485 100644 --- a/packages/grpc-js/prettier.config.js +++ b/packages/grpc-js/prettier.config.js @@ -2,4 +2,6 @@ module.exports = { proseWrap: 'always', singleQuote: true, trailingComma: 'es5', + bracketSpacing: true, + arrowParens: 'avoid', }; diff --git a/packages/grpc-js/tsconfig.json b/packages/grpc-js/tsconfig.json index 310b633c..d678782c 100644 --- a/packages/grpc-js/tsconfig.json +++ b/packages/grpc-js/tsconfig.json @@ -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", @@ -12,5 +21,8 @@ "include": [ "src/**/*.ts", "test/**/*.ts" + ], + "exclude": [ + "node_modules" ] }