Skip to content

Commit 05e7bb9

Browse files
fix(lint): move tslint to eslint (#892)
1 parent de61fe7 commit 05e7bb9

File tree

178 files changed

+598
-580
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

178 files changed

+598
-580
lines changed

.circleci/config.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,13 @@ jobs:
124124
- checkout
125125
- run:
126126
name: Install minimal doc and lint modules globally
127-
command: npm i -g tslint lerna typedoc linkinator typescript tslint-consistent-codestyle tslint-microsoft-contrib
127+
command: npm i -g eslint eslint-plugin-node @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-plugin-header eslint-plugin-import eslint-plugin-prettier prettier lerna typedoc linkinator typescript
128128
- run:
129-
name: Install gts version 1.1.0 globally
130-
command: npm i -g gts@1.1.0
129+
name: Install gts version 2.0.0 globally
130+
command: npm i -g gts@2.0.0
131131
- run:
132132
name: Symlink global modules into all lerna packages
133-
command: lerna exec 'npm link tslint lerna typedoc linkinator typescript gts tslint-consistent-codestyle tslint-microsoft-contrib'
133+
command: lerna exec 'npm link eslint gts eslint-plugin-node @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-plugin-header eslint-plugin-import eslint-plugin-prettier prettier lerna typedoc linkinator typescript'
134134
- run:
135135
name: Check code style and linting
136136
command: npm run lint

eslint.config.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
module.exports = {
2+
plugins: [
3+
"@typescript-eslint",
4+
"header"
5+
],
6+
extends: [
7+
"./node_modules/gts",
8+
],
9+
parser: "@typescript-eslint/parser",
10+
parserOptions: {
11+
"project": "./tsconfig.json"
12+
},
13+
rules: {
14+
"@typescript-eslint/no-this-alias": "off",
15+
"eqeqeq": "off",
16+
"prefer-rest-params": "off",
17+
"@typescript-eslint/naming-convention": [
18+
"error",
19+
{
20+
"selector": "memberLike",
21+
"modifiers": ["private", "protected"],
22+
"format": ["camelCase"],
23+
"leadingUnderscore": "require"
24+
}
25+
],
26+
"@typescript-eslint/no-inferrable-types": ["error", { ignoreProperties: true }],
27+
"arrow-parens": ["error", "as-needed"],
28+
"prettier/prettier": ["error", { "singleQuote": true, "arrowParens": "avoid" }],
29+
"node/no-deprecated-api": ["warn"],
30+
"header/header": [2, "block", [{
31+
pattern: / \* Copyright \d{4}, OpenTelemetry Authors[\r\n]+ \*[\r\n]+ \* Licensed under the Apache License, Version 2\.0 \(the \"License\"\);[\r\n]+ \* you may not use this file except in compliance with the License\.[\r\n]+ \* You may obtain a copy of the License at[\r\n]+ \*[\r\n]+ \* https:\/\/www\.apache\.org\/licenses\/LICENSE-2\.0[\r\n]+ \*[\r\n]+ \* Unless required by applicable law or agreed to in writing, software[\r\n]+ \* distributed under the License is distributed on an \"AS IS\" BASIS,[\r\n]+ \* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.[\r\n]+ \* See the License for the specific language governing permissions and[\r\n]+ \* limitations under the License\./gm,
32+
template:
33+
`\n * Copyright ${new Date().getFullYear()}, OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n `
34+
}]]
35+
},
36+
overrides: [
37+
{
38+
"files": ["test/**/*.ts"],
39+
"rules": {
40+
"no-empty": "off",
41+
"@typescript-eslint/ban-ts-ignore": "off",
42+
"@typescript-eslint/no-empty-function": "off",
43+
"@typescript-eslint/no-explicit-any": "off",
44+
"@typescript-eslint/no-unused-vars": "off",
45+
"@typescript-eslint/no-var-requires": "off"
46+
}
47+
}
48+
]
49+
};

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,14 @@
4545
"eslint": "^6.8.0",
4646
"eslint-config-airbnb-base": "^14.0.0",
4747
"eslint-plugin-import": "^2.19.1",
48+
"eslint-plugin-header": "^3.0.0",
49+
"@typescript-eslint/eslint-plugin": "^2.23.0",
50+
"@typescript-eslint/parser": "^2.23.0",
4851
"gh-pages": "^2.1.1",
49-
"gts": "^1.1.0",
52+
"gts": "^2.0.0",
5053
"husky": "^3.0.9",
5154
"lerna": "^3.17.0",
5255
"lerna-changelog": "^1.0.0",
53-
"tslint": "^5.0.0",
5456
"typescript": "^3.7.2"
5557
},
5658
"husky": {
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
build
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module.exports = {
2+
"env": {
3+
"mocha": true,
4+
"commonjs": true,
5+
"shared-node-browser": true
6+
},
7+
...require('../../eslint.config.js')
8+
}

packages/opentelemetry-api/package.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
1212
"codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
1313
"build": "npm run compile",
14-
"lint": "gts check",
15-
"lint:fix": "gts fix",
14+
"lint": "eslint . --ext .ts",
15+
"lint:fix": "eslint . --ext .ts --fix",
1616
"precompile": "tsc --version",
1717
"version:update": "node ../../scripts/version-update.js",
1818
"compile": "npm run version:update && tsc -p .",
@@ -54,7 +54,7 @@
5454
"@types/node": "^12.6.8",
5555
"@types/webpack-env": "1.13.9",
5656
"codecov": "^3.6.1",
57-
"gts": "^1.1.0",
57+
"gts": "^2.0.0",
5858
"istanbul-instrumenter-loader": "^3.0.1",
5959
"karma": "^5.0.5",
6060
"karma-chrome-launcher": "^3.1.0",
@@ -67,8 +67,6 @@
6767
"nyc": "^15.0.0",
6868
"ts-loader": "^6.0.4",
6969
"ts-mocha": "^7.0.0",
70-
"tslint-consistent-codestyle": "^1.16.0",
71-
"tslint-microsoft-contrib": "^6.2.0",
7270
"typedoc": "^0.15.0",
7371
"typescript": "3.7.2",
7472
"webpack": "^4.35.2"

packages/opentelemetry-api/src/metrics/Metric.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,14 @@ export interface UnboundMetric<T> extends Metric {
108108

109109
export interface Counter extends UnboundMetric<BoundCounter> {
110110
/**
111-
* Adds the given value to the current value. Values cannot be negative.
111+
* Adds the given value to the current value. Values cannot be negative.
112112
*/
113113
add(value: number, labels?: Labels): void;
114114
}
115115

116116
export interface Measure extends UnboundMetric<BoundMeasure> {
117117
/**
118-
* Records the given value to this measure.
118+
* Records the given value to this measure.
119119
*/
120120
record(value: number, labels?: Labels): void;
121121

packages/opentelemetry-api/src/trace/instrumentation/Plugin.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import { Logger } from '../../common/Logger';
1818
import { TracerProvider } from '../tracer_provider';
1919

2020
/** Interface Plugin to apply patch. */
21-
// tslint:disable-next-line:no-any
2221
export interface Plugin<T = any> {
2322
/**
2423
* Contains all supported versions.

packages/opentelemetry-api/src/version.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
/*!
2-
* Copyright 2019, OpenTelemetry Authors
1+
/*
2+
* Copyright 2020, OpenTelemetry Authors
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

packages/opentelemetry-api/tslint.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)