diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000000..7ce9ab6060 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,10 @@ +{ + "parserOptions": { + "ecmaVersion": 2018, + "sourceType": "module" + }, + + "env": { + "es6": true + } +} diff --git a/.eslintrc.yml b/.eslintrc.yml deleted file mode 100644 index 9ea8d6e19b..0000000000 --- a/.eslintrc.yml +++ /dev/null @@ -1,33 +0,0 @@ ---- -extends: - - 'eslint:recommended' - - 'plugin:node/recommended' - - 'prettier' -env: - mocha: true -plugins: - - node - - prettier - - promise -rules: - require-atomic-updates: warn - prettier/prettier: error - block-scoped-var: error - eqeqeq: error - no-warning-comments: warn - no-console: off - node/no-missing-require: off - node/no-unpublished-require: off - prefer-const: error - no-var: error - prefer-arrow-callback: error - no-throw-literal: error - require-await: error - promise/prefer-await-to-then: error - promise/no-nesting: error - prefer-destructuring: error - prefer-template: error - func-style: - - error - - expression - - allowArrowFunctions: true diff --git a/.estlintrc.json b/.estlintrc.json new file mode 100644 index 0000000000..e7bb5620b6 --- /dev/null +++ b/.estlintrc.json @@ -0,0 +1,4 @@ +{ + "extends": "./node_modules/gts" + } + \ No newline at end of file diff --git a/.prettierignore b/.prettierignore index 9340ad9b86..a4ac7b3751 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,6 +1,5 @@ **/node_modules -**/coverage -test/fixtures +**/.coverage build/ docs/ protos/ diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index df6eac0744..0000000000 --- a/.prettierrc +++ /dev/null @@ -1,8 +0,0 @@ ---- -bracketSpacing: false -printWidth: 80 -semi: true -singleQuote: true -tabWidth: 2 -trailingComma: es5 -useTabs: false diff --git a/.prettierrc.js b/.prettierrc.js new file mode 100644 index 0000000000..08cba3775b --- /dev/null +++ b/.prettierrc.js @@ -0,0 +1,17 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/appengine/typescript/index.ts b/appengine/typescript/index.ts index 5e4c9e84d4..9ed9ae3ee8 100644 --- a/appengine/typescript/index.ts +++ b/appengine/typescript/index.ts @@ -11,6 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + import express = require('express'); const PORT = Number(process.env.PORT) || 8080; diff --git a/appengine/typescript/package.json b/appengine/typescript/package.json index 9d8b684de6..fbee4aace7 100644 --- a/appengine/typescript/package.json +++ b/appengine/typescript/package.json @@ -27,6 +27,7 @@ "wait-port": "^0.2.7", "@types/express": "^4.16.0", "chai": "^4.2.0", - "tslint": "^6.0.0" + "tslint": "^6.0.0", + "typescript": "^3.8.3" } } diff --git a/appengine/websockets/test/index.test.js b/appengine/websockets/test/index.test.js index aa3f64e7e7..e3ea631644 100644 --- a/appengine/websockets/test/index.test.js +++ b/appengine/websockets/test/index.test.js @@ -14,8 +14,6 @@ 'use strict'; -/* eslint node/no-extraneous-require: "off" */ - const assert = require('assert'); const puppeteer = require('puppeteer'); /* global document */ diff --git a/package.json b/package.json index f598aa9640..431c1229a8 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,9 @@ "eslint-plugin-node": "^11.0.0", "eslint-plugin-prettier": "^3.1.0", "eslint-plugin-promise": "^4.1.1", + "gts": "^2.0.0", "prettier": "^2.0.0", - "requestretry": "^4.0.0" + "requestretry": "^4.0.0", + "typescript": "^3.8.3" } }