Skip to content

Commit

Permalink
fix: setting up eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
rezakrimi committed Jun 22, 2020
1 parent aac2e96 commit 783e2d2
Show file tree
Hide file tree
Showing 47 changed files with 166 additions and 129 deletions.
49 changes: 49 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
module.exports = {
plugins: [
"@typescript-eslint",
"header"
],
extends: [
"./node_modules/gts",
],
parser: "@typescript-eslint/parser",
parserOptions: {
"project": "./tsconfig.json"
},
rules: {
"@typescript-eslint/no-this-alias": "off",
"eqeqeq": "off",
"prefer-rest-params": "off",
"@typescript-eslint/naming-convention": [
"error",
{
"selector": "memberLike",
"modifiers": ["private", "protected"],
"format": ["camelCase"],
"leadingUnderscore": "require"
}
],
"@typescript-eslint/no-inferrable-types": ["error", { ignoreProperties: true }],
"arrow-parens": ["error", "as-needed"],
"prettier/prettier": ["error", { "singleQuote": true, "arrowParens": "avoid" }],
"node/no-deprecated-api": ["warn"],
"header/header": [2, "block", [{
pattern: / \* Copyright The 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,
template:
`\n * Copyright The 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 `
}]]
},
overrides: [
{
"files": ["test/**/*.ts"],
"rules": {
"no-empty": "off",
"@typescript-eslint/ban-ts-ignore": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-var-requires": "off"
}
}
]
};
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,16 @@
"devDependencies": {
"@commitlint/cli": "8.3.5",
"@commitlint/config-conventional": "8.3.4",
"@typescript-eslint/eslint-plugin": "3.3.0",
"@typescript-eslint/parser": "3.3.0",
"eslint": "7.2.0",
"eslint-config-airbnb-base": "14.2.0",
"eslint-plugin-header": "3.0.0",
"eslint-plugin-import": "2.21.2",
"gts": "2.0.2",
"husky": "4.2.5",
"lerna": "3.22.1",
"lerna-changelog": "1.0.1",
"tslint": "5.20.1",
"typescript": "3.9.5"
},
"husky": {
Expand Down
1 change: 1 addition & 0 deletions packages/opentelemetry-test-utils/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
7 changes: 7 additions & 0 deletions packages/opentelemetry-test-utils/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
"env": {
"mocha": true,
"node": true
},
...require('../../eslint.config.js')
}
4 changes: 2 additions & 2 deletions packages/opentelemetry-test-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"description": "Test utilities.",
"main": "build/testUtils.js",
"scripts": {
"lint": "gts check",
"lint:fix": "gts fix",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"compile": "tsc -p .",
"precompile": "tsc --version",
"prepare": "npm run compile"
Expand Down
4 changes: 0 additions & 4 deletions packages/opentelemetry-test-utils/tslint.json

This file was deleted.

1 change: 1 addition & 0 deletions plugins/node/opentelemetry-plugin-dns/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
7 changes: 7 additions & 0 deletions plugins/node/opentelemetry-plugin-dns/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
"env": {
"mocha": true,
"node": true
},
...require('../../../eslint.config.js')
}
4 changes: 2 additions & 2 deletions plugins/node/opentelemetry-plugin-dns/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'",
"tdd": "npm run test -- --watch-extensions ts --watch",
"clean": "rimraf build/*",
"lint": "gts check",
"lint:fix": "gts fix",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
"precompile": "tsc --version",
"prepare": "npm run compile",
Expand Down
4 changes: 0 additions & 4 deletions plugins/node/opentelemetry-plugin-dns/tslint.json

This file was deleted.

1 change: 1 addition & 0 deletions plugins/node/opentelemetry-plugin-express/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
7 changes: 7 additions & 0 deletions plugins/node/opentelemetry-plugin-express/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
"env": {
"mocha": true,
"node": true
},
...require('../../../eslint.config.js')
}
4 changes: 2 additions & 2 deletions plugins/node/opentelemetry-plugin-express/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
"tdd": "yarn test -- --watch-extensions ts --watch",
"clean": "rimraf build/*",
"lint": "gts check",
"lint:fix": "gts fix",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"precompile": "tsc --version",
"version:update": "node ../../../scripts/version-update.js",
"compile": "npm run version:update && tsc -p .",
Expand Down
4 changes: 0 additions & 4 deletions plugins/node/opentelemetry-plugin-express/tslint.json

This file was deleted.

1 change: 1 addition & 0 deletions plugins/node/opentelemetry-plugin-ioredis/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
7 changes: 7 additions & 0 deletions plugins/node/opentelemetry-plugin-ioredis/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
"env": {
"mocha": true,
"node": true
},
...require('../../../eslint.config.js')
}
4 changes: 2 additions & 2 deletions plugins/node/opentelemetry-plugin-ioredis/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"test:local": "cross-env RUN_REDIS_TESTS_LOCAL=true npm run test",
"tdd": "npm run test -- --watch-extensions ts --watch",
"clean": "rimraf build/*",
"lint": "gts check",
"lint:fix": "gts fix",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"precompile": "tsc --version",
"version:update": "node ../../../scripts/version-update.js",
"compile": "npm run version:update && tsc -p .",
Expand Down
4 changes: 0 additions & 4 deletions plugins/node/opentelemetry-plugin-ioredis/tslint.json

This file was deleted.

1 change: 1 addition & 0 deletions plugins/node/opentelemetry-plugin-mongodb/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
7 changes: 7 additions & 0 deletions plugins/node/opentelemetry-plugin-mongodb/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
"env": {
"mocha": true,
"node": true
},
...require('../../../eslint.config.js')
}
4 changes: 2 additions & 2 deletions plugins/node/opentelemetry-plugin-mongodb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
"tdd": "npm run test -- --watch-extensions ts --watch",
"clean": "rimraf build/*",
"lint": "gts check",
"lint:fix": "gts fix",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"precompile": "tsc --version",
"version:update": "node ../../../scripts/version-update.js",
"compile": "npm run version:update && tsc -p .",
Expand Down
4 changes: 0 additions & 4 deletions plugins/node/opentelemetry-plugin-mongodb/tslint.json

This file was deleted.

1 change: 1 addition & 0 deletions plugins/node/opentelemetry-plugin-mysql/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
7 changes: 7 additions & 0 deletions plugins/node/opentelemetry-plugin-mysql/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
"env": {
"mocha": true,
"node": true
},
...require('../../../eslint.config.js')
}
4 changes: 2 additions & 2 deletions plugins/node/opentelemetry-plugin-mysql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
"tdd": "npm run test -- --watch-extensions ts --watch",
"clean": "rimraf build/*",
"lint": "gts check",
"lint:fix": "gts fix",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"precompile": "tsc --version",
"version:update": "node ../../../scripts/version-update.js",
"compile": "npm run version:update && tsc -p .",
Expand Down
4 changes: 0 additions & 4 deletions plugins/node/opentelemetry-plugin-mysql/tslint.json

This file was deleted.

1 change: 1 addition & 0 deletions plugins/node/opentelemetry-plugin-pg-pool/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
7 changes: 7 additions & 0 deletions plugins/node/opentelemetry-plugin-pg-pool/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
"env": {
"mocha": true,
"node": true
},
...require('../../../eslint.config.js')
}
4 changes: 2 additions & 2 deletions plugins/node/opentelemetry-plugin-pg-pool/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"tdd": "npm run test -- --watch-extensions ts --watch",
"clean": "rimraf build/*",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../",
"lint": "gts check",
"lint:fix": "gts fix",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"precompile": "tsc --version",
"version:update": "node ../../../scripts/version-update.js",
"compile": "npm run version:update && tsc -p .",
Expand Down
4 changes: 0 additions & 4 deletions plugins/node/opentelemetry-plugin-pg-pool/tslint.json

This file was deleted.

1 change: 1 addition & 0 deletions plugins/node/opentelemetry-plugin-pg/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
7 changes: 7 additions & 0 deletions plugins/node/opentelemetry-plugin-pg/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
"env": {
"mocha": true,
"node": true
},
...require('../../../eslint.config.js')
}
4 changes: 2 additions & 2 deletions plugins/node/opentelemetry-plugin-pg/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"tdd": "npm run test -- --watch-extensions ts --watch",
"clean": "rimraf build/*",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../../",
"lint": "gts check",
"lint:fix": "gts fix",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"precompile": "tsc --version",
"version:update": "node ../../../scripts/version-update.js",
"compile": "npm run version:update && tsc -p .",
Expand Down
4 changes: 0 additions & 4 deletions plugins/node/opentelemetry-plugin-pg/tslint.json

This file was deleted.

1 change: 1 addition & 0 deletions plugins/node/opentelemetry-plugin-redis/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
7 changes: 7 additions & 0 deletions plugins/node/opentelemetry-plugin-redis/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
"env": {
"mocha": true,
"node": true
},
...require('../../../eslint.config.js')
}
4 changes: 2 additions & 2 deletions plugins/node/opentelemetry-plugin-redis/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"test:local": "cross-env RUN_REDIS_TESTS_LOCAL=true npm run test",
"tdd": "npm run test -- --watch-extensions ts --watch",
"clean": "rimraf build/*",
"lint": "gts check",
"lint:fix": "gts fix",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"precompile": "tsc --version",
"version:update": "node ../../../scripts/version-update.js",
"compile": "npm run version:update && tsc -p .",
Expand Down
4 changes: 0 additions & 4 deletions plugins/node/opentelemetry-plugin-redis/tslint.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
9 changes: 9 additions & 0 deletions plugins/web/opentelemetry-plugin-document-load/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
"env": {
"mocha": true,
"commonjs": true,
"browser": true,
"jquery": true
},
...require('../../../eslint.config.js')
}
4 changes: 2 additions & 2 deletions plugins/web/opentelemetry-plugin-document-load/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"repository": "open-telemetry/opentelemetry-js",
"scripts": {
"clean": "rimraf build/*",
"lint": "gts check",
"lint:fix": "gts fix",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
"precompile": "tsc --version",
"version:update": "node ../../../scripts/version-update.js",
Expand Down
4 changes: 0 additions & 4 deletions plugins/web/opentelemetry-plugin-document-load/tslint.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
"env": {
"mocha": true,
"commonjs": true,
"browser": true,
"jquery": true
},
...require('../../../eslint.config.js')
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js",
"scripts": {
"lint": "gts check",
"lint:fix": "gts fix",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"clean": "rimraf build/*",
"codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
"precompile": "tsc --version",
Expand Down
4 changes: 0 additions & 4 deletions plugins/web/opentelemetry-plugin-user-interaction/tslint.json

This file was deleted.

Loading

0 comments on commit 783e2d2

Please sign in to comment.