Add typescript linter
Change-Id: Ife1027586de8c42873e1b85799b03063c2476a68
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
"eslint-plugin-jsdoc": "^19.2.0",
|
||||
"eslint-plugin-prettier": "^3.1.3",
|
||||
"fried-twinkie": "^0.2.2",
|
||||
"gts": "^2.0.2",
|
||||
"polymer-cli": "^1.9.11",
|
||||
"prettier": "2.0.5",
|
||||
"typescript": "3.8.2"
|
||||
|
@@ -1,2 +1,3 @@
|
||||
**/node_modules
|
||||
**/rollup.config.js
|
||||
node_modules_licenses
|
||||
|
@@ -150,7 +150,6 @@ module.exports = {
|
||||
}
|
||||
}],
|
||||
"import/named": 2,
|
||||
"import/no-unresolved": 2,
|
||||
"import/no-self-import": 2,
|
||||
// The no-cycle rule is slow, because it doesn't cache dependencies.
|
||||
// Disable it.
|
||||
@@ -174,6 +173,26 @@ module.exports = {
|
||||
"security": "readonly",
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
// .js-only rules
|
||||
"files": ["**/*.js"],
|
||||
"rules": {
|
||||
// The rule is required for .js files only, because typescript compiler
|
||||
// always checks import.
|
||||
"import/no-unresolved": 2,
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": ["**/*.ts"],
|
||||
"extends": [require.resolve("gts/.eslintrc.json")],
|
||||
"rules": {
|
||||
// The following rules is required to match internal google rules
|
||||
"@typescript-eslint/restrict-plus-operands": "error"
|
||||
},
|
||||
"parserOptions": {
|
||||
"project": path.resolve(__dirname, "./tsconfig.json"),
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": ["*.html", "test.js", "test-infra.js", "template_test.js"],
|
||||
"rules": {
|
||||
|
27
polygerrit-ui/app/.prettierrc.js
Normal file
27
polygerrit-ui/app/.prettierrc.js
Normal file
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright (C) 2020 The Android Open Source Project
|
||||
*
|
||||
* 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 = {
|
||||
"overrides": [
|
||||
{
|
||||
"files": ["**/*.ts"],
|
||||
"options": {
|
||||
...require('gts/.prettierrc.json')
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
@@ -112,11 +112,14 @@ eslint(
|
||||
data = [
|
||||
# The .eslintrc-bazel.js extends the .eslintrc.js config, pass it as a dependency
|
||||
".eslintrc.js",
|
||||
".prettierrc.js",
|
||||
".eslint-ts-resolver.js",
|
||||
"tsconfig.json",
|
||||
],
|
||||
extensions = [
|
||||
".html",
|
||||
".js",
|
||||
".ts",
|
||||
],
|
||||
ignore = ".eslintignore",
|
||||
plugins = [
|
||||
@@ -125,6 +128,7 @@ eslint(
|
||||
"@npm//eslint-plugin-import",
|
||||
"@npm//eslint-plugin-jsdoc",
|
||||
"@npm//eslint-plugin-prettier",
|
||||
"@npm//gts",
|
||||
],
|
||||
)
|
||||
|
||||
|
@@ -29,4 +29,3 @@ export const BaseUrlBehavior = {
|
||||
// temporary assign global variables.
|
||||
window.Gerrit = window.Gerrit || {};
|
||||
window.Gerrit.BaseUrlBehavior = BaseUrlBehavior;
|
||||
|
||||
|
Reference in New Issue
Block a user