From 9ab6ec89a4a7df286b61336ab1ff7b771bed1339 Mon Sep 17 00:00:00 2001 From: Ryan Albrecht Date: Tue, 19 Nov 2024 12:02:15 +0800 Subject: [PATCH 1/7] ref(eslint): Straight copy of eslint-config-sentry/strict.js into .eslintrc.js I did skip the `no-restricted-imports` rule, because its just a proxy to eslint-config-sentry/index.js --- .eslintrc.js | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index acb2dfc66cf476..da9c596c31e847 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -2,11 +2,30 @@ const detectDeprecations = !!process.env.SENTRY_DETECT_DEPRECATIONS; +const strictRules = { + 'no-console': ['error'], + + // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-is-mounted.md + 'react/no-is-mounted': ['error'], + + // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-find-dom-node.md + // Recommended to use callback refs instead + 'react/no-find-dom-node': ['error'], + + // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-string-refs.md + // This is now considered legacy, callback refs preferred + 'react/no-string-refs': ['error'], + + 'jest/no-large-snapshots': ['error', {maxSize: 2000}], + + 'sentry/no-styled-shortcut': ['error'], +}; + module.exports = { root: true, extends: detectDeprecations - ? ['sentry-app/strict', 'plugin:deprecation/recommended'] - : ['sentry-app/strict'], + ? ['sentry-app', 'plugin:deprecation/recommended'] + : ['sentry-app'], parserOptions: detectDeprecations ? { @@ -22,6 +41,7 @@ module.exports = { jest: true, }, rules: { + ...strictRules, 'react-hooks/rules-of-hooks': 'error', 'react-hooks/exhaustive-deps': [ 'error', @@ -138,8 +158,9 @@ module.exports = { }, { files: ['static/**/*.spec.{ts,js}', 'tests/js/**/*.{ts,js}'], - extends: ['plugin:testing-library/react', 'sentry-app/strict'], + extends: ['plugin:testing-library/react', 'sentry-app'], rules: { + ...strictRules, // TODO(@anonrig): Remove this from eslint-sentry-config 'space-infix-ops': 'off', 'object-shorthand': 'off', From 5d180532946f48b3d4589c1f7d5b8fd739722635 Mon Sep 17 00:00:00 2001 From: Ryan Albrecht Date: Tue, 19 Nov 2024 12:26:48 +0800 Subject: [PATCH 2/7] ref(eslint): Copy in eslint-config-sentry-app/index.js and install required eslint packages Notice that: - Cleaned up a duplicate `argsIgnorePattern` in the original - `eslint-plugin-jest` went from resolved version `28.8.3` to `28.9.0` -> https://github.com/jest-community/eslint-plugin-jest/releases/tag/v28.9.0 - `eslint-plugin-react` went from resolved version `7.37.1` to `7.37.2` - We're getting some new resolutions in the yarn.lock file --- .eslintrc.js | 289 ++++++++++++++++++++++++++++++++++++++++++++++++++- package.json | 13 ++- yarn.lock | 216 +++++++++++++++++++++++--------------- 3 files changed, 430 insertions(+), 88 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index da9c596c31e847..2b13abc34e303f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -2,6 +2,234 @@ const detectDeprecations = !!process.env.SENTRY_DETECT_DEPRECATIONS; +const appRules = { + /** + * emotion rules for v10 + * + * This probably aren't as necessary anymore, but let's remove when we move to v11 + */ + '@emotion/jsx-import': 'off', + '@emotion/no-vanilla': 'error', + '@emotion/import-from-emotion': 'error', + '@emotion/styled-import': 'error', + + // no-undef is redundant with typescript as tsc will complain + // A downside is that we won't get eslint errors about it, but your editors should + // support tsc errors so.... + 'no-undef': 'off', + + // Let formatter handle this + 'arrow-body-style': 'off', + + /** + * Need to use typescript version of these rules + */ + 'no-shadow': 'off', + '@typescript-eslint/no-shadow': 'error', + + // This only override the `args` rule (which is "none"). There are too many errors and it's difficult to manually + // fix them all, so we'll have to incrementally update. + 'no-unused-vars': 'off', + '@typescript-eslint/no-unused-vars': [ + 'error', + { + vars: 'all', + args: 'all', + // TODO(scttcper): We could enable this to enforce catch (error) + // https://eslint.org/docs/latest/rules/no-unused-vars#caughterrors + caughtErrors: 'none', + + // Ignore vars that start with an underscore + // e.g. if you want to omit a property using object spread: + // + // const {name: _name, ...props} = this.props; + // + varsIgnorePattern: '^_', + argsIgnorePattern: '^_', + destructuredArrayIgnorePattern: '^_', + }, + ], + + 'no-use-before-define': 'off', + // This seems to have been turned on while previously it had been off + '@typescript-eslint/no-use-before-define': ['off'], + + /** + * Restricted imports, e.g. deprecated libraries, etc + * + * See: https://eslint.org/docs/rules/no-restricted-imports + */ + 'no-restricted-imports': [ + 'error', + { + paths: [ + { + name: 'enzyme', + message: + 'Please import from `sentry-test/enzyme` instead. See: https://github.com/getsentry/frontend-handbook#undefined-theme-properties-in-tests for more information', + }, + { + name: '@testing-library/react', + message: + 'Please import from `sentry-test/reactTestingLibrary` instead so that we can ensure consistency throughout the codebase', + }, + { + name: '@testing-library/react-hooks', + message: + 'Please import from `sentry-test/reactTestingLibrary` instead so that we can ensure consistency throughout the codebase', + }, + { + name: '@testing-library/user-event', + message: + 'Please import from `sentry-test/reactTestingLibrary` instead so that we can ensure consistency throughout the codebase', + }, + { + name: '@sentry/browser', + message: + 'Please import from `@sentry/react` to ensure consistency throughout the codebase.', + }, + { + name: 'marked', + message: + "Please import marked from 'app/utils/marked' so that we can ensure sanitation of marked output", + }, + + { + name: 'lodash', + message: + "Please import lodash utilities individually. e.g. `import isEqual from 'lodash/isEqual';`. See https://github.com/getsentry/frontend-handbook#lodash from for information", + }, + { + name: 'lodash/get', + message: + 'Optional chaining `?.` and nullish coalescing operators `??` are available and preferred over using `lodash/get`. See https://github.com/getsentry/frontend-handbook#new-syntax for more information', + }, + { + name: 'react-bootstrap', + message: + 'Avoid usage of any react-bootstrap components as it will soon be removed', + }, + { + name: 'sentry/utils/theme', + importNames: ['lightColors', 'darkColors'], + message: + "'lightColors' and 'darkColors' exports intended for use in Storybook only. Instead, use theme prop from emotion or the useTheme hook.", + }, + { + name: 'react-router', + importNames: ['withRouter'], + message: + "Use 'useLocation', 'useParams', 'useNavigate', 'useRoutes' from sentry/utils instead.", + }, + { + name: 'sentry/utils/withSentryRouter', + importNames: ['withSentryRouter'], + message: + "Use 'useLocation', 'useParams', 'useNavigate', 'useRoutes' from sentry/utils instead.", + }, + ], + }, + ], + + /** + * Better import sorting + */ + 'sort-imports': 'off', + 'import/order': 'off', + 'simple-import-sort/imports': [ + 'error', + { + groups: [ + // Side effect imports. + ['^\\u0000'], + + // Node.js builtins. + // biome-ignore lint/correctness/noNodejsModules: Need to get the list of things! + [`^(${require('node:module').builtinModules.join('|')})(/|$)`], + + // Packages. `react` related packages come first. + ['^react', '^@?\\w'], + + // Test should be separate from the app + ['^(sentry-test|getsentry-test)(/.*|$)'], + + // Internal packages. + ['^(sentry-locale|sentry-images)(/.*|$)'], + + ['^(getsentry-images)(/.*|$)'], + + ['^(app|sentry)(/.*|$)'], + + // Getsentry packages. + ['^(admin|getsentry)(/.*|$)'], + + // Style imports. + ['^.+\\.less$'], + + // Parent imports. Put `..` last. + ['^\\.\\.(?!/?$)', '^\\.\\./?$'], + + // Other relative imports. Put same-folder imports and `.` last. + ['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'], + ], + }, + ], + + 'sentry/no-digits-in-tn': ['error'], + + 'sentry/no-dynamic-translations': ['error'], + + // https://github.com/xojs/eslint-config-xo-typescript/blob/9791a067d6a119a21a4db72c02f1da95e25ffbb6/index.js#L95 + '@typescript-eslint/no-restricted-types': [ + 'error', + { + types: { + // TODO(scttcper): Turn object on to make our types more strict + // object: { + // message: 'The `object` type is hard to use. Use `Record` instead. See: https://github.com/typescript-eslint/typescript-eslint/pull/848', + // fixWith: 'Record' + // }, + Buffer: { + message: + 'Use Uint8Array instead. See: https://sindresorhus.com/blog/goodbye-nodejs-buffer', + suggest: ['Uint8Array'], + }, + '[]': "Don't use the empty array type `[]`. It only allows empty arrays. Use `SomeType[]` instead.", + '[[]]': + "Don't use `[[]]`. It only allows an array with a single element which is an empty array. Use `SomeType[][]` instead.", + '[[[]]]': "Don't use `[[[]]]`. Use `SomeType[][][]` instead.", + }, + }, + ], + // TODO(scttcper): Turn no-empty-object-type on to make our types more strict + // '@typescript-eslint/no-empty-object-type': 'error', + // TODO(scttcper): Turn no-function on to make our types more strict + // '@typescript-eslint/no-unsafe-function-type': 'error', + '@typescript-eslint/no-wrapper-object-types': 'error', + + // Naming convention enforcements + '@typescript-eslint/naming-convention': [ + 'error', + { + selector: 'typeLike', + format: ['PascalCase'], + leadingUnderscore: 'allow', + }, + { + selector: 'enumMember', + format: ['UPPER_CASE'], + }, + ], + + // Don't allow lookbehind expressions in regexp as they crash safari + // We've accidentally used lookbehinds a few times and caused problems. + 'no-lookahead-lookbehind-regexp/no-lookahead-lookbehind-regexp': [ + 'error', + 'no-lookbehind', + 'no-negative-lookbehind', + ], +}; + const strictRules = { 'no-console': ['error'], @@ -24,14 +252,50 @@ const strictRules = { module.exports = { root: true, extends: detectDeprecations - ? ['sentry-app', 'plugin:deprecation/recommended'] - : ['sentry-app'], + ? ['sentry-react', 'plugin:import/typescript', 'plugin:deprecation/recommended'] + : ['sentry-react', 'plugin:import/typescript'], + + plugins: [ + '@typescript-eslint', + '@emotion', + 'import', + 'react', + 'sentry', + 'simple-import-sort', + 'no-lookahead-lookbehind-regexp', + ], + + parser: '@typescript-eslint/parser', parserOptions: detectDeprecations ? { + warnOnUnsupportedTypeScriptVersion: false, + ecmaVersion: 6, + sourceType: 'module', + ecmaFeatures: { + jsx: true, + modules: true, + legacyDecorators: true, + }, project: './tsconfig.json', } - : {}, + : { + warnOnUnsupportedTypeScriptVersion: false, + ecmaVersion: 6, + sourceType: 'module', + ecmaFeatures: { + jsx: true, + modules: true, + legacyDecorators: true, + }, + }, + + env: { + browser: true, + es6: true, + jest: true, + jquery: true, // hard-loaded into vendor.js + }, globals: { require: false, @@ -40,7 +304,19 @@ module.exports = { tick: true, jest: true, }, + + settings: { + 'import/parsers': { + '@typescript-eslint/parser': ['.ts', '.tsx'], + }, + 'import/resolver': { + typescript: {}, + }, + 'import/extensions': ['.js', '.jsx'], + }, + rules: { + ...appRules, ...strictRules, 'react-hooks/rules-of-hooks': 'error', 'react-hooks/exhaustive-deps': [ @@ -158,8 +434,13 @@ module.exports = { }, { files: ['static/**/*.spec.{ts,js}', 'tests/js/**/*.{ts,js}'], - extends: ['plugin:testing-library/react', 'sentry-app'], + extends: [ + 'plugin:testing-library/react', + 'sentry-react', + 'plugin:import/typescript', + ], rules: { + ...appRules, ...strictRules, // TODO(@anonrig): Remove this from eslint-sentry-config 'space-infix-ops': 'off', diff --git a/package.json b/package.json index a20e309798ac1f..03db820751bee5 100644 --- a/package.json +++ b/package.json @@ -176,6 +176,7 @@ "devDependencies": { "@biomejs/biome": "^1.9.1", "@codecov/webpack-plugin": "^1.2.0", + "@emotion/eslint-plugin": "^11.12.0", "@pmmmwh/react-refresh-webpack-plugin": "0.5.15", "@sentry/jest-environment": "6.0.0", "@sentry/profiling-node": "8.39.0-dev.0", @@ -185,11 +186,21 @@ "@testing-library/react": "16.0.0", "@testing-library/user-event": "14.5.2", "@types/node": "^20.14.9", + "@typescript-eslint/eslint-plugin": "^8.8.1", + "@typescript-eslint/parser": "^8.8.1", "babel-gettext-extractor": "^4.1.3", "babel-jest": "29.7.0", "benchmark": "^2.1.4", "eslint": "8.57.1", - "eslint-config-sentry-app": "2.9.0", + "eslint-config-sentry": "^2.10.0", + "eslint-config-sentry-react": "^2.10.0", + "eslint-import-resolver-typescript": "^3.6.3", + "eslint-plugin-import": "^2.31.0", + "eslint-plugin-jest": "^28.8.3", + "eslint-plugin-no-lookahead-lookbehind-regexp": "0.1.0", + "eslint-plugin-react": "^7.37.1", + "eslint-plugin-sentry": "^2.10.0", + "eslint-plugin-simple-import-sort": "^12.1.1", "html-webpack-plugin": "^5.6.0", "jest": "29.7.0", "jest-canvas-mock": "^2.5.2", diff --git a/yarn.lock b/yarn.lock index 1620fca8b069f5..b0647abc01d5f9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1103,13 +1103,20 @@ "@babel/plugin-transform-modules-commonjs" "^7.25.9" "@babel/plugin-transform-typescript" "^7.25.9" -"@babel/runtime@*", "@babel/runtime@7.4.5", "@babel/runtime@^7.12.0", "@babel/runtime@^7.12.5", "@babel/runtime@^7.16.3", "@babel/runtime@^7.18.3", "@babel/runtime@^7.3.4", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.4", "@babel/runtime@^7.8.7", "@babel/runtime@^7.9.2", "@babel/runtime@~7.25.9": +"@babel/runtime@*", "@babel/runtime@7.4.5", "@babel/runtime@^7.12.0", "@babel/runtime@^7.12.5", "@babel/runtime@^7.18.3", "@babel/runtime@^7.3.4", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.4", "@babel/runtime@^7.8.7", "@babel/runtime@^7.9.2", "@babel/runtime@~7.25.9": version "7.25.9" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.25.9.tgz#65884fd6dc255a775402cc1d9811082918f4bf00" integrity sha512-4zpTHZ9Cm6L9L+uIqghQX8ZXg8HKFcjYO3qHoO8zTmRm6HQUJ8SSJ+KRvbMBZn0EGVlT4DRYeQ/6hjlyXBh+Kg== dependencies: regenerator-runtime "^0.14.0" +"@babel/runtime@^7.16.3": + version "7.26.0" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.26.0.tgz#8600c2f595f277c60815256418b85356a65173c1" + integrity sha512-FDSOghenHTiToteC/QRlv2q3DhPZ/oOXTBoirfWNx1Cx3TMVcGWQtMMmQcSvb/JjpNeGzx8Pq/b4fKEJuWm1sw== + dependencies: + regenerator-runtime "^0.14.0" + "@babel/template@^7.25.9", "@babel/template@^7.3.3": version "7.25.9" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.25.9.tgz#ecb62d81a8a6f5dc5fe8abfc3901fc52ddf15016" @@ -4256,6 +4263,14 @@ "@typescript-eslint/types" "5.62.0" "@typescript-eslint/visitor-keys" "5.62.0" +"@typescript-eslint/scope-manager@8.15.0": + version "8.15.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-8.15.0.tgz#28a1a0f13038f382424f45a988961acaca38f7c6" + integrity sha512-QRGy8ADi4J7ii95xz4UoiymmmMd/zuy9azCaamnZ3FM8T5fZcex8UfJcjkiEZjJSztKfEBe3dZ5T/5RHAmw2mA== + dependencies: + "@typescript-eslint/types" "8.15.0" + "@typescript-eslint/visitor-keys" "8.15.0" + "@typescript-eslint/scope-manager@8.8.1": version "8.8.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-8.8.1.tgz#b4bea1c0785aaebfe3c4ab059edaea1c4977e7ff" @@ -4279,6 +4294,11 @@ resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.62.0.tgz#258607e60effa309f067608931c3df6fed41fd2f" integrity sha512-87NVngcbVXUahrRTqIK27gD2t5Cu1yuCXxbLcFtCzZGlfyVWWh8mLHkoxzjsB6DDNnvdL+fW8MiwPEJyGJQDgQ== +"@typescript-eslint/types@8.15.0": + version "8.15.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-8.15.0.tgz#4958edf3d83e97f77005f794452e595aaf6430fc" + integrity sha512-n3Gt8Y/KyJNe0S3yDCD2RVKrHBC4gTUcLTebVBXacPy091E6tNspFLKRXlk3hwT4G55nfr1n2AdFqi/XMxzmPQ== + "@typescript-eslint/types@8.8.1": version "8.8.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-8.8.1.tgz#ebe85e0fa4a8e32a24a56adadf060103bef13bd1" @@ -4297,6 +4317,20 @@ semver "^7.3.7" tsutils "^3.21.0" +"@typescript-eslint/typescript-estree@8.15.0": + version "8.15.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-8.15.0.tgz#915c94e387892b114a2a2cc0df2d7f19412c8ba7" + integrity sha512-1eMp2JgNec/niZsR7ioFBlsh/Fk0oJbhaqO0jRyQBMgkz7RrFfkqF9lYYmBoGBaSiLnu8TAPQTwoTUiSTUW9dg== + dependencies: + "@typescript-eslint/types" "8.15.0" + "@typescript-eslint/visitor-keys" "8.15.0" + debug "^4.3.4" + fast-glob "^3.3.2" + is-glob "^4.0.3" + minimatch "^9.0.4" + semver "^7.6.0" + ts-api-utils "^1.3.0" + "@typescript-eslint/typescript-estree@8.8.1": version "8.8.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-8.8.1.tgz#34649f4e28d32ee49152193bc7dedc0e78e5d1ec" @@ -4311,7 +4345,7 @@ semver "^7.6.0" ts-api-utils "^1.3.0" -"@typescript-eslint/utils@5.62.0", "@typescript-eslint/utils@^5.25.0", "@typescript-eslint/utils@^5.58.0": +"@typescript-eslint/utils@5.62.0", "@typescript-eslint/utils@^5.25.0", "@typescript-eslint/utils@^5.62.0": version "5.62.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.62.0.tgz#141e809c71636e4a75daa39faed2fb5f4b10df86" integrity sha512-n8oxjeb5aIbPFEtmQxQYOLI0i9n5ySBEY/ZEHHZqKQSFnxio1rv6dthascc9dLuwrL0RC5mPCxB7vnAVGAYWAQ== @@ -4325,7 +4359,7 @@ eslint-scope "^5.1.1" semver "^7.3.7" -"@typescript-eslint/utils@8.8.1", "@typescript-eslint/utils@^6.0.0 || ^7.0.0 || ^8.0.0": +"@typescript-eslint/utils@8.8.1": version "8.8.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-8.8.1.tgz#9e29480fbfa264c26946253daa72181f9f053c9d" integrity sha512-/QkNJDbV0bdL7H7d0/y0qBbV2HTtf0TIyjSDTvvmQEzeVx8jEImEbLuOA4EsvE8gIgqMitns0ifb5uQhMj8d9w== @@ -4335,6 +4369,16 @@ "@typescript-eslint/types" "8.8.1" "@typescript-eslint/typescript-estree" "8.8.1" +"@typescript-eslint/utils@^6.0.0 || ^7.0.0 || ^8.0.0": + version "8.15.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-8.15.0.tgz#ac04679ad19252776b38b81954b8e5a65567cef6" + integrity sha512-k82RI9yGhr0QM3Dnq+egEpz9qB6Un+WLYhmoNcvl8ltMEededhh7otBVVIDDsEEttauwdY/hQoSsOv13lxrFzQ== + dependencies: + "@eslint-community/eslint-utils" "^4.4.0" + "@typescript-eslint/scope-manager" "8.15.0" + "@typescript-eslint/types" "8.15.0" + "@typescript-eslint/typescript-estree" "8.15.0" + "@typescript-eslint/visitor-keys@5.62.0": version "5.62.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.62.0.tgz#2174011917ce582875954ffe2f6912d5931e353e" @@ -4343,6 +4387,14 @@ "@typescript-eslint/types" "5.62.0" eslint-visitor-keys "^3.3.0" +"@typescript-eslint/visitor-keys@8.15.0": + version "8.15.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-8.15.0.tgz#9ea5a85eb25401d2aa74ec8a478af4e97899ea12" + integrity sha512-h8vYOulWec9LhpwfAdZf2bjr8xIp0KNKnpgqSz0qqYYKAW/QZKw3ktRndbiAtUz4acH4QLQavwZBYCc0wulA/Q== + dependencies: + "@typescript-eslint/types" "8.15.0" + eslint-visitor-keys "^4.2.0" + "@typescript-eslint/visitor-keys@8.8.1": version "8.8.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-8.8.1.tgz#0fb1280f381149fc345dfde29f7542ff4e587fc5" @@ -5184,11 +5236,16 @@ caniuse-api@^3.0.0: lodash.memoize "^4.1.2" lodash.uniq "^4.5.0" -caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001283, caniuse-lite@^1.0.30001669: +caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001669: version "1.0.30001677" resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001677.tgz" integrity sha512-fmfjsOlJUpMWu+mAAtZZZHz7UEwsUxIIvu1TJfO1HqFQvB/B+ii0xr9B5HpbZY/mC4XZ8SvjHJqtAY6pDPQEog== +caniuse-lite@^1.0.30001283: + version "1.0.30001680" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001680.tgz#5380ede637a33b9f9f1fc6045ea99bd142f3da5e" + integrity sha512-rPQy70G6AGUMnbwS1z6Xg+RkHYPAi18ihs47GH0jcxIG7wArmPgY3XbS2sRdBbxJljp3thdT8BIqv9ccCypiPA== + cbor-web@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/cbor-web/-/cbor-web-8.1.0.tgz#c1148e91ca6bfc0f5c07c1df164854596e2e33d6" @@ -6320,9 +6377,9 @@ error-stack-parser@^2.0.6: stackframe "^1.1.1" es-abstract@^1.17.5, es-abstract@^1.22.1, es-abstract@^1.22.3, es-abstract@^1.23.0, es-abstract@^1.23.1, es-abstract@^1.23.2, es-abstract@^1.23.3: - version "1.23.3" - resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.23.3.tgz#8f0c5a35cd215312573c5a27c87dfd6c881a0aa0" - integrity sha512-e+HfNH61Bj1X9/jLc5v1owaLYuHdeHHSQlkhCBiTK8rBvKaULl/beGMxwrMXjpYrv4pz22BlY570vVePA2ho4A== + version "1.23.5" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.23.5.tgz#f4599a4946d57ed467515ed10e4f157289cd52fb" + integrity sha512-vlmniQ0WNPwXqA0BnmwV3Ng7HxiGlh6r5U6JcTMNx8OilcAGqVJBHJcPjqOMaczU9fRuRK5Px2BdVyPRnKMMVQ== dependencies: array-buffer-byte-length "^1.0.1" arraybuffer.prototype.slice "^1.0.3" @@ -6339,7 +6396,7 @@ es-abstract@^1.17.5, es-abstract@^1.22.1, es-abstract@^1.22.3, es-abstract@^1.23 function.prototype.name "^1.1.6" get-intrinsic "^1.2.4" get-symbol-description "^1.0.2" - globalthis "^1.0.3" + globalthis "^1.0.4" gopd "^1.0.1" has-property-descriptors "^1.0.2" has-proto "^1.0.3" @@ -6355,10 +6412,10 @@ es-abstract@^1.17.5, es-abstract@^1.22.1, es-abstract@^1.22.3, es-abstract@^1.23 is-string "^1.0.7" is-typed-array "^1.1.13" is-weakref "^1.0.2" - object-inspect "^1.13.1" + object-inspect "^1.13.3" object-keys "^1.1.1" object.assign "^4.1.5" - regexp.prototype.flags "^1.5.2" + regexp.prototype.flags "^1.5.3" safe-array-concat "^1.1.2" safe-regex-test "^1.0.3" string.prototype.trim "^1.2.9" @@ -6383,10 +6440,10 @@ es-errors@^1.2.1, es-errors@^1.3.0: resolved "https://registry.yarnpkg.com/es-errors/-/es-errors-1.3.0.tgz#05f75a25dab98e4fb1dcd5e1472c0546d5057c8f" integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw== -es-iterator-helpers@^1.0.19: - version "1.0.19" - resolved "https://registry.yarnpkg.com/es-iterator-helpers/-/es-iterator-helpers-1.0.19.tgz#117003d0e5fec237b4b5c08aded722e0c6d50ca8" - integrity sha512-zoMwbCcH5hwUkKJkT8kDIBZSz9I6mVG//+lDCinLCGov4+r7NIy0ld8o03M0cJxl2spVf6ESYVS6/gpIfq1FFw== +es-iterator-helpers@^1.1.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/es-iterator-helpers/-/es-iterator-helpers-1.2.0.tgz#2f1a3ab998b30cb2d10b195b587c6d9ebdebf152" + integrity sha512-tpxqxncxnpw3c93u8n3VOzACmRFoVmWJqbWXvX/JfKbkhBw1oslgPrUfeSt2psuqyEJFD6N/9lg5i7bsKpoq+Q== dependencies: call-bind "^1.0.7" define-properties "^1.2.1" @@ -6395,12 +6452,13 @@ es-iterator-helpers@^1.0.19: es-set-tostringtag "^2.0.3" function-bind "^1.1.2" get-intrinsic "^1.2.4" - globalthis "^1.0.3" + globalthis "^1.0.4" + gopd "^1.0.1" has-property-descriptors "^1.0.2" has-proto "^1.0.3" has-symbols "^1.0.3" internal-slot "^1.0.7" - iterator.prototype "^1.1.2" + iterator.prototype "^1.1.3" safe-array-concat "^1.1.2" es-module-lexer@^1.2.1: @@ -6512,39 +6570,21 @@ escodegen@^2.0.0: optionalDependencies: source-map "~0.6.1" -eslint-config-sentry-app@2.9.0: - version "2.9.0" - resolved "https://registry.yarnpkg.com/eslint-config-sentry-app/-/eslint-config-sentry-app-2.9.0.tgz#3d6c14687f6cd7d55e0894c5aeafa36553488f4f" - integrity sha512-m/7BEmoirmHt4Y2yQtVZ3o8zitonojD86Odg1aBYLSAH4Gh/aBYU3csOKOA6BDR9ZVuWVWXd0lwi0+LMv9/bMA== - dependencies: - "@emotion/eslint-plugin" "^11.12.0" - "@typescript-eslint/eslint-plugin" "^8.8.1" - "@typescript-eslint/parser" "^8.8.1" - eslint-config-sentry "^2.9.0" - eslint-config-sentry-react "^2.9.0" - eslint-import-resolver-typescript "^3.6.3" - eslint-plugin-import "^2.31.0" - eslint-plugin-jest "^28.8.3" - eslint-plugin-no-lookahead-lookbehind-regexp "0.1.0" - eslint-plugin-react "^7.37.1" - eslint-plugin-sentry "^2.9.0" - eslint-plugin-simple-import-sort "^12.1.1" - -eslint-config-sentry-react@^2.9.0: - version "2.9.0" - resolved "https://registry.yarnpkg.com/eslint-config-sentry-react/-/eslint-config-sentry-react-2.9.0.tgz#ebdd832bbcca3d6a06b42ad6ada12aa153a8a896" - integrity sha512-Tx95YVNUMEJQm9SMeVubCCWgIuB8Y826rgCM7PVCejU7v5EkqCMiB3tZ83zdI8aPLoQrMWphYroMrBAXz0dloA== - dependencies: - eslint-config-sentry "^2.9.0" +eslint-config-sentry-react@^2.10.0: + version "2.10.0" + resolved "https://registry.yarnpkg.com/eslint-config-sentry-react/-/eslint-config-sentry-react-2.10.0.tgz#0246ea2bb75ce38b75dd3dfc9a403009301d54f7" + integrity sha512-/QbnGOpIdEC9TWbHCpdmd4gDT7HzXtTv5BQUkIcN16z+cM+7lOS5PBd4KVYb1W+QZoFNOzPw7PdpN63YIBCvuA== + dependencies: + eslint-config-sentry "^2.10.0" eslint-plugin-jest-dom "^5.4.0" eslint-plugin-react-hooks "^4.6.2" eslint-plugin-testing-library "^6.3.0" eslint-plugin-typescript-sort-keys "^3.3.0" -eslint-config-sentry@^2.9.0: - version "2.9.0" - resolved "https://registry.yarnpkg.com/eslint-config-sentry/-/eslint-config-sentry-2.9.0.tgz#bea7877f3952ec38493d21c683c26e25df895f3d" - integrity sha512-ZPQuF0Lt6e8J6qCj6r6z/ok/3m7EogrW0Hb7BIvofdlAvFyKzXnS+4ms8VC25QmSBywRrPV8Kn3HSU4hPCP94g== +eslint-config-sentry@^2.10.0: + version "2.10.0" + resolved "https://registry.yarnpkg.com/eslint-config-sentry/-/eslint-config-sentry-2.10.0.tgz#41437ef8481c6375bd1816a912f3629e57b2a6fb" + integrity sha512-81IE9qoV3A8+KUDYHkwHtj4dO4XufoUwpXHJVi+5H6iuSRRGsDwIIgMegKblwnihomye6FkNxS/sCOHXEK7p3A== eslint-import-resolver-node@^0.3.9: version "0.3.9" @@ -6602,17 +6642,17 @@ eslint-plugin-import@^2.31.0: tsconfig-paths "^3.15.0" eslint-plugin-jest-dom@^5.4.0: - version "5.4.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-jest-dom/-/eslint-plugin-jest-dom-5.4.0.tgz#03a5ea600f8af63f4fcd5de49ae83dc0e6aca325" - integrity sha512-yBqvFsnpS5Sybjoq61cJiUsenRkC9K32hYQBFS9doBR7nbQZZ5FyO+X7MlmfM1C48Ejx/qTuOCgukDUNyzKZ7A== + version "5.5.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-jest-dom/-/eslint-plugin-jest-dom-5.5.0.tgz#3ccdfe197eddb4108f390db583057a5dacccd4a0" + integrity sha512-CRlXfchTr7EgC3tDI7MGHY6QjdJU5Vv2RPaeeGtkXUHnKZf04kgzMPIJUXt4qKCvYWVVIEo9ut9Oq1vgXAykEA== dependencies: "@babel/runtime" "^7.16.3" requireindex "^1.2.0" eslint-plugin-jest@^28.8.3: - version "28.8.3" - resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-28.8.3.tgz#c5699bba0ad06090ad613535e4f1572f4c2567c0" - integrity sha512-HIQ3t9hASLKm2IhIOqnu+ifw7uLZkIlR7RYNv7fMcEi/p0CIiJmfriStQS2LDkgtY4nyLbIZAD+JL347Yc2ETQ== + version "28.9.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-28.9.0.tgz#19168dfaed124339cd2252c4c4d1ac3688aeb243" + integrity sha512-rLu1s1Wf96TgUUxSw6loVIkNtUjq1Re7A9QdCCHSohnvXEBAjuL420h0T/fMmkQlNsQP2GhQzEUpYHPfxBkvYQ== dependencies: "@typescript-eslint/utils" "^6.0.0 || ^7.0.0 || ^8.0.0" @@ -6630,16 +6670,16 @@ eslint-plugin-react-hooks@^4.6.2: integrity sha512-QzliNJq4GinDBcD8gPB5v0wh6g8q3SUi6EFF0x8N/BL9PoVs0atuGc47ozMRyOWAKdwaZ5OnbOEa3WR+dSGKuQ== eslint-plugin-react@^7.37.1: - version "7.37.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.37.1.tgz#56493d7d69174d0d828bc83afeffe96903fdadbd" - integrity sha512-xwTnwDqzbDRA8uJ7BMxPs/EXRB3i8ZfnOIp8BsxEQkT0nHPp+WWceqGgo6rKb9ctNi8GJLDT4Go5HAWELa/WMg== + version "7.37.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.37.2.tgz#cd0935987876ba2900df2f58339f6d92305acc7a" + integrity sha512-EsTAnj9fLVr/GZleBLFbj/sSuXeWmp1eXIN60ceYnZveqEaUCyW4X+Vh4WTdUhCkW4xutXYqTXCUSyqD4rB75w== dependencies: array-includes "^3.1.8" array.prototype.findlast "^1.2.5" array.prototype.flatmap "^1.3.2" array.prototype.tosorted "^1.1.4" doctrine "^2.1.0" - es-iterator-helpers "^1.0.19" + es-iterator-helpers "^1.1.0" estraverse "^5.3.0" hasown "^2.0.2" jsx-ast-utils "^2.4.1 || ^3.0.0" @@ -6653,10 +6693,10 @@ eslint-plugin-react@^7.37.1: string.prototype.matchall "^4.0.11" string.prototype.repeat "^1.0.0" -eslint-plugin-sentry@^2.9.0: - version "2.9.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-sentry/-/eslint-plugin-sentry-2.9.0.tgz#9c8382a934f395c2a72078bb2c17c9a7b6dac022" - integrity sha512-YqSZV/d/qQnlAqvfdjpdGw/PsCXFqdXwBKdZEEmJR4sKpIQ4SSJhqxeGryKB1cirs32UVu153RWjt9qwKMQp9g== +eslint-plugin-sentry@^2.10.0: + version "2.10.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-sentry/-/eslint-plugin-sentry-2.10.0.tgz#f8785792f9e067a61e2a12816ce7d1c5631745f1" + integrity sha512-QuCUr2B78Onr2GdXM4ncPlS2IBAB+lL5QwSPNvX5LcAoBtV7iFuhEY7DS4WqwgmJcRnI6g3/dKARpFuOILR35A== dependencies: requireindex "~1.2.0" @@ -6666,11 +6706,11 @@ eslint-plugin-simple-import-sort@^12.1.1: integrity sha512-6nuzu4xwQtE3332Uz0to+TxDQYRLTKRESSc2hefVT48Zc8JthmN23Gx9lnYhu0FtkRSL1oxny3kJ2aveVhmOVA== eslint-plugin-testing-library@^6.3.0: - version "6.3.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-testing-library/-/eslint-plugin-testing-library-6.3.0.tgz#9c31a9941a860efdff3c06180151ab9c8142f685" - integrity sha512-GYcEErTt6EGwE0bPDY+4aehfEBpB2gDBFKohir8jlATSUvzStEyzCx8QWB/14xeKc/AwyXkzScSzMHnFojkWrA== + version "6.4.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-testing-library/-/eslint-plugin-testing-library-6.4.0.tgz#1ba8a7422e3e31cc315a73ff17c34908f56f9838" + integrity sha512-yeWF+YgCgvNyPNI9UKnG0FjeE2sk93N/3lsKqcmR8dSfeXJwFT5irnWo7NjLf152HkRzfoFjh3LsBUrhvFz4eA== dependencies: - "@typescript-eslint/utils" "^5.58.0" + "@typescript-eslint/utils" "^5.62.0" eslint-plugin-typescript-sort-keys@^3.3.0: version "3.3.0" @@ -6702,6 +6742,11 @@ eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1, eslint-visitor-keys@^3.4 resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800" integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag== +eslint-visitor-keys@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz#687bacb2af884fcdda8a6e7d65c606f46a14cd45" + integrity sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw== + eslint@8.57.1: version "8.57.1" resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.57.1.tgz#7df109654aba7e3bbe5c8eae533c5e461d3c6ca9" @@ -7169,7 +7214,7 @@ function-bind@^1.1.2: resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA== -function.prototype.name@^1.1.5, function.prototype.name@^1.1.6: +function.prototype.name@^1.1.6: version "1.1.6" resolved "https://registry.yarnpkg.com/function.prototype.name/-/function.prototype.name-1.1.6.tgz#cdf315b7d90ee77a4c6ee216c3c3362da07533fd" integrity sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg== @@ -7342,7 +7387,7 @@ globals@^13.19.0: dependencies: type-fest "^0.20.2" -globalthis@^1.0.3: +globalthis@^1.0.3, globalthis@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/globalthis/-/globalthis-1.0.4.tgz#7430ed3a975d97bfb59bcce41f5cabbafa651236" integrity sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ== @@ -8118,10 +8163,10 @@ istanbul-reports@^3.1.3: html-escaper "^2.0.0" istanbul-lib-report "^3.0.0" -iterator.prototype@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/iterator.prototype/-/iterator.prototype-1.1.2.tgz#5e29c8924f01916cb9335f1ff80619dcff22b0c0" - integrity sha512-DR33HMMr8EzwuRL8Y9D3u2BMj8+RqSE850jfGu59kS7tbmPLzGkZmVSfyCFSDxuZiEY6Rzt3T2NA/qU+NwVj1w== +iterator.prototype@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/iterator.prototype/-/iterator.prototype-1.1.3.tgz#016c2abe0be3bbdb8319852884f60908ac62bf9c" + integrity sha512-FW5iMbeQ6rBGm/oKgzq2aW4KvAGpxPzYES8N4g4xNXUKpL1mclMvOe+76AcLDTvD+Ze+sOpVhgdAQEKF4L9iGQ== dependencies: define-properties "^1.2.1" get-intrinsic "^1.2.1" @@ -9395,6 +9440,11 @@ object-inspect@^1.13.1: resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.13.1.tgz#b96c6109324ccfef6b12216a956ca4dc2ff94bc2" integrity sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ== +object-inspect@^1.13.3: + version "1.13.3" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.13.3.tgz#f14c183de51130243d6d18ae149375ff50ea488a" + integrity sha512-kDCGIbxkDSXE3euJZZXzc6to7fCrKHNI/hSRQnRuQ+BWjFNzZwiFF8fj/6o2t2G9/jTj8PSIYTfCLelLZEeRpA== + object-keys@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" @@ -10582,15 +10632,15 @@ regenerator-transform@^0.15.2: dependencies: "@babel/runtime" "^7.8.4" -regexp.prototype.flags@^1.5.2: - version "1.5.2" - resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.5.2.tgz#138f644a3350f981a858c44f6bb1a61ff59be334" - integrity sha512-NcDiDkTLuPR+++OCKB0nWafEmhg/Da8aUPLPMQbK+bxKKCm1/S5he+AqYa4PlMCVBalb4/yxIRub6qkEx5yJbw== +regexp.prototype.flags@^1.5.2, regexp.prototype.flags@^1.5.3: + version "1.5.3" + resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.5.3.tgz#b3ae40b1d2499b8350ab2c3fe6ef3845d3a96f42" + integrity sha512-vqlC04+RQoFalODCbCumG2xIOvapzVMHwsyIGM/SIE8fRhFFsXeH8/QQ+s0T0kDAhKc4k30s73/0ydkHQz6HlQ== dependencies: - call-bind "^1.0.6" + call-bind "^1.0.7" define-properties "^1.2.1" es-errors "^1.3.0" - set-function-name "^2.0.1" + set-function-name "^2.0.2" regexpu-core@^6.1.1: version "6.1.1" @@ -12182,12 +12232,12 @@ which-boxed-primitive@^1.0.2: is-symbol "^1.0.3" which-builtin-type@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/which-builtin-type/-/which-builtin-type-1.1.3.tgz#b1b8443707cc58b6e9bf98d32110ff0c2cbd029b" - integrity sha512-YmjsSMDBYsM1CaFiayOVT06+KJeXf0o5M/CAd4o1lTadFAtacTUM49zoYxr/oroopFDfhvN6iEcBxUyc3gvKmw== + version "1.1.4" + resolved "https://registry.yarnpkg.com/which-builtin-type/-/which-builtin-type-1.1.4.tgz#592796260602fc3514a1b5ee7fa29319b72380c3" + integrity sha512-bppkmBSsHFmIMSl8BO9TbsyzsvGjVoppt8xUiGzwiu/bhDCGxnpOKCxgqj6GuyHE0mINMDecBFPlOm2hzY084w== dependencies: - function.prototype.name "^1.1.5" - has-tostringtag "^1.0.0" + function.prototype.name "^1.1.6" + has-tostringtag "^1.0.2" is-async-function "^2.0.0" is-date-object "^1.0.5" is-finalizationregistry "^1.0.2" @@ -12196,10 +12246,10 @@ which-builtin-type@^1.1.3: is-weakref "^1.0.2" isarray "^2.0.5" which-boxed-primitive "^1.0.2" - which-collection "^1.0.1" - which-typed-array "^1.1.9" + which-collection "^1.0.2" + which-typed-array "^1.1.15" -which-collection@^1.0.1: +which-collection@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/which-collection/-/which-collection-1.0.2.tgz#627ef76243920a107e7ce8e96191debe4b16c2a0" integrity sha512-K4jVyjnBdgvc86Y6BkaLZEN933SwYOuBFkdmBu9ZfkcAbdVbpITnDmjvZ/aQjRXQrv5EPkTnD1s39GiiqbngCw== @@ -12209,7 +12259,7 @@ which-collection@^1.0.1: is-weakmap "^2.0.2" is-weakset "^2.0.3" -which-typed-array@^1.1.14, which-typed-array@^1.1.15, which-typed-array@^1.1.9: +which-typed-array@^1.1.14, which-typed-array@^1.1.15: version "1.1.15" resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.15.tgz#264859e9b11a649b388bfaaf4f767df1f779b38d" integrity sha512-oV0jmFtUky6CXfkqehVvBP/LSWJ2sy4vWMioiENyJLePrBO/yKyV9OyJySfAKosh+RYkIl5zJCNZ8/4JncrpdA== From 6a3468fefde521c5233eaf9526220969fbbc0dd3 Mon Sep 17 00:00:00 2001 From: Ryan Albrecht Date: Tue, 19 Nov 2024 12:36:35 +0800 Subject: [PATCH 3/7] ref(eslint): Refactor `extends` array so it can be expanded more easily --- .eslintrc.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 2b13abc34e303f..4bab100fe52ca8 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -249,11 +249,14 @@ const strictRules = { 'sentry/no-styled-shortcut': ['error'], }; +const extendsList = ['sentry-react', 'plugin:import/typescript']; +if (detectDeprecations) { + extendsList.push('plugin:deprecation/recommended'); +} + module.exports = { root: true, - extends: detectDeprecations - ? ['sentry-react', 'plugin:import/typescript', 'plugin:deprecation/recommended'] - : ['sentry-react', 'plugin:import/typescript'], + extends: extendsList, plugins: [ '@typescript-eslint', @@ -434,11 +437,7 @@ module.exports = { }, { files: ['static/**/*.spec.{ts,js}', 'tests/js/**/*.{ts,js}'], - extends: [ - 'plugin:testing-library/react', - 'sentry-react', - 'plugin:import/typescript', - ], + extends: ['plugin:testing-library/react', ...extendsList], rules: { ...appRules, ...strictRules, From 0ebee2b107ea9f41a9cb156ed6403c6324b27f85 Mon Sep 17 00:00:00 2001 From: Ryan Albrecht Date: Tue, 19 Nov 2024 12:45:59 +0800 Subject: [PATCH 4/7] ref(eslint): Copy in eslint-config-sentry-react/* rules note that we still have `settings.react.version: 17.0.2`. It was wrong before but i'm leaving it. Enabling it will cause passwordStrength.tsx to error with `ReactDOM.render is deprecated` --- .eslintrc.js | 346 ++++++++++++++++++++++++++++++++++++++++++++++++++- package.json | 5 +- yarn.lock | 11 -- 3 files changed, 349 insertions(+), 13 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 4bab100fe52ca8..63a0822009284e 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -2,6 +2,336 @@ const detectDeprecations = !!process.env.SENTRY_DETECT_DEPRECATIONS; +const reactReactRules = { + // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/display-name.md + 'react/display-name': ['off'], + + // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-multi-comp.md + 'react/no-multi-comp': [ + 'off', + { + ignoreStateless: true, + }, + ], + + // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-fragments.md + 'react/jsx-fragments': ['error', 'element'], + + // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-handler-names.md + // Ensures that any component or prop methods used to handle events are correctly prefixed. + 'react/jsx-handler-names': [ + 'off', + { + eventHandlerPrefix: 'handle', + eventHandlerPropPrefix: 'on', + }, + ], + + // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-key.md + 'react/jsx-key': ['error'], + + // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-undef.md + 'react/jsx-no-undef': ['error'], + + // Disabled as we use the newer JSX transform babel plugin. + // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-react.md + 'react/jsx-uses-react': ['off'], + + // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-vars.md + 'react/jsx-uses-vars': ['error'], + + /** + * Deprecation related rules + */ + // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-deprecated.md + 'react/no-deprecated': ['error'], + + // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-is-mounted.md + 'react/no-is-mounted': ['warn'], + + // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-find-dom-node.md + // Recommended to use callback refs instead + // TODO: Upgrade sentry to use callback refs + 'react/no-find-dom-node': ['warn'], + + // Prevent usage of the return value of React.render + // deprecation: https://facebook.github.io/react/docs/react-dom.html#render + // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-render-return-value.md + 'react/no-render-return-value': ['error'], + + // Children should always be actual children, not passed in as a prop. + // When using JSX, the children should be nested between the opening and closing tags. When not using JSX, the children should be passed as additional arguments to React.createElement. + // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-children-prop.md + 'react/no-children-prop': ['error'], + + // This rule helps prevent problems caused by using children and the dangerouslySetInnerHTML prop at the same time. + // React will throw a warning if this rule is ignored. + // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-danger-with-children.md + 'react/no-danger-with-children': ['error'], + + // Prevent direct mutation of this.state + // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-direct-mutation-state.md + 'react/no-direct-mutation-state': ['error'], + + // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-mount-set-state.md + 'react/no-did-mount-set-state': ['error'], + + // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-update-set-state.md" + 'react/no-did-update-set-state': ['error'], + + // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-redundant-should-component-update.md + 'react/no-redundant-should-component-update': ['error'], + + // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-typos.md + 'react/no-typos': ['error'], + + // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-string-refs.md + // This is now considered legacy, callback refs preferred + 'react/no-string-refs': ['warn'], + + // Prevent invalid characters from appearing in markup + // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unescaped-entities.md + 'react/no-unescaped-entities': ['off'], + + // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unknown-property.md + 'react/no-unknown-property': ['error', {ignore: ['css']}], + + // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unused-prop-types.md + // Disabled since this currently fails to correctly detect a lot of + // typescript prop type usage. + 'react/no-unused-prop-types': ['off'], + + // We do not need proptypes since we're using typescript + 'react/prop-types': ['off'], + + // When writing the render method in a component it is easy to forget to return the JSX content. + // This rule will warn if the return statement is missing. + // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-render-return.md + 'react/require-render-return': ['error'], + + // Disabled as we are using the newer JSX transform babel plugin. + // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/react-in-jsx-scope.md + 'react/react-in-jsx-scope': ['off'], + + // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md + 'react/self-closing-comp': ['error'], + + // This also causes issues with typescript + // See: https://github.com/yannickcr/eslint-plugin-react/issues/2066 + // + // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/sort-comp.md + 'react/sort-comp': ['warn'], + + // Disabled because of prettier + // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/wrap-multilines.md + 'react/jsx-wrap-multilines': ['off'], + + // Consistent (never add ={true}) + // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md + 'react/jsx-boolean-value': ['error', 'never'], + + // Consistent function component declaration styles + // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/function-component-definition.md + 'react/function-component-definition': [ + 'error', + {namedComponents: 'function-declaration'}, + ], +}; + +const reactImportRules = { + // Not recommended to be enabled with typescript-eslint + // https://typescript-eslint.io/linting/troubleshooting/performance-troubleshooting/#eslint-plugin-import + 'import/no-unresolved': ['off'], + 'import/named': ['off'], + 'import/default': ['off'], + 'import/export': ['off'], + 'import/no-named-as-default-member': ['off'], + + // Redflags + // do not allow a default import name to match a named export (airbnb: error) + // Issue with `DefaultIssuePlugin` and `app/plugins/index` + // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-as-default.md + 'import/no-named-as-default': ['off'], + + // disallow use of jsdoc-marked-deprecated imports + // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-deprecated.md + 'import/no-deprecated': ['off'], + + // Forbid mutable exports (airbnb: error) + // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-mutable-exports.md + // TODO: enable? + 'import/no-mutable-exports': ['off'], + + // disallow require() + // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-commonjs.md + 'import/no-commonjs': ['off'], + + // disallow AMD require/define + // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-amd.md + 'import/no-amd': ['error'], + + // disallow duplicate imports + // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md + 'import/no-duplicates': ['error'], + + // disallow namespace imports + // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-namespace.md + 'import/no-namespace': ['off'], + + // Ensure consistent use of file extension within the import path + // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/extensions.md + // TODO this fucks up getsentry + 'import/extensions': [ + 'off', + 'always', + { + js: 'never', + jsx: 'never', + }, + ], + + // Enforce a convention in module import order + // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/order.md + 'import/order': [ + 'error', + { + groups: ['builtin', 'external', 'internal', ['parent', 'sibling', 'index']], + 'newlines-between': 'always', + }, + ], + + // Require a newline after the last import/require in a group + // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/newline-after-import.md + 'import/newline-after-import': ['error'], + + // Require modules with a single export to use a default export (airbnb: error) + // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/prefer-default-export.md + 'import/prefer-default-export': ['off'], + + // Restrict which files can be imported in a given folder + // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-restricted-paths.md + 'import/no-restricted-paths': ['off'], + + // Forbid modules to have too many dependencies + // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/max-dependencies.md + 'import/max-dependencies': ['off', {max: 10}], + + // Forbid import of modules using absolute paths + // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-absolute-path.md + 'import/no-absolute-path': ['error'], + + // Forbid require() calls with expressions (airbnb: error) + // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-dynamic-require.md + 'import/no-dynamic-require': ['off'], + + // Use webpack default chunk names + 'import/dynamic-import-chunkname': ['off'], + + // prevent importing the submodules of other modules + // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-internal-modules.md + 'import/no-internal-modules': [ + 'off', + { + allow: [], + }, + ], + + // Warn if a module could be mistakenly parsed as a script by a consumer + // leveraging Unambiguous JavaScript Grammar + // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/unambiguous.md + // this should not be enabled until this proposal has at least been *presented* to TC39. + // At the moment, it"s not a thing. + 'import/unambiguous': ['off'], + + // Forbid Webpack loader syntax in imports + // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-webpack-loader-syntax.md + 'import/no-webpack-loader-syntax': ['error'], + + // Prevent unassigned imports + // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unassigned-import.md + // importing for side effects is perfectly acceptable, if you need side effects. + 'import/no-unassigned-import': ['off'], + + // Prevent importing the default as if it were named + // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-default.md + 'import/no-named-default': ['error'], + + // Reports if a module"s default export is unnamed + // https://github.com/benmosher/eslint-plugin-import/blob/d9b712ac7fd1fddc391f7b234827925c160d956f/docs/rules/no-anonymous-default-export.md + 'import/no-anonymous-default-export': [ + 'error', + { + allowArray: false, + allowArrowFunction: false, + allowAnonymousClass: false, + allowAnonymousFunction: false, + allowCallExpression: true, + allowLiteral: false, + allowObject: false, + }, + ], +}; + +const reactJestRules = { + 'jest/no-large-snapshots': ['warn', {maxSize: 2000}], + 'jest/no-disabled-tests': 'error', +}; + +const reactRules = { + ...reactReactRules, + ...reactImportRules, + ...reactJestRules, + /** + * React hooks + */ + 'react-hooks/exhaustive-deps': 'error', + // Biome not yet enforcing all parts of this rule https://github.com/biomejs/biome/issues/1984 + 'react-hooks/rules-of-hooks': 'error', + + /** + * Custom + */ + // highlights literals in JSX components w/o translation tags + 'getsentry/jsx-needs-il8n': ['off'], + 'testing-library/render-result-naming-convention': 'off', + 'testing-library/no-unnecessary-act': 'off', + + // Disabled as we have many tests which render as simple validations + 'jest/expect-expect': 'off', + + // Disabled as we have some comment out tests that cannot be + // uncommented due to typescript errors. + 'jest/no-commented-out-tests': 'off', + + // Disabled as we do sometimes have conditional expects + 'jest/no-conditional-expect': 'off', + + // Useful for exporting some test utilities + 'jest/no-export': 'off', + + 'typescript-sort-keys/interface': [ + 'error', + 'asc', + {caseSensitive: true, natural: false, requiredFirst: true}, + ], + + // Disallow importing `import React from 'react'`. This is not needed since + // React 17. We prefer the named imports for potential tree-shaking gains + // in the future. + 'no-restricted-imports': [ + 'error', + { + paths: [ + { + name: 'react', + importNames: ['default'], + message: 'Prefer named React imports (React types DO NOT need imported!)', + }, + ], + }, + ], +}; + const appRules = { /** * emotion rules for v10 @@ -249,7 +579,12 @@ const strictRules = { 'sentry/no-styled-shortcut': ['error'], }; -const extendsList = ['sentry-react', 'plugin:import/typescript']; +const extendsList = [ + 'sentry', + 'plugin:jest/recommended', + 'plugin:jest-dom/recommended', + 'plugin:import/typescript', +]; if (detectDeprecations) { extendsList.push('plugin:deprecation/recommended'); } @@ -259,6 +594,10 @@ module.exports = { extends: extendsList, plugins: [ + 'jest-dom', + 'testing-library', + 'typescript-sort-keys', + 'react-hooks', '@typescript-eslint', '@emotion', 'import', @@ -309,6 +648,9 @@ module.exports = { }, settings: { + react: { + version: '17.0.2', // React version, can not `detect` because of getsentry + }, 'import/parsers': { '@typescript-eslint/parser': ['.ts', '.tsx'], }, @@ -319,6 +661,7 @@ module.exports = { }, rules: { + ...reactRules, ...appRules, ...strictRules, 'react-hooks/rules-of-hooks': 'error', @@ -439,6 +782,7 @@ module.exports = { files: ['static/**/*.spec.{ts,js}', 'tests/js/**/*.{ts,js}'], extends: ['plugin:testing-library/react', ...extendsList], rules: { + ...reactRules, ...appRules, ...strictRules, // TODO(@anonrig): Remove this from eslint-sentry-config diff --git a/package.json b/package.json index 03db820751bee5..61672ad8002d3d 100644 --- a/package.json +++ b/package.json @@ -193,14 +193,17 @@ "benchmark": "^2.1.4", "eslint": "8.57.1", "eslint-config-sentry": "^2.10.0", - "eslint-config-sentry-react": "^2.10.0", "eslint-import-resolver-typescript": "^3.6.3", "eslint-plugin-import": "^2.31.0", "eslint-plugin-jest": "^28.8.3", + "eslint-plugin-jest-dom": "^5.4.0", "eslint-plugin-no-lookahead-lookbehind-regexp": "0.1.0", "eslint-plugin-react": "^7.37.1", + "eslint-plugin-react-hooks": "^4.6.2", "eslint-plugin-sentry": "^2.10.0", "eslint-plugin-simple-import-sort": "^12.1.1", + "eslint-plugin-testing-library": "^6.3.0", + "eslint-plugin-typescript-sort-keys": "^3.3.0", "html-webpack-plugin": "^5.6.0", "jest": "29.7.0", "jest-canvas-mock": "^2.5.2", diff --git a/yarn.lock b/yarn.lock index b0647abc01d5f9..e7f08d783da1f5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6570,17 +6570,6 @@ escodegen@^2.0.0: optionalDependencies: source-map "~0.6.1" -eslint-config-sentry-react@^2.10.0: - version "2.10.0" - resolved "https://registry.yarnpkg.com/eslint-config-sentry-react/-/eslint-config-sentry-react-2.10.0.tgz#0246ea2bb75ce38b75dd3dfc9a403009301d54f7" - integrity sha512-/QbnGOpIdEC9TWbHCpdmd4gDT7HzXtTv5BQUkIcN16z+cM+7lOS5PBd4KVYb1W+QZoFNOzPw7PdpN63YIBCvuA== - dependencies: - eslint-config-sentry "^2.10.0" - eslint-plugin-jest-dom "^5.4.0" - eslint-plugin-react-hooks "^4.6.2" - eslint-plugin-testing-library "^6.3.0" - eslint-plugin-typescript-sort-keys "^3.3.0" - eslint-config-sentry@^2.10.0: version "2.10.0" resolved "https://registry.yarnpkg.com/eslint-config-sentry/-/eslint-config-sentry-2.10.0.tgz#41437ef8481c6375bd1816a912f3629e57b2a6fb" From d9d7adff5514a35c522bd7c8872fc5a2429f2cdc Mon Sep 17 00:00:00 2001 From: Ryan Albrecht Date: Tue, 19 Nov 2024 13:02:02 +0800 Subject: [PATCH 5/7] ref(eslint): Copy in eslint-config-sentry/* rules Note that previously `no-else-return` was defined twice. Once as: ``` 'no-else-return': ['off'], ``` and again as: ``` 'no-else-return': ['error', {allowElseIf: false}], ``` The latter remains --- .eslintrc.js | 228 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 228 insertions(+) diff --git a/.eslintrc.js b/.eslintrc.js index 63a0822009284e..abcd50d361ff69 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -2,6 +2,232 @@ const detectDeprecations = !!process.env.SENTRY_DETECT_DEPRECATIONS; +const baseRules = { + /** + * Strict mode + */ + // https://eslint.org/docs/rules/strict + strict: ['error', 'global'], + + /** + * Variables + */ + // https://eslint.org/docs/rules/no-shadow + 'no-shadow': ['error'], + + // https://eslint.org/docs/rules/no-shadow-restricted-names + 'no-shadow-restricted-names': ['error'], + + // https://eslint.org/docs/rules/no-undef + 'no-undef': ['error'], + + // https://eslint.org/docs/rules/no-unused-vars + 'no-unused-vars': [ + 'error', + { + vars: 'all', + args: 'none', + + // Ignore vars that start with an underscore + // e.g. if you want to omit a property using object spread: + // + // const {name: _name, ...props} = this.props; + // + varsIgnorePattern: '^_', + argsIgnorePattern: '^_', + }, + ], + + // https://eslint.org/docs/rules/no-use-before-define + 'no-use-before-define': ['error', {functions: false}], + + /** + * Possible errors + */ + // https://eslint.org/docs/rules/no-cond-assign + 'no-cond-assign': ['error', 'always'], + + // https://eslint.org/docs/rules/no-console + 'no-console': ['warn'], + + // https://eslint.org/docs/rules/no-alert + 'no-alert': ['error'], + + // https://eslint.org/docs/rules/no-constant-condition + 'no-constant-condition': ['warn'], + + // https://eslint.org/docs/rules/no-empty + 'no-empty': ['error'], + + // https://eslint.org/docs/rules/no-ex-assign + 'no-ex-assign': ['error'], + + // https://eslint.org/docs/rules/no-extra-boolean-cast + 'no-extra-boolean-cast': ['error'], + + // https://eslint.org/docs/rules/no-func-assign + 'no-func-assign': ['error'], + + // https://eslint.org/docs/rules/no-inner-declarations + 'no-inner-declarations': ['error'], + + // https://eslint.org/docs/rules/no-invalid-regexp + 'no-invalid-regexp': ['error'], + + // https://eslint.org/docs/rules/no-irregular-whitespace + 'no-irregular-whitespace': ['error'], + + // https://eslint.org/docs/rules/no-obj-calls + 'no-obj-calls': ['error'], + + // https://eslint.org/docs/rules/no-sparse-arrays + 'no-sparse-arrays': ['error'], + + // https://eslint.org/docs/rules/block-scoped-var + 'block-scoped-var': ['error'], + + /** + * Best practices + */ + // https://eslint.org/docs/rules/consistent-return + 'consistent-return': ['error'], + + // https://eslint.org/docs/rules/default-case + 'default-case': ['error'], + + // https://eslint.org/docs/rules/dot-notation + 'dot-notation': [ + 'error', + { + allowKeywords: true, + }, + ], + + // https://eslint.org/docs/rules/guard-for-in [REVISIT ME] + 'guard-for-in': ['off'], + + // https://eslint.org/docs/rules/no-caller + 'no-caller': ['error'], + + // https://eslint.org/docs/rules/no-eval + 'no-eval': ['error'], + + // https://eslint.org/docs/rules/no-extend-native + 'no-extend-native': ['error'], + + // https://eslint.org/docs/rules/no-extra-bind + 'no-extra-bind': ['error'], + + // https://eslint.org/docs/rules/no-fallthrough + 'no-fallthrough': ['error'], + + // https://eslint.org/docs/rules/no-floating-decimal + 'no-floating-decimal': ['error'], + + // https://eslint.org/docs/rules/no-implied-eval + 'no-implied-eval': ['error'], + + // https://eslint.org/docs/rules/no-lone-blocks + 'no-lone-blocks': ['error'], + + // https://eslint.org/docs/rules/no-loop-func + 'no-loop-func': ['error'], + + // https://eslint.org/docs/rules/no-multi-str + 'no-multi-str': ['error'], + + // https://eslint.org/docs/rules/no-native-reassign + 'no-native-reassign': ['error'], + + // https://eslint.org/docs/rules/no-new + 'no-new': ['error'], + + // https://eslint.org/docs/rules/no-new-func + 'no-new-func': ['error'], + + // https://eslint.org/docs/rules/no-new-wrappers + 'no-new-wrappers': ['error'], + + // https://eslint.org/docs/rules/no-octal + 'no-octal': ['error'], + + // https://eslint.org/docs/rules/no-octal-escape + 'no-octal-escape': ['error'], + + // https://eslint.org/docs/rules/no-param-reassign [REVISIT ME] + 'no-param-reassign': ['off'], + + // https://eslint.org/docs/rules/no-proto + 'no-proto': ['error'], + + // https://eslint.org/docs/rules/no-return-assign + 'no-return-assign': ['error'], + + // https://eslint.org/docs/rules/no-script-url + 'no-script-url': ['error'], + + // https://eslint.org/docs/rules/no-self-compare + 'no-self-compare': ['error'], + + // https://eslint.org/docs/rules/no-sequences + 'no-sequences': ['error'], + + // https://eslint.org/docs/rules/no-throw-literal + 'no-throw-literal': ['error'], + + // https://eslint.org/docs/rules/no-with + 'no-with': ['error'], + + // https://eslint.org/docs/rules/radix + radix: ['error'], + + // https://eslint.org/docs/rules/space-in-brackets.html + 'computed-property-spacing': ['error', 'never'], + + // https://eslint.org/docs/rules/space-in-brackets.html + 'array-bracket-spacing': ['error', 'never'], + + // https://eslint.org/docs/rules/space-in-brackets.html + 'object-curly-spacing': ['error', 'never'], + + // https://eslint.org/docs/rules/object-shorthand + 'object-shorthand': ['error', 'properties'], + + // https://eslint.org/docs/rules/space-infix-ops.html + 'space-infix-ops': ['error'], + + // https://eslint.org/docs/rules/vars-on-top + 'vars-on-top': ['off'], + + // https://eslint.org/docs/rules/wrap-iife + 'wrap-iife': ['error', 'any'], + + // https://eslint.org/docs/rules/array-callback-return + 'array-callback-return': ['error'], + + // https://eslint.org/docs/rules/yoda + yoda: ['error'], + + // https://eslint.org/docs/rules/no-else-return + 'no-else-return': ['error', {allowElseIf: false}], + + // https://eslint.org/docs/rules/require-await + 'require-await': ['error'], + + // https://eslint.org/docs/rules/multiline-comment-style + 'multiline-comment-style': ['error', 'separate-lines'], + + // https://eslint.org/docs/rules/spaced-comment + 'spaced-comment': [ + 'error', + 'always', + { + line: {markers: ['/'], exceptions: ['-', '+']}, + block: {exceptions: ['*'], balanced: true}, + }, + ], +}; + const reactReactRules = { // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/display-name.md 'react/display-name': ['off'], @@ -661,6 +887,7 @@ module.exports = { }, rules: { + ...baseRules, ...reactRules, ...appRules, ...strictRules, @@ -782,6 +1009,7 @@ module.exports = { files: ['static/**/*.spec.{ts,js}', 'tests/js/**/*.{ts,js}'], extends: ['plugin:testing-library/react', ...extendsList], rules: { + ...baseRules, ...reactRules, ...appRules, ...strictRules, From 00fae014631dc8a9eb67cf905bcb39076564b335 Mon Sep 17 00:00:00 2001 From: Ryan Albrecht Date: Wed, 20 Nov 2024 15:24:22 +0800 Subject: [PATCH 6/7] ci(eslint): Remove final eslint-config-sentry package. We still need the plugin package however --- package.json | 1 - yarn.lock | 5 ----- 2 files changed, 6 deletions(-) diff --git a/package.json b/package.json index 61672ad8002d3d..5ed0c3d104ccb5 100644 --- a/package.json +++ b/package.json @@ -192,7 +192,6 @@ "babel-jest": "29.7.0", "benchmark": "^2.1.4", "eslint": "8.57.1", - "eslint-config-sentry": "^2.10.0", "eslint-import-resolver-typescript": "^3.6.3", "eslint-plugin-import": "^2.31.0", "eslint-plugin-jest": "^28.8.3", diff --git a/yarn.lock b/yarn.lock index e7f08d783da1f5..e6a23619306ca5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6570,11 +6570,6 @@ escodegen@^2.0.0: optionalDependencies: source-map "~0.6.1" -eslint-config-sentry@^2.10.0: - version "2.10.0" - resolved "https://registry.yarnpkg.com/eslint-config-sentry/-/eslint-config-sentry-2.10.0.tgz#41437ef8481c6375bd1816a912f3629e57b2a6fb" - integrity sha512-81IE9qoV3A8+KUDYHkwHtj4dO4XufoUwpXHJVi+5H6iuSRRGsDwIIgMegKblwnihomye6FkNxS/sCOHXEK7p3A== - eslint-import-resolver-node@^0.3.9: version "0.3.9" resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz#d4eaac52b8a2e7c3cd1903eb00f7e053356118ac" From 0f993041dc08bed2744e51294abd0e3fcb62174a Mon Sep 17 00:00:00 2001 From: Ryan Albrecht Date: Thu, 21 Nov 2024 10:58:09 +0800 Subject: [PATCH 7/7] Remove last reference to eslint-config-sentry --- .eslintrc.js | 1 - 1 file changed, 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index abcd50d361ff69..8ef646861cd018 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -806,7 +806,6 @@ const strictRules = { }; const extendsList = [ - 'sentry', 'plugin:jest/recommended', 'plugin:jest-dom/recommended', 'plugin:import/typescript',