diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 544b9a8eeef6..000000000000 --- a/.eslintignore +++ /dev/null @@ -1,4 +0,0 @@ -# THIS IS A TEMPORARY FILE -# THIS WILL BE REMOVED AFTER WE FINISH ESLINT UPGRADE - -packages/typescript/**/* diff --git a/eslint-plugin-sentry-sdks/package.json b/eslint-plugin-sentry-sdks/package.json deleted file mode 100644 index 231126e1abbb..000000000000 --- a/eslint-plugin-sentry-sdks/package.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "eslint-plugin-sentry-sdks", - "version": "0.0.1", - "main": "index.js", - "devDependencies": { - "eslint": "^7.5.0" - }, - "engines": { - "node": ">=0.10.0" - } -} diff --git a/package.json b/package.json index 95a1f152a46a..325e25a98e27 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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", diff --git a/packages/angular/.eslintrc.js b/packages/angular/.eslintrc.js index bab76a513f84..2920ba12231a 100644 --- a/packages/angular/.eslintrc.js +++ b/packages/angular/.eslintrc.js @@ -7,7 +7,7 @@ module.exports = { parserOptions: { ecmaVersion: 2018, }, - extends: ['../../.eslintrc.js'], + extends: ['sentry-sdks'], ignorePatterns: ['build/**/*', 'dist/**/*', 'esm/**/*', 'examples/**/*', 'scripts/**/*'], overrides: [ { diff --git a/packages/angular/package.json b/packages/angular/package.json index 7b26fee71726..a3a8cdb05eba 100644 --- a/packages/angular/package.json +++ b/packages/angular/package.json @@ -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", @@ -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\"", diff --git a/packages/apm/.eslintrc.js b/packages/apm/.eslintrc.js index 06e1cc905a45..58fe32e8bad9 100644 --- a/packages/apm/.eslintrc.js +++ b/packages/apm/.eslintrc.js @@ -6,7 +6,7 @@ module.exports = { parserOptions: { ecmaVersion: 2018, }, - extends: ['../../.eslintrc.js'], + extends: ['sentry-sdks'], ignorePatterns: ['build/**/*', 'dist/**/*', 'esm/**/*', 'examples/**/*', 'scripts/**/*'], overrides: [ { diff --git a/packages/apm/package.json b/packages/apm/package.json index 83f09c132fae..c9cd39dc84de 100644 --- a/packages/apm/package.json +++ b/packages/apm/package.json @@ -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", @@ -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\"", diff --git a/packages/apm/src/integrations/tracing.ts b/packages/apm/src/integrations/tracing.ts index 97ba85efdc5e..cf89efb118b1 100644 --- a/packages/apm/src/integrations/tracing.ts +++ b/packages/apm/src/integrations/tracing.ts @@ -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'); diff --git a/packages/browser/.eslintrc.js b/packages/browser/.eslintrc.js index 1c1c96c6a009..c92b80f582f6 100644 --- a/packages/browser/.eslintrc.js +++ b/packages/browser/.eslintrc.js @@ -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: [ { diff --git a/packages/browser/package.json b/packages/browser/package.json index 431b1caf5a29..0d2e8a2b4909 100644 --- a/packages/browser/package.json +++ b/packages/browser/package.json @@ -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", @@ -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", @@ -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\"", diff --git a/packages/core/.eslintrc.js b/packages/core/.eslintrc.js index 06e1cc905a45..58fe32e8bad9 100644 --- a/packages/core/.eslintrc.js +++ b/packages/core/.eslintrc.js @@ -6,7 +6,7 @@ module.exports = { parserOptions: { ecmaVersion: 2018, }, - extends: ['../../.eslintrc.js'], + extends: ['sentry-sdks'], ignorePatterns: ['build/**/*', 'dist/**/*', 'esm/**/*', 'examples/**/*', 'scripts/**/*'], overrides: [ { diff --git a/packages/core/package.json b/packages/core/package.json index 46eaaa62bf89..bbe6387a3259 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -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" }, @@ -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\"", diff --git a/packages/ember/.eslintrc.js b/packages/ember/.eslintrc.js index ae43746840b0..aa51388622a1 100644 --- a/packages/ember/.eslintrc.js +++ b/packages/ember/.eslintrc.js @@ -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: [ @@ -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'], + }, + ], }; diff --git a/packages/ember/package.json b/packages/ember/package.json index d12fe4ef8cfd..8c3662f55da4 100644 --- a/packages/ember/package.json +++ b/packages/ember/package.json @@ -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", @@ -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" diff --git a/packages/eslint-config-sentry-sdks/.npmignore b/packages/eslint-config-sentry-sdks/.npmignore new file mode 100644 index 000000000000..8f4f62a06989 --- /dev/null +++ b/packages/eslint-config-sentry-sdks/.npmignore @@ -0,0 +1,2 @@ +* +!/src/**/* diff --git a/packages/eslint-config-sentry-sdks/LICENSE b/packages/eslint-config-sentry-sdks/LICENSE new file mode 100644 index 000000000000..22fef4436de0 --- /dev/null +++ b/packages/eslint-config-sentry-sdks/LICENSE @@ -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. diff --git a/packages/eslint-config-sentry-sdks/README.md b/packages/eslint-config-sentry-sdks/README.md new file mode 100644 index 000000000000..1f657be78c2b --- /dev/null +++ b/packages/eslint-config-sentry-sdks/README.md @@ -0,0 +1,41 @@ +

+ + + +
+

+ +# 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" + } + } + ] +} +``` diff --git a/packages/eslint-config-sentry-sdks/package.json b/packages/eslint-config-sentry-sdks/package.json new file mode 100644 index 000000000000..9e0c8978b660 --- /dev/null +++ b/packages/eslint-config-sentry-sdks/package.json @@ -0,0 +1,44 @@ +{ + "name": "eslint-config-sentry-sdks", + "version": "5.20.1", + "description": "Official Sentry SDK eslint config", + "repository": "git://github.com/getsentry/sentry-javascript.git", + "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/eslint-config-sentry-sdks", + "author": "Sentry", + "license": "MIT", + "keywords": [ + "eslint", + "eslint-config", + "sentry" + ], + "engines": { + "node": ">=6" + }, + "main": "src/index.js", + "publishConfig": { + "access": "public" + }, + "dependencies": { + "eslint-plugin-sentry-sdks": "5.20.1", + "@sentry/typescript": "5.20.1", + "@typescript-eslint/eslint-plugin": "^3.9.0", + "@typescript-eslint/parser": "^3.9.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-simple-import-sort": "^5.0.3" + }, + "peerDependencies": { + "eslint": ">=5" + }, + "devDependencies": { + "eslint": "7.6.0", + "typescript": "3.4.5" + }, + "scripts": { + "link:yarn": "yarn link", + "lint": "prettier --check \"**/*.js\"", + "fix": "prettier --write \"**/*.js\"" + } +} diff --git a/.eslintrc.js b/packages/eslint-config-sentry-sdks/src/index.js similarity index 96% rename from .eslintrc.js rename to packages/eslint-config-sentry-sdks/src/index.js index f4ee4c1089a4..b1e89dcc280b 100644 --- a/.eslintrc.js +++ b/packages/eslint-config-sentry-sdks/src/index.js @@ -5,7 +5,6 @@ module.exports = { }, extends: ['prettier', 'eslint:recommended', 'plugin:import/errors', 'plugin:import/warnings'], plugins: ['sentry-sdks', 'simple-import-sort'], - ignorePatterns: ['eslint-plugin-sentry-sdks'], overrides: [ { // Configuration for JavaScript files @@ -20,9 +19,6 @@ module.exports = { extends: ['plugin:@typescript-eslint/recommended', 'prettier/@typescript-eslint', 'plugin:import/typescript'], plugins: ['@typescript-eslint', 'jsdoc', 'deprecation'], parser: '@typescript-eslint/parser', - parserOptions: { - project: './tsconfig.json', - }, rules: { // Unused variables should be removed unless they are marked with and underscore (ex. _varName). '@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }], @@ -111,7 +107,10 @@ module.exports = { // even if it may seems excessive at times, is important to emphasize. Turned off in tests. 'jsdoc/require-jsdoc': [ 'error', - { require: { ClassDeclaration: true, MethodDefinition: true }, checkConstructors: false }, + { + require: { ClassDeclaration: true, MethodDefinition: true }, + checkConstructors: false, + }, ], // All imports should be accounted for diff --git a/packages/eslint-plugin-sentry-sdks/.npmignore b/packages/eslint-plugin-sentry-sdks/.npmignore new file mode 100644 index 000000000000..8f4f62a06989 --- /dev/null +++ b/packages/eslint-plugin-sentry-sdks/.npmignore @@ -0,0 +1,2 @@ +* +!/src/**/* diff --git a/packages/eslint-plugin-sentry-sdks/LICENSE b/packages/eslint-plugin-sentry-sdks/LICENSE new file mode 100644 index 000000000000..22fef4436de0 --- /dev/null +++ b/packages/eslint-plugin-sentry-sdks/LICENSE @@ -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. diff --git a/packages/eslint-plugin-sentry-sdks/package.json b/packages/eslint-plugin-sentry-sdks/package.json new file mode 100644 index 000000000000..63c02e36761c --- /dev/null +++ b/packages/eslint-plugin-sentry-sdks/package.json @@ -0,0 +1,35 @@ +{ + "name": "eslint-plugin-sentry-sdks", + "version": "5.20.1", + "description": "Official Sentry SDK eslint plugin", + "repository": "git://github.com/getsentry/sentry-javascript.git", + "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/eslint-plugin-sentry-sdks", + "author": "Sentry", + "license": "MIT", + "keywords": [ + "eslint", + "eslint-plugin", + "sentry" + ], + "engines": { + "node": ">=6" + }, + "main": "src/index.js", + "publishConfig": { + "access": "public" + }, + "dependencies": { + "requireindex": "~1.1.0" + }, + "devDependencies": { + "prettier": "1.17.0", + "typescript": "3.4.5", + "mocha": "^6.2.0" + }, + "scripts": { + "link:yarn": "yarn link", + "lint": "prettier --check \"{src,test}/**/*.js\"", + "fix": "prettier --write \"{src,test}/**/*.js\"", + "test": "mocha test --recursive" + } +} diff --git a/packages/eslint-plugin-sentry-sdks/src/index.js b/packages/eslint-plugin-sentry-sdks/src/index.js new file mode 100644 index 000000000000..f83db4de079c --- /dev/null +++ b/packages/eslint-plugin-sentry-sdks/src/index.js @@ -0,0 +1,15 @@ +/** + * @fileoverview eslint plugins for Sentry SDKs + * @author Abhijeet Prasad + */ +'use strict'; + +//------------------------------------------------------------------------------ +// Plugin Definition +//------------------------------------------------------------------------------ + +module.exports = { + rules: { + 'no-async-await': require('./rules/no-async-await'), + }, +}; diff --git a/eslint-plugin-sentry-sdks/index.js b/packages/eslint-plugin-sentry-sdks/src/rules/no-async-await.js similarity index 53% rename from eslint-plugin-sentry-sdks/index.js rename to packages/eslint-plugin-sentry-sdks/src/rules/no-async-await.js index f5efe2df6a40..809b0f35b9e3 100644 --- a/eslint-plugin-sentry-sdks/index.js +++ b/packages/eslint-plugin-sentry-sdks/src/rules/no-async-await.js @@ -1,17 +1,18 @@ -// This is a temporary file. It will be removed when we migrate -// the eslint configs to another repo. - -'use strict'; - /** - * Rule to disallow usage of async await + * @fileoverview Rule to disallow using async await * @author Abhijeet Prasad */ -const noAsyncAwait = { +'use strict'; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = { meta: { type: 'problem', docs: { - description: 'Disallow usage of async await', + description: 'disallow usage of async await', category: 'Best Practices', recommended: true, }, @@ -19,6 +20,18 @@ const noAsyncAwait = { schema: [], }, create: function(context) { + // variables should be defined here + + //---------------------------------------------------------------------- + // Helpers + //---------------------------------------------------------------------- + + // any helper functions should go here or else delete this section + + //---------------------------------------------------------------------- + // Public + //---------------------------------------------------------------------- + return { FunctionDeclaration(node) { if (node.async) { @@ -42,9 +55,3 @@ const noAsyncAwait = { }; }, }; - -module.exports = { - rules: { - 'no-async-await': noAsyncAwait, - }, -}; diff --git a/packages/eslint-plugin-sentry-sdks/test/lib/rules/no-async-await.js b/packages/eslint-plugin-sentry-sdks/test/lib/rules/no-async-await.js new file mode 100644 index 000000000000..0484aa0ec09e --- /dev/null +++ b/packages/eslint-plugin-sentry-sdks/test/lib/rules/no-async-await.js @@ -0,0 +1,50 @@ +/** + * @fileoverview Rule to disallow using async await + * @author Abhijeet Prasad + */ +'use strict'; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +var rule = require('../../../src/rules/no-async-await'), + path = require('path'), + RuleTester = require('eslint').RuleTester; + +//------------------------------------------------------------------------------ +// Tests +//------------------------------------------------------------------------------ + +RuleTester.setDefaultConfig({ + parserOptions: { + ecmaVersion: 8, + }, +}); +var ruleTester = new RuleTester(); + +ruleTester.run('no-async-await', rule, { + valid: [], + invalid: [ + { + code: 'async function hello() { await new Promise(); };', + errors: [ + { + message: + 'Using async-await can add a lot to bundle size. Please do not use it outside of tests, use Promises instead', + type: 'FunctionDeclaration', + }, + ], + }, + { + code: 'const hello = async () => { await new Promise(); };', + errors: [ + { + message: + 'Using async-await can add a lot to bundle size. Please do not use it outside of tests, use Promises instead', + type: 'ArrowFunctionExpression', + }, + ], + }, + ], +}); diff --git a/packages/gatsby/.eslintrc.js b/packages/gatsby/.eslintrc.js index 782e01c74b4b..89bcf7c0fe8e 100644 --- a/packages/gatsby/.eslintrc.js +++ b/packages/gatsby/.eslintrc.js @@ -8,7 +8,7 @@ module.exports = { parserOptions: { ecmaVersion: 2018, }, - extends: ['../../.eslintrc.js'], + extends: ['sentry-sdks'], ignorePatterns: ['build/**/*', 'dist/**/*', 'esm/**/*', 'examples/**/*', 'scripts/**/*'], overrides: [ { diff --git a/packages/gatsby/package.json b/packages/gatsby/package.json index 14819302e4a7..92af2c30eeab 100644 --- a/packages/gatsby/package.json +++ b/packages/gatsby/package.json @@ -33,10 +33,11 @@ "gatsby": "*" }, "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" }, @@ -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\"", diff --git a/packages/hub/.eslintrc.js b/packages/hub/.eslintrc.js index 06e1cc905a45..58fe32e8bad9 100644 --- a/packages/hub/.eslintrc.js +++ b/packages/hub/.eslintrc.js @@ -6,7 +6,7 @@ module.exports = { parserOptions: { ecmaVersion: 2018, }, - extends: ['../../.eslintrc.js'], + extends: ['sentry-sdks'], ignorePatterns: ['build/**/*', 'dist/**/*', 'esm/**/*', 'examples/**/*', 'scripts/**/*'], overrides: [ { diff --git a/packages/hub/package.json b/packages/hub/package.json index 6797f627484a..8c3375e5e527 100644 --- a/packages/hub/package.json +++ b/packages/hub/package.json @@ -21,10 +21,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" }, @@ -38,7 +39,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\"", diff --git a/packages/integrations/.eslintrc.js b/packages/integrations/.eslintrc.js index 78c630867d13..9550949a2745 100644 --- a/packages/integrations/.eslintrc.js +++ b/packages/integrations/.eslintrc.js @@ -6,7 +6,7 @@ module.exports = { parserOptions: { ecmaVersion: 2018, }, - extends: ['../../.eslintrc.js'], + extends: ['sentry-sdks'], ignorePatterns: ['build/**/*', 'dist/**/*', 'esm/**/*', 'examples/**/*', 'scripts/**/*'], overrides: [ { diff --git a/packages/integrations/package.json b/packages/integrations/package.json index 620e776e9e1c..9314cfd0142a 100644 --- a/packages/integrations/package.json +++ b/packages/integrations/package.json @@ -21,11 +21,12 @@ "tslib": "^1.9.3" }, "devDependencies": { + "eslint-config-sentry-sdks": "5.20.1", + "eslint": "7.6.0", "chai": "^4.1.2", "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", @@ -45,7 +46,7 @@ "clean": "rimraf dist coverage esm build .rpt2_cache", "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\"", diff --git a/packages/integrations/src/ember.ts b/packages/integrations/src/ember.ts index aec7cdbb7f0c..e30d12119437 100644 --- a/packages/integrations/src/ember.ts +++ b/packages/integrations/src/ember.ts @@ -53,19 +53,22 @@ export class Ember implements Integration { }; // eslint-disable-next-line @typescript-eslint/no-explicit-any - this._Ember.RSVP.on('error', (reason: any): void => { - if (getCurrentHub().getIntegration(Ember)) { - getCurrentHub().withScope(scope => { - if (isInstanceOf(reason, Error)) { - scope.setExtra('context', 'Unhandled Promise error detected'); - getCurrentHub().captureException(reason, { originalException: reason }); - } else { - scope.setExtra('reason', reason); - getCurrentHub().captureMessage('Unhandled Promise error detected'); - } - }); - } - }); + this._Ember.RSVP.on( + 'error', + (reason: any): void => { + if (getCurrentHub().getIntegration(Ember)) { + getCurrentHub().withScope(scope => { + if (isInstanceOf(reason, Error)) { + scope.setExtra('context', 'Unhandled Promise error detected'); + getCurrentHub().captureException(reason, { originalException: reason }); + } else { + scope.setExtra('reason', reason); + getCurrentHub().captureMessage('Unhandled Promise error detected'); + } + }); + } + }, + ); } /* eslint-enable @typescript-eslint/no-unsafe-member-access */ } diff --git a/packages/integrations/src/reportingobserver.ts b/packages/integrations/src/reportingobserver.ts index 2e4a457e04bf..808298b009c5 100644 --- a/packages/integrations/src/reportingobserver.ts +++ b/packages/integrations/src/reportingobserver.ts @@ -90,7 +90,7 @@ export class ReportingObserver implements Integration { this._getCurrentHub = getCurrentHub; // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - const observer = new (getGlobalObject().ReportingObserver)(this.handler.bind(this), { + const observer = new (getGlobalObject()).ReportingObserver(this.handler.bind(this), { buffered: true, types: this._options.types, }); diff --git a/packages/minimal/.eslintrc.js b/packages/minimal/.eslintrc.js index 06e1cc905a45..58fe32e8bad9 100644 --- a/packages/minimal/.eslintrc.js +++ b/packages/minimal/.eslintrc.js @@ -6,7 +6,7 @@ module.exports = { parserOptions: { ecmaVersion: 2018, }, - extends: ['../../.eslintrc.js'], + extends: ['sentry-sdks'], ignorePatterns: ['build/**/*', 'dist/**/*', 'esm/**/*', 'examples/**/*', 'scripts/**/*'], overrides: [ { diff --git a/packages/minimal/package.json b/packages/minimal/package.json index 5b28674321f5..391b598db97f 100644 --- a/packages/minimal/package.json +++ b/packages/minimal/package.json @@ -21,10 +21,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" }, @@ -38,7 +39,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\"", diff --git a/packages/node/.eslintrc.js b/packages/node/.eslintrc.js index f2892f1e4888..7ecdbc39d96a 100644 --- a/packages/node/.eslintrc.js +++ b/packages/node/.eslintrc.js @@ -7,7 +7,7 @@ module.exports = { parserOptions: { ecmaVersion: 2018, }, - extends: ['../../.eslintrc.js'], + extends: ['sentry-sdks'], ignorePatterns: ['build/**/*', 'dist/**/*', 'esm/**/*', 'examples/**/*', 'scripts/**/*', 'test/manual/**/*'], overrides: [ { diff --git a/packages/node/package.json b/packages/node/package.json index 3f8174be54cc..2803e57d8ec1 100644 --- a/packages/node/package.json +++ b/packages/node/package.json @@ -27,6 +27,8 @@ "tslib": "^1.9.3" }, "devDependencies": { + "eslint-config-sentry-sdks": "5.20.1", + "eslint": "7.6.0", "@types/cookie": "0.3.2", "@types/express": "^4.17.2", "@types/lru-cache": "^5.1.0", @@ -34,8 +36,7 @@ "express": "^4.17.1", "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" }, @@ -49,7 +50,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\"", diff --git a/packages/node/src/handlers.ts b/packages/node/src/handlers.ts index e1639262a0fc..12ce7205324b 100644 --- a/packages/node/src/handlers.ts +++ b/packages/node/src/handlers.ts @@ -91,7 +91,7 @@ function extractTransaction(req: { [key: string]: any }, type: boolean | Transac stack: [ { name: string; - }, + } ]; }; }; diff --git a/packages/react/.eslintrc.js b/packages/react/.eslintrc.js index 4fe0b7fa24fd..96623955dbaf 100644 --- a/packages/react/.eslintrc.js +++ b/packages/react/.eslintrc.js @@ -8,7 +8,7 @@ module.exports = { ecmaVersion: 2018, jsx: true, }, - extends: ['../../.eslintrc.js', 'plugin:react/recommended', 'plugin:react-hooks/recommended'], + extends: ['sentry-sdks', 'plugin:react/recommended', 'plugin:react-hooks/recommended'], ignorePatterns: ['build/**/*', 'dist/**/*', 'esm/**/*', 'examples/**/*', 'scripts/**/*'], overrides: [ { diff --git a/packages/react/package.json b/packages/react/package.json index 939509df1672..ec3d88977001 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -28,6 +28,8 @@ "react-dom": "15.x || 16.x" }, "devDependencies": { + "eslint-config-sentry-sdks": "5.20.1", + "eslint": "7.6.0", "@testing-library/react": "^10.0.6", "@testing-library/react-hooks": "^3.3.0", "@types/history-4": "npm:@types/history@4.7.7", @@ -44,8 +46,7 @@ "jest": "^24.7.1", "jsdom": "^16.2.2", "npm-run-all": "^4.1.2", - "prettier": "^1.17.0", - "prettier-check": "^2.0.0", + "prettier": "1.17.0", "react": "^16.0.0", "react-dom": "^16.0.0", "react-router-3": "npm:react-router@3.2.0", @@ -66,7 +67,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\"", diff --git a/packages/tracing/.eslintrc.js b/packages/tracing/.eslintrc.js index 06e1cc905a45..58fe32e8bad9 100644 --- a/packages/tracing/.eslintrc.js +++ b/packages/tracing/.eslintrc.js @@ -6,7 +6,7 @@ module.exports = { parserOptions: { ecmaVersion: 2018, }, - extends: ['../../.eslintrc.js'], + extends: ['sentry-sdks'], ignorePatterns: ['build/**/*', 'dist/**/*', 'esm/**/*', 'examples/**/*', 'scripts/**/*'], overrides: [ { diff --git a/packages/tracing/package.json b/packages/tracing/package.json index 0824311ffc84..9d996b4ad663 100644 --- a/packages/tracing/package.json +++ b/packages/tracing/package.json @@ -23,14 +23,15 @@ "tslib": "^1.9.3" }, "devDependencies": { + "eslint-config-sentry-sdks": "5.20.1", + "eslint": "7.6.0", "@sentry/browser": "5.20.1", "@types/express": "^4.17.1", "@types/jsdom": "^16.2.3", "jest": "^24.7.1", "jsdom": "^16.2.2", "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", @@ -52,7 +53,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\"", diff --git a/packages/tracing/src/browser/backgroundtab.ts b/packages/tracing/src/browser/backgroundtab.ts index f0ce1f5446aa..2c65b6eb3deb 100644 --- a/packages/tracing/src/browser/backgroundtab.ts +++ b/packages/tracing/src/browser/backgroundtab.ts @@ -16,7 +16,9 @@ export function registerBackgroundTabDetection(): void { const activeTransaction = getActiveTransaction() as IdleTransaction; if (global.document.hidden && activeTransaction) { logger.log( - `[Tracing] Transaction: ${SpanStatus.Cancelled} -> since tab moved to the background, op: ${activeTransaction.op}`, + `[Tracing] Transaction: ${SpanStatus.Cancelled} -> since tab moved to the background, op: ${ + activeTransaction.op + }`, ); // We should not set status if it is already set, this prevent important statuses like // error or data loss from being overwritten on transaction. diff --git a/packages/types/.eslintrc.js b/packages/types/.eslintrc.js index e0d7645dfc16..fa5d086b6643 100644 --- a/packages/types/.eslintrc.js +++ b/packages/types/.eslintrc.js @@ -6,7 +6,7 @@ module.exports = { parserOptions: { ecmaVersion: 2018, }, - extends: ['../../.eslintrc.js'], + extends: ['sentry-sdks'], ignorePatterns: ['build/**/*', 'dist/**/*', 'esm/**/*', 'examples/**/*', 'scripts/**/*'], overrides: [ { diff --git a/packages/types/package.json b/packages/types/package.json index ebba18aa74e6..6c9749f4dea6 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -16,9 +16,10 @@ "access": "public" }, "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", "typescript": "3.4.5" }, "scripts": { @@ -30,7 +31,7 @@ "build:watch:esm": "tsc -p tsconfig.esm.json -w --preserveWatchOutput", "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\"", diff --git a/packages/typescript/package.json b/packages/typescript/package.json index 605b2e5a76f7..afb2303adeec 100644 --- a/packages/typescript/package.json +++ b/packages/typescript/package.json @@ -16,7 +16,7 @@ }, "peerDependencies": { "tslint": "5.16.0", - "typescript": "^3.2.0" + "typescript": "^3.4.5" }, "scripts": { "link:yarn": "yarn link" diff --git a/packages/utils/.eslintrc.js b/packages/utils/.eslintrc.js index 4be661daef4e..2d6721354d81 100644 --- a/packages/utils/.eslintrc.js +++ b/packages/utils/.eslintrc.js @@ -6,7 +6,7 @@ module.exports = { parserOptions: { ecmaVersion: 2018, }, - extends: ['../../.eslintrc.js'], + extends: ['sentry-sdks'], ignorePatterns: ['build/**/*', 'dist/**/*', 'esm/**/*', 'examples/**/*', 'scripts/**/*'], overrides: [ { diff --git a/packages/utils/package.json b/packages/utils/package.json index ed5797dc7e3e..7b688101315b 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -20,11 +20,12 @@ "tslib": "^1.9.3" }, "devDependencies": { + "eslint-config-sentry-sdks": "5.20.1", "chai": "^4.1.2", + "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" }, @@ -38,7 +39,7 @@ "clean": "rimraf dist esm coverage *.js *.js.map *.d.ts", "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\"", diff --git a/packages/utils/src/path.ts b/packages/utils/src/path.ts index ba885a3f9a56..c65efabd31a3 100644 --- a/packages/utils/src/path.ts +++ b/packages/utils/src/path.ts @@ -63,10 +63,7 @@ export function resolve(...args: string[]): string { // handle relative paths to be safe (might happen when process.cwd() fails) // Normalize the path - resolvedPath = normalizeArray( - resolvedPath.split('/').filter(p => !!p), - !resolvedAbsolute, - ).join('/'); + resolvedPath = normalizeArray(resolvedPath.split('/').filter(p => !!p), !resolvedAbsolute).join('/'); return (resolvedAbsolute ? '/' : '') + resolvedPath || '.'; } @@ -132,10 +129,7 @@ export function normalizePath(path: string): string { const trailingSlash = path.substr(-1) === '/'; // Normalize the path - let normalizedPath = normalizeArray( - path.split('/').filter(p => !!p), - !isPathAbsolute, - ).join('/'); + let normalizedPath = normalizeArray(path.split('/').filter(p => !!p), !isPathAbsolute).join('/'); if (!normalizedPath && !isPathAbsolute) { normalizedPath = '.'; diff --git a/packages/utils/test/object.test.ts b/packages/utils/test/object.test.ts index 2dfbe452fe15..04e083bc7458 100644 --- a/packages/utils/test/object.test.ts +++ b/packages/utils/test/object.test.ts @@ -193,10 +193,7 @@ describe('normalize()', () => { obj.children[1].self = obj.children[1]; expect(normalize(obj)).toEqual({ name: 'Alice', - children: [ - { name: 'Bob', self: '[Circular ~]' }, - { name: 'Eve', self: '[Circular ~]' }, - ], + children: [{ name: 'Bob', self: '[Circular ~]' }, { name: 'Eve', self: '[Circular ~]' }], }); }); @@ -213,10 +210,7 @@ describe('normalize()', () => { const obj: object[] = []; obj.push({ name: 'Alice', self: obj }); obj.push({ name: 'Bob', self: obj }); - expect(normalize(obj)).toEqual([ - { name: 'Alice', self: '[Circular ~]' }, - { name: 'Bob', self: '[Circular ~]' }, - ]); + expect(normalize(obj)).toEqual([{ name: 'Alice', self: '[Circular ~]' }, { name: 'Bob', self: '[Circular ~]' }]); }); test('repeated objects in objects', () => { diff --git a/packages/utils/test/promisebuffer.test.ts b/packages/utils/test/promisebuffer.test.ts index bf4288000f38..eef5145c0cc6 100644 --- a/packages/utils/test/promisebuffer.test.ts +++ b/packages/utils/test/promisebuffer.test.ts @@ -18,11 +18,7 @@ describe('PromiseBuffer', () => { const q = new PromiseBuffer(1); const p = new SyncPromise(resolve => setTimeout(resolve, 1)); expect(q.add(p)).toEqual(p); - expect( - q.add( - new SyncPromise(resolve => setTimeout(resolve, 1)), - ), - ).rejects.toThrowError(); + expect(q.add(new SyncPromise(resolve => setTimeout(resolve, 1)))).rejects.toThrowError(); expect(q.length()).toBe(1); }); }); diff --git a/yarn.lock b/yarn.lock index d51d8e7dd23d..f1034be92654 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6585,15 +6585,6 @@ create-react-context@^0.2.2: fbjs "^0.8.0" gud "^1.0.0" -cross-spawn@^5.0.1: - version "5.1.0" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" - integrity sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk= - dependencies: - lru-cache "^4.0.1" - shebang-command "^1.2.0" - which "^1.2.9" - cross-spawn@^6.0.0, cross-spawn@^6.0.5: version "6.0.5" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" @@ -8363,14 +8354,14 @@ eslint-plugin-import@^2.22.0: tsconfig-paths "^3.9.0" eslint-plugin-jsdoc@^30.0.3: - version "30.0.3" - resolved "https://registry.yarnpkg.com/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-30.0.3.tgz#358896c8114ccbee765774b16f64fd7c952309b1" - integrity sha512-EviSu0Hgc9Bhz00WhA6829KYC9BaP6JWoycOTA1xFxjQ/2XguRlB3r6nGNA/jkmMDQp5dTQ22s1kAJIaC+dE8Q== + version "30.2.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-30.2.1.tgz#6cac1a70ec239b4672888193d8a4e084a7e2d7bf" + integrity sha512-9Nx+BKMBoCTDRIbVpMV4MYfw+lvfnfsWTWYX9vwRRZrkXBpZkKtE3dsFcG6MhF7N/vW1cwpjEnoAIAtn0+a6gw== dependencies: comment-parser "^0.7.5" debug "^4.1.1" - jsdoctypeparser "^8.0.0" - lodash "^4.17.15" + jsdoctypeparser "^9.0.0" + lodash "^4.17.19" regextras "^0.7.1" semver "^7.3.2" spdx-expression-parse "^3.0.1" @@ -8409,9 +8400,6 @@ eslint-plugin-react@^7.20.5: resolve "^1.17.0" string.prototype.matchall "^4.0.2" -"eslint-plugin-sentry-sdks@file:./eslint-plugin-sentry-sdks": - version "0.0.1" - eslint-plugin-simple-import-sort@^5.0.3: version "5.0.3" resolved "https://registry.yarnpkg.com/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-5.0.3.tgz#9ae258ddada6efffc55e47a134afbd279eb31fc6" @@ -8445,10 +8433,10 @@ eslint-visitor-keys@^1.0.0, eslint-visitor-keys@^1.1.0, eslint-visitor-keys@^1.3 resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz#30ebd1ef7c2fdff01c3a4f151044af25fab0523e" integrity sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ== -eslint@^7.5.0: - version "7.5.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.5.0.tgz#9ecbfad62216d223b82ac9ffea7ef3444671d135" - integrity sha512-vlUP10xse9sWt9SGRtcr1LAC67BENcQMFeV+w5EvLEoFe3xJ8cF1Skd0msziRx/VMC+72B4DxreCE+OR12OA6Q== +eslint@7.6.0: + version "7.6.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.6.0.tgz#522d67cfaea09724d96949c70e7a0550614d64d6" + integrity sha512-QlAManNtqr7sozWm5TF4wIH9gmUm2hE3vNRUvyoYAa4y1l5/jxD/PQStEjBMQtCqZmSep8UxrcecI60hOpe61w== dependencies: "@babel/code-frame" "^7.0.0" ajv "^6.10.0" @@ -8606,19 +8594,6 @@ exec-sh@^0.3.2: resolved "https://registry.yarnpkg.com/exec-sh/-/exec-sh-0.3.4.tgz#3a018ceb526cc6f6df2bb504b2bfe8e3a4934ec5" integrity sha512-sEFIkc61v75sWeOe72qyrqg2Qg0OuLESziUDk/O/z2qgS15y2gWVFrI6f2Qn/qw/0/NCfCEsmNA4zOjkwEZT1A== -execa@^0.6.0: - version "0.6.3" - resolved "https://registry.yarnpkg.com/execa/-/execa-0.6.3.tgz#57b69a594f081759c69e5370f0d17b9cb11658fe" - integrity sha1-V7aaWU8IF1nGnlNw8NF7nLEWWP4= - dependencies: - cross-spawn "^5.0.1" - get-stream "^3.0.0" - is-stream "^1.1.0" - npm-run-path "^2.0.0" - p-finally "^1.0.0" - signal-exit "^3.0.0" - strip-eof "^1.0.0" - execa@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/execa/-/execa-1.0.0.tgz#c6236a5bb4df6d6f15e88e7f017798216749ddd8" @@ -11573,10 +11548,10 @@ jsbn@~0.1.0: resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" integrity sha1-peZUwuWi3rXyAdls77yoDA7y9RM= -jsdoctypeparser@^8.0.0: - version "8.0.0" - resolved "https://registry.yarnpkg.com/jsdoctypeparser/-/jsdoctypeparser-8.0.0.tgz#a04a944539d3f86e30040c1ece6f6730f865f81a" - integrity sha512-eLCs6s4JqN8TjFJfgdiLHRvogLhOAJz+5RIA2FtoMe6ZDyuvghvppnlIToqAEnVbxRqLMrfnNXpW8FpmR6IMBw== +jsdoctypeparser@^9.0.0: + version "9.0.0" + resolved "https://registry.yarnpkg.com/jsdoctypeparser/-/jsdoctypeparser-9.0.0.tgz#8c97e2fb69315eb274b0f01377eaa5c940bd7b26" + integrity sha512-jrTA2jJIL6/DAEILBEh2/w9QxCuwmvNXIry39Ay/HVfhE3o2yVV0U44blYkqdHA/OKloJEqvJy0xU+GSdE2SIw== jsdom@^11.5.1: version "11.12.0" @@ -12625,7 +12600,7 @@ lowercase-keys@^1.0.0: resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-1.0.1.tgz#6f9e30b47084d971a7c820ff15a6c5167b74c26f" integrity sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA== -lru-cache@4.1.x, lru-cache@^4.0.1: +lru-cache@4.1.x: version "4.1.5" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.5.tgz#8bbe50ea85bed59bc9e33dcab8235ee9bcf443cd" integrity sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g== @@ -13205,7 +13180,7 @@ mktemp@~0.4.0: resolved "https://registry.yarnpkg.com/mktemp/-/mktemp-0.4.0.tgz#6d0515611c8a8c84e484aa2000129b98e981ff0b" integrity sha1-bQUVYRyKjITkhKogABKbmOmB/ws= -mocha@^6.1.4: +mocha@^6.1.4, mocha@^6.2.0: version "6.2.3" resolved "https://registry.yarnpkg.com/mocha/-/mocha-6.2.3.tgz#e648432181d8b99393410212664450a4c1e31912" integrity sha512-0R/3FvjIGH3eEuG17ccFPk117XL2rWxatr81a57D+r/x2uTYZRbdZ4oVidEUMh2W2TJDa7MdAb12Lm2/qrKajg== @@ -14886,17 +14861,10 @@ prepend-http@^2.0.0: resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-2.0.0.tgz#e92434bfa5ea8c19f41cdfd401d741a3c819d897" integrity sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc= -prettier-check@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/prettier-check/-/prettier-check-2.0.0.tgz#edd086ee12d270579233ccb136a16e6afcfba1ae" - integrity sha512-HZG53XQTJ9Cyi5hi1VFVVFxdlhITJybpZAch3ib9KqI05VUxV+F5Hip0GhSWRItrlDzVyqjSoDQ9KqIn7AHYyw== - dependencies: - execa "^0.6.0" - -prettier@^1.17.0: - version "1.19.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb" - integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew== +prettier@1.17.0: + version "1.17.0" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.17.0.tgz#53b303676eed22cc14a9f0cec09b477b3026c008" + integrity sha512-sXe5lSt2WQlCbydGETgfm1YBShgOX4HxQkFPvbxkcwgDvGDeqVau8h+12+lmSVlP3rHPz0oavfddSZg/q+Szjw== pretty-format@^24.9.0: version "24.9.0" @@ -15814,6 +15782,11 @@ require-main-filename@^2.0.0: resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg== +requireindex@~1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/requireindex/-/requireindex-1.1.0.tgz#e5404b81557ef75db6e49c5a72004893fe03e162" + integrity sha1-5UBLgVV+91225JxacgBIk/4D4WI= + requires-port@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" @@ -17940,11 +17913,6 @@ typescript@3.4.5: resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.4.5.tgz#2d2618d10bb566572b8d7aad5180d84257d70a99" integrity sha512-YycBxUb49UUhdNMU5aJ7z5Ej2XGmaIBL0x34vZ82fn3hGvD+bgrMrVDpatgz2f7YxUMJxMkbWxJZeAvDxVe7Vw== -typescript@^3.5.1, typescript@^3.9.7: - version "3.9.7" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.7.tgz#98d600a5ebdc38f40cb277522f12dc800e9e25fa" - integrity sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw== - ua-parser-js@^0.7.18: version "0.7.21" resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.21.tgz#853cf9ce93f642f67174273cc34565ae6f308777"