Skip to content

Commit b262b10

Browse files
authored
build(eslint): Create eslint-config-sentry-sdks (#2807)
* feat: Create packages for sentry eslint config * all packages use eslint * Pin typescript versions * use sentry-sdks instead of @sentry
1 parent 8eb7286 commit b262b10

Some content is hidden

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

52 files changed

+399
-218
lines changed

.eslintignore

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

eslint-plugin-sentry-sdks/package.json

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

package.json

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
"packages/browser",
2424
"packages/core",
2525
"packages/ember",
26+
"packages/eslint-config-sentry-sdks",
27+
"packages/eslint-plugin-sentry-sdks",
2628
"packages/gatsby",
2729
"packages/hub",
2830
"packages/integrations",
@@ -43,26 +45,16 @@
4345
"@types/mocha": "^5.2.0",
4446
"@types/node": "^11.13.7",
4547
"@types/sinon": "^7.0.11",
46-
"@typescript-eslint/eslint-plugin": "^3.9.0",
47-
"@typescript-eslint/parser": "^3.9.0",
4848
"chai": "^4.1.2",
4949
"codecov": "^3.6.5",
5050
"danger": "^7.1.3",
51-
"eslint": "^7.5.0",
52-
"eslint-config-prettier": "^6.11.0",
53-
"eslint-plugin-deprecation": "^1.1.0",
54-
"eslint-plugin-import": "^2.22.0",
55-
"eslint-plugin-jsdoc": "^30.0.3",
56-
"eslint-plugin-sentry-sdks": "file:./eslint-plugin-sentry-sdks",
57-
"eslint-plugin-simple-import-sort": "^5.0.3",
5851
"jest": "^24.7.1",
5952
"karma-browserstack-launcher": "^1.5.1",
6053
"karma-firefox-launcher": "^1.1.0",
6154
"lerna": "3.13.4",
6255
"mocha": "^6.1.4",
6356
"npm-run-all": "^4.1.2",
64-
"prettier": "^1.17.0",
65-
"prettier-check": "^2.0.0",
57+
"prettier": "1.17.0",
6658
"replace-in-file": "^4.0.0",
6759
"rimraf": "^2.6.3",
6860
"sinon": "^7.3.2",

packages/angular/.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module.exports = {
77
parserOptions: {
88
ecmaVersion: 2018,
99
},
10-
extends: ['../../.eslintrc.js'],
10+
extends: ['sentry-sdks'],
1111
ignorePatterns: ['build/**/*', 'dist/**/*', 'esm/**/*', 'examples/**/*', 'scripts/**/*'],
1212
overrides: [
1313
{

packages/angular/package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,12 @@
2626
"tslib": "^1.9.3"
2727
},
2828
"devDependencies": {
29+
"eslint-config-sentry-sdks": "5.20.1",
30+
"eslint": "7.6.0",
2931
"npm-run-all": "^4.1.2",
30-
"prettier": "^1.17.0",
31-
"prettier-check": "^2.0.0",
32+
"prettier": "1.17.0",
3233
"rimraf": "^2.6.3",
33-
"typescript": "^3.5.1"
34+
"typescript": "3.4.5"
3435
},
3536
"scripts": {
3637
"build": "run-p build:es5 build:esm",
@@ -42,7 +43,7 @@
4243
"clean": "rimraf dist coverage build esm",
4344
"link:yarn": "yarn link",
4445
"lint": "run-s lint:prettier lint:eslint",
45-
"lint:prettier": "prettier-check \"{src,test}/**/*.ts\"",
46+
"lint:prettier": "prettier --check \"{src,test}/**/*.ts\"",
4647
"lint:eslint": "eslint . --cache --cache-location '../../eslintcache/' --format stylish",
4748
"fix": "run-s fix:eslint fix:prettier",
4849
"fix:prettier": "prettier --write \"{src,test}/**/*.ts\"",

packages/apm/.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module.exports = {
66
parserOptions: {
77
ecmaVersion: 2018,
88
},
9-
extends: ['../../.eslintrc.js'],
9+
extends: ['sentry-sdks'],
1010
ignorePatterns: ['build/**/*', 'dist/**/*', 'esm/**/*', 'examples/**/*', 'scripts/**/*'],
1111
overrides: [
1212
{

packages/apm/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@
2424
"tslib": "^1.9.3"
2525
},
2626
"devDependencies": {
27+
"eslint-config-sentry-sdks": "5.20.1",
2728
"@types/express": "^4.17.1",
29+
"eslint": "7.6.0",
2830
"jest": "^24.7.1",
2931
"npm-run-all": "^4.1.2",
30-
"prettier": "^1.17.0",
31-
"prettier-check": "^2.0.0",
32+
"prettier": "1.17.0",
3233
"rimraf": "^2.6.3",
3334
"rollup": "^1.10.1",
3435
"rollup-plugin-commonjs": "^9.3.4",
@@ -50,7 +51,7 @@
5051
"clean": "rimraf dist coverage build esm",
5152
"link:yarn": "yarn link",
5253
"lint": "run-s lint:prettier lint:eslint",
53-
"lint:prettier": "prettier-check \"{src,test}/**/*.ts\"",
54+
"lint:prettier": "prettier --check \"{src,test}/**/*.ts\"",
5455
"lint:eslint": "eslint . --cache --cache-location '../../eslintcache/' --format stylish",
5556
"fix": "run-s fix:eslint fix:prettier",
5657
"fix:prettier": "prettier --write \"{src,test}/**/*.ts\"",

packages/apm/src/integrations/tracing.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,9 @@ export class Tracing implements Integration {
506506
if (Tracing._heartbeatCounter >= 3) {
507507
if (Tracing._activeTransaction) {
508508
Tracing._log(
509-
`[Tracing] Transaction: ${SpanStatus.Cancelled} -> Heartbeat safeguard kicked in since content hasn't changed for 3 beats`,
509+
`[Tracing] Transaction: ${
510+
SpanStatus.Cancelled
511+
} -> Heartbeat safeguard kicked in since content hasn't changed for 3 beats`,
510512
);
511513
Tracing._activeTransaction.setStatus(SpanStatus.DeadlineExceeded);
512514
Tracing._activeTransaction.setTag('heartbeat', 'failed');

packages/browser/.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module.exports = {
77
parserOptions: {
88
ecmaVersion: 2018,
99
},
10-
extends: ['../../.eslintrc.js'],
10+
extends: ['sentry-sdks'],
1111
ignorePatterns: ['build/**/*', 'dist/**/*', 'esm/**/*', 'examples/**/*', 'scripts/**/*', 'src/loader.js'],
1212
overrides: [
1313
{

packages/browser/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
"devDependencies": {
2525
"@types/eslint": "^7.2.0",
2626
"@types/md5": "2.1.33",
27+
"eslint-config-sentry-sdks": "5.20.1",
28+
"eslint": "7.6.0",
2729
"btoa": "^1.2.1",
2830
"chai": "^4.1.2",
2931
"chokidar": "^3.0.2",
@@ -40,8 +42,7 @@
4042
"karma-typescript-es6-transform": "^4.0.0",
4143
"node-fetch": "^2.6.0",
4244
"npm-run-all": "^4.1.2",
43-
"prettier": "^1.17.0",
44-
"prettier-check": "^2.0.0",
45+
"prettier": "1.17.0",
4546
"rimraf": "^2.6.3",
4647
"rollup": "^1.10.1",
4748
"rollup-plugin-commonjs": "^9.3.4",
@@ -65,7 +66,7 @@
6566
"clean": "rimraf dist coverage .rpt2_cache build esm",
6667
"link:yarn": "yarn link",
6768
"lint": "run-s lint:prettier lint:eslint",
68-
"lint:prettier": "prettier-check \"{src,test}/**/*.ts\"",
69+
"lint:prettier": "prettier --check \"{src,test}/**/*.ts\"",
6970
"lint:eslint": "eslint . --cache --cache-location '../../eslintcache/' --format stylish",
7071
"fix": "run-s fix:eslint fix:prettier",
7172
"fix:prettier": "prettier --write \"{src,test}/**/*.ts\"",

packages/core/.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module.exports = {
66
parserOptions: {
77
ecmaVersion: 2018,
88
},
9-
extends: ['../../.eslintrc.js'],
9+
extends: ['sentry-sdks'],
1010
ignorePatterns: ['build/**/*', 'dist/**/*', 'esm/**/*', 'examples/**/*', 'scripts/**/*'],
1111
overrides: [
1212
{

packages/core/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@
2323
"tslib": "^1.9.3"
2424
},
2525
"devDependencies": {
26+
"eslint-config-sentry-sdks": "5.20.1",
27+
"eslint": "7.6.0",
2628
"jest": "^24.7.1",
2729
"npm-run-all": "^4.1.2",
28-
"prettier": "^1.17.0",
29-
"prettier-check": "^2.0.0",
30+
"prettier": "1.17.0",
3031
"rimraf": "^2.6.3",
3132
"typescript": "3.4.5"
3233
},
@@ -40,7 +41,7 @@
4041
"clean": "rimraf dist coverage",
4142
"link:yarn": "yarn link",
4243
"lint": "run-s lint:prettier lint:eslint",
43-
"lint:prettier": "prettier-check \"{src,test}/**/*.ts\"",
44+
"lint:prettier": "prettier --check \"{src,test}/**/*.ts\"",
4445
"lint:eslint": "eslint . --cache --cache-location '../../eslintcache/' --format stylish",
4546
"fix": "run-s fix:eslint fix:prettier",
4647
"fix:prettier": "prettier --write \"{src,test}/**/*.ts\"",

packages/ember/.eslintrc.js

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,23 @@ module.exports = {
77
ecmaVersion: 2018,
88
sourceType: 'module',
99
ecmaFeatures: {
10-
legacyDecorators: true
11-
}
10+
legacyDecorators: true,
11+
},
1212
},
13-
plugins: [
14-
'ember'
15-
],
16-
extends: [
17-
'eslint:recommended',
18-
'plugin:ember/recommended'
19-
],
13+
plugins: ['ember'],
14+
extends: ['eslint:recommended', 'plugin:ember/recommended'],
2015
env: {
21-
browser: true
16+
browser: true,
2217
},
2318
globals: {
24-
"QUnit": true
19+
QUnit: true,
2520
},
2621
rules: {},
2722
overrides: [
23+
{
24+
files: ['addon/**/*'],
25+
plugins: ['sentry-sdks'],
26+
},
2827
// node files
2928
{
3029
files: [
@@ -35,23 +34,18 @@ module.exports = {
3534
'testem.js',
3635
'blueprints/*/index.js',
3736
'config/**/*.js',
38-
'tests/dummy/config/**/*.js'
39-
],
40-
excludedFiles: [
41-
'addon/**',
42-
'addon-test-support/**',
43-
'app/**',
44-
'tests/dummy/app/**'
37+
'tests/dummy/config/**/*.js',
4538
],
39+
excludedFiles: ['addon/**', 'addon-test-support/**', 'app/**', 'tests/dummy/app/**'],
4640
parserOptions: {
47-
sourceType: 'script'
41+
sourceType: 'script',
4842
},
4943
env: {
5044
browser: false,
51-
node: true
45+
node: true,
5246
},
5347
plugins: ['node'],
54-
extends: ['plugin:node/recommended']
55-
}
56-
]
48+
extends: ['plugin:node/recommended'],
49+
},
50+
],
5751
};

packages/ember/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"@ember/optional-features": "^1.3.0",
4040
"@glimmer/component": "^1.0.0",
4141
"@glimmer/tracking": "^1.0.0",
42+
"eslint-config-sentry-sdks": "5.20.1",
4243
"@types/ember": "^3.16.0",
4344
"@types/ember-qunit": "^3.4.9",
4445
"@types/ember__test-helpers": "^1.7.0",
@@ -64,13 +65,13 @@
6465
"ember-template-lint": "^2.9.1",
6566
"ember-test-selectors": "^4.1.0",
6667
"ember-try": "^1.4.0",
67-
"eslint": "^7.5.0",
68+
"eslint": "7.6.0",
6869
"eslint-plugin-ember": "^8.6.0",
6970
"eslint-plugin-node": "^11.1.0",
7071
"loader.js": "^4.7.0",
7172
"npm-run-all": "^4.1.5",
7273
"qunit-dom": "^1.2.0",
73-
"typescript": "^3.9.7"
74+
"typescript": "3.4.5"
7475
},
7576
"engines": {
7677
"node": "10.* || >= 12"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!/src/**/*
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 Sentry (https://sentry.io/) and individual contributors.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<p align="center">
2+
<a href="https://sentry.io" target="_blank" align="center">
3+
<img src="https://sentry-brand.storage.googleapis.com/sentry-logo-black.png" width="280">
4+
</a>
5+
<br />
6+
</p>
7+
8+
# Official Sentry SDK eslint config
9+
10+
[![npm version](https://img.shields.io/npm/v/@sentry/integrations.svg)](https://www.npmjs.com/package/@sentry/integrations)
11+
[![npm dm](https://img.shields.io/npm/dm/@sentry/integrations.svg)](https://www.npmjs.com/package/@sentry/integrations)
12+
[![npm dt](https://img.shields.io/npm/dt/@sentry/integrations.svg)](https://www.npmjs.com/package/@sentry/integrations)
13+
[![typedoc](https://img.shields.io/badge/docs-typedoc-blue.svg)](http://getsentry.github.io/sentry-javascript/)
14+
15+
## Links
16+
17+
- [Official SDK Docs](https://docs.sentry.io/quickstart/)
18+
- [TypeDoc](http://getsentry.github.io/sentry-javascript/)
19+
20+
## General
21+
22+
Install with `yarn add -D eslint-config-sentry-sdks`
23+
24+
## Configuration
25+
26+
Use `sentry-sdks` for base rules. Make sure to specify your tsconfig under `parserOptions.project` so that you can
27+
correctly use the typescript rules. This configuration comes with
28+
29+
```json
30+
{
31+
"extends": ["@sentry"],
32+
"overrides": [
33+
{
34+
"files": ["*.ts", "*.tsx", "*.d.ts"],
35+
"parserOptions": {
36+
"project": "./tsconfig.json"
37+
}
38+
}
39+
]
40+
}
41+
```

0 commit comments

Comments
 (0)