Skip to content

build(eslint): Create eslint-config-sentry-sdks #2807

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .eslintignore

This file was deleted.

11 changes: 0 additions & 11 deletions eslint-plugin-sentry-sdks/package.json

This file was deleted.

14 changes: 3 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
"packages/browser",
"packages/core",
"packages/ember",
"packages/eslint-config-sentry-sdks",
"packages/eslint-plugin-sentry-sdks",
"packages/gatsby",
"packages/hub",
"packages/integrations",
Expand All @@ -43,26 +45,16 @@
"@types/mocha": "^5.2.0",
"@types/node": "^11.13.7",
"@types/sinon": "^7.0.11",
"@typescript-eslint/eslint-plugin": "^3.9.0",
"@typescript-eslint/parser": "^3.9.0",
"chai": "^4.1.2",
"codecov": "^3.6.5",
"danger": "^7.1.3",
"eslint": "^7.5.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-deprecation": "^1.1.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jsdoc": "^30.0.3",
"eslint-plugin-sentry-sdks": "file:./eslint-plugin-sentry-sdks",
"eslint-plugin-simple-import-sort": "^5.0.3",
"jest": "^24.7.1",
"karma-browserstack-launcher": "^1.5.1",
"karma-firefox-launcher": "^1.1.0",
"lerna": "3.13.4",
"mocha": "^6.1.4",
"npm-run-all": "^4.1.2",
"prettier": "^1.17.0",
"prettier-check": "^2.0.0",
"prettier": "1.17.0",
"replace-in-file": "^4.0.0",
"rimraf": "^2.6.3",
"sinon": "^7.3.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/angular/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = {
parserOptions: {
ecmaVersion: 2018,
},
extends: ['../../.eslintrc.js'],
extends: ['sentry-sdks'],
ignorePatterns: ['build/**/*', 'dist/**/*', 'esm/**/*', 'examples/**/*', 'scripts/**/*'],
overrides: [
{
Expand Down
9 changes: 5 additions & 4 deletions packages/angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@
"tslib": "^1.9.3"
},
"devDependencies": {
"eslint-config-sentry-sdks": "5.20.1",
"eslint": "7.6.0",
"npm-run-all": "^4.1.2",
"prettier": "^1.17.0",
"prettier-check": "^2.0.0",
"prettier": "1.17.0",
"rimraf": "^2.6.3",
"typescript": "^3.5.1"
"typescript": "3.4.5"
},
"scripts": {
"build": "run-p build:es5 build:esm",
Expand All @@ -42,7 +43,7 @@
"clean": "rimraf dist coverage build esm",
"link:yarn": "yarn link",
"lint": "run-s lint:prettier lint:eslint",
"lint:prettier": "prettier-check \"{src,test}/**/*.ts\"",
"lint:prettier": "prettier --check \"{src,test}/**/*.ts\"",
"lint:eslint": "eslint . --cache --cache-location '../../eslintcache/' --format stylish",
"fix": "run-s fix:eslint fix:prettier",
"fix:prettier": "prettier --write \"{src,test}/**/*.ts\"",
Expand Down
2 changes: 1 addition & 1 deletion packages/apm/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
parserOptions: {
ecmaVersion: 2018,
},
extends: ['../../.eslintrc.js'],
extends: ['sentry-sdks'],
ignorePatterns: ['build/**/*', 'dist/**/*', 'esm/**/*', 'examples/**/*', 'scripts/**/*'],
overrides: [
{
Expand Down
7 changes: 4 additions & 3 deletions packages/apm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@
"tslib": "^1.9.3"
},
"devDependencies": {
"eslint-config-sentry-sdks": "5.20.1",
"@types/express": "^4.17.1",
"eslint": "7.6.0",
"jest": "^24.7.1",
"npm-run-all": "^4.1.2",
"prettier": "^1.17.0",
"prettier-check": "^2.0.0",
"prettier": "1.17.0",
"rimraf": "^2.6.3",
"rollup": "^1.10.1",
"rollup-plugin-commonjs": "^9.3.4",
Expand All @@ -50,7 +51,7 @@
"clean": "rimraf dist coverage build esm",
"link:yarn": "yarn link",
"lint": "run-s lint:prettier lint:eslint",
"lint:prettier": "prettier-check \"{src,test}/**/*.ts\"",
"lint:prettier": "prettier --check \"{src,test}/**/*.ts\"",
"lint:eslint": "eslint . --cache --cache-location '../../eslintcache/' --format stylish",
"fix": "run-s fix:eslint fix:prettier",
"fix:prettier": "prettier --write \"{src,test}/**/*.ts\"",
Expand Down
4 changes: 3 additions & 1 deletion packages/apm/src/integrations/tracing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,9 @@ export class Tracing implements Integration {
if (Tracing._heartbeatCounter >= 3) {
if (Tracing._activeTransaction) {
Tracing._log(
`[Tracing] Transaction: ${SpanStatus.Cancelled} -> Heartbeat safeguard kicked in since content hasn't changed for 3 beats`,
`[Tracing] Transaction: ${
SpanStatus.Cancelled
} -> Heartbeat safeguard kicked in since content hasn't changed for 3 beats`,
);
Tracing._activeTransaction.setStatus(SpanStatus.DeadlineExceeded);
Tracing._activeTransaction.setTag('heartbeat', 'failed');
Expand Down
2 changes: 1 addition & 1 deletion packages/browser/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = {
parserOptions: {
ecmaVersion: 2018,
},
extends: ['../../.eslintrc.js'],
extends: ['sentry-sdks'],
ignorePatterns: ['build/**/*', 'dist/**/*', 'esm/**/*', 'examples/**/*', 'scripts/**/*', 'src/loader.js'],
overrides: [
{
Expand Down
7 changes: 4 additions & 3 deletions packages/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
"devDependencies": {
"@types/eslint": "^7.2.0",
"@types/md5": "2.1.33",
"eslint-config-sentry-sdks": "5.20.1",
"eslint": "7.6.0",
"btoa": "^1.2.1",
"chai": "^4.1.2",
"chokidar": "^3.0.2",
Expand All @@ -40,8 +42,7 @@
"karma-typescript-es6-transform": "^4.0.0",
"node-fetch": "^2.6.0",
"npm-run-all": "^4.1.2",
"prettier": "^1.17.0",
"prettier-check": "^2.0.0",
"prettier": "1.17.0",
"rimraf": "^2.6.3",
"rollup": "^1.10.1",
"rollup-plugin-commonjs": "^9.3.4",
Expand All @@ -65,7 +66,7 @@
"clean": "rimraf dist coverage .rpt2_cache build esm",
"link:yarn": "yarn link",
"lint": "run-s lint:prettier lint:eslint",
"lint:prettier": "prettier-check \"{src,test}/**/*.ts\"",
"lint:prettier": "prettier --check \"{src,test}/**/*.ts\"",
"lint:eslint": "eslint . --cache --cache-location '../../eslintcache/' --format stylish",
"fix": "run-s fix:eslint fix:prettier",
"fix:prettier": "prettier --write \"{src,test}/**/*.ts\"",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
parserOptions: {
ecmaVersion: 2018,
},
extends: ['../../.eslintrc.js'],
extends: ['sentry-sdks'],
ignorePatterns: ['build/**/*', 'dist/**/*', 'esm/**/*', 'examples/**/*', 'scripts/**/*'],
overrides: [
{
Expand Down
7 changes: 4 additions & 3 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@
"tslib": "^1.9.3"
},
"devDependencies": {
"eslint-config-sentry-sdks": "5.20.1",
"eslint": "7.6.0",
"jest": "^24.7.1",
"npm-run-all": "^4.1.2",
"prettier": "^1.17.0",
"prettier-check": "^2.0.0",
"prettier": "1.17.0",
"rimraf": "^2.6.3",
"typescript": "3.4.5"
},
Expand All @@ -40,7 +41,7 @@
"clean": "rimraf dist coverage",
"link:yarn": "yarn link",
"lint": "run-s lint:prettier lint:eslint",
"lint:prettier": "prettier-check \"{src,test}/**/*.ts\"",
"lint:prettier": "prettier --check \"{src,test}/**/*.ts\"",
"lint:eslint": "eslint . --cache --cache-location '../../eslintcache/' --format stylish",
"fix": "run-s fix:eslint fix:prettier",
"fix:prettier": "prettier --write \"{src,test}/**/*.ts\"",
Expand Down
40 changes: 17 additions & 23 deletions packages/ember/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,23 @@ module.exports = {
ecmaVersion: 2018,
sourceType: 'module',
ecmaFeatures: {
legacyDecorators: true
}
legacyDecorators: true,
},
},
plugins: [
'ember'
],
extends: [
'eslint:recommended',
'plugin:ember/recommended'
],
plugins: ['ember'],
extends: ['eslint:recommended', 'plugin:ember/recommended'],
env: {
browser: true
browser: true,
},
globals: {
"QUnit": true
QUnit: true,
},
rules: {},
overrides: [
{
files: ['addon/**/*'],
plugins: ['sentry-sdks'],
},
// node files
{
files: [
Expand All @@ -35,23 +34,18 @@ module.exports = {
'testem.js',
'blueprints/*/index.js',
'config/**/*.js',
'tests/dummy/config/**/*.js'
],
excludedFiles: [
'addon/**',
'addon-test-support/**',
'app/**',
'tests/dummy/app/**'
'tests/dummy/config/**/*.js',
],
excludedFiles: ['addon/**', 'addon-test-support/**', 'app/**', 'tests/dummy/app/**'],
parserOptions: {
sourceType: 'script'
sourceType: 'script',
},
env: {
browser: false,
node: true
node: true,
},
plugins: ['node'],
extends: ['plugin:node/recommended']
}
]
extends: ['plugin:node/recommended'],
},
],
};
5 changes: 3 additions & 2 deletions packages/ember/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"@ember/optional-features": "^1.3.0",
"@glimmer/component": "^1.0.0",
"@glimmer/tracking": "^1.0.0",
"eslint-config-sentry-sdks": "5.20.1",
"@types/ember": "^3.16.0",
"@types/ember-qunit": "^3.4.9",
"@types/ember__test-helpers": "^1.7.0",
Expand All @@ -64,13 +65,13 @@
"ember-template-lint": "^2.9.1",
"ember-test-selectors": "^4.1.0",
"ember-try": "^1.4.0",
"eslint": "^7.5.0",
"eslint": "7.6.0",
"eslint-plugin-ember": "^8.6.0",
"eslint-plugin-node": "^11.1.0",
"loader.js": "^4.7.0",
"npm-run-all": "^4.1.5",
"qunit-dom": "^1.2.0",
"typescript": "^3.9.7"
"typescript": "3.4.5"
},
"engines": {
"node": "10.* || >= 12"
Expand Down
2 changes: 2 additions & 0 deletions packages/eslint-config-sentry-sdks/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!/src/**/*
21 changes: 21 additions & 0 deletions packages/eslint-config-sentry-sdks/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 Sentry (https://sentry.io/) and individual contributors.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
41 changes: 41 additions & 0 deletions packages/eslint-config-sentry-sdks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<p align="center">
<a href="https://sentry.io" target="_blank" align="center">
<img src="https://sentry-brand.storage.googleapis.com/sentry-logo-black.png" width="280">
</a>
<br />
</p>

# Official Sentry SDK eslint config

[![npm version](https://img.shields.io/npm/v/@sentry/integrations.svg)](https://www.npmjs.com/package/@sentry/integrations)
[![npm dm](https://img.shields.io/npm/dm/@sentry/integrations.svg)](https://www.npmjs.com/package/@sentry/integrations)
[![npm dt](https://img.shields.io/npm/dt/@sentry/integrations.svg)](https://www.npmjs.com/package/@sentry/integrations)
[![typedoc](https://img.shields.io/badge/docs-typedoc-blue.svg)](http://getsentry.github.io/sentry-javascript/)

## Links

- [Official SDK Docs](https://docs.sentry.io/quickstart/)
- [TypeDoc](http://getsentry.github.io/sentry-javascript/)

## General

Install with `yarn add -D eslint-config-sentry-sdks`

## Configuration

Use `sentry-sdks` for base rules. Make sure to specify your tsconfig under `parserOptions.project` so that you can
correctly use the typescript rules. This configuration comes with

```json
{
"extends": ["@sentry"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.d.ts"],
"parserOptions": {
"project": "./tsconfig.json"
}
}
]
}
```
Loading