diff --git a/eslint.config.mjs b/eslint.config.mjs index 1d8f3b8ca4506e..1b341026c09c80 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -236,6 +236,7 @@ export default typescript.config([ 'consistent-return': 'error', 'default-case': 'error', 'dot-notation': 'error', + eqeqeq: 'error', 'guard-for-in': 'off', // TODO(ryan953): Fix violations and enable this rule 'multiline-comment-style': ['error', 'separate-lines'], 'no-alert': 'error', @@ -268,6 +269,7 @@ export default typescript.config([ 'no-sequences': 'error', 'no-throw-literal': 'error', 'object-shorthand': ['error', 'properties'], + radix: 'error', 'require-await': 'error', // Enabled in favor of @typescript-eslint/require-await, which requires type info 'spaced-comment': [ 'error', @@ -277,10 +279,9 @@ export default typescript.config([ block: {exceptions: ['*'], balanced: true}, }, ], + strict: 'error', 'vars-on-top': 'off', 'wrap-iife': ['error', 'any'], - radix: 'error', - strict: 'error', yoda: 'error', // https://github.com/eslint/eslint/blob/main/packages/js/src/configs/eslint-recommended.js @@ -369,6 +370,7 @@ export default typescript.config([ {selector: 'typeLike', format: ['PascalCase'], leadingUnderscore: 'allow'}, {selector: 'enumMember', format: ['UPPER_CASE']}, ], + '@typescript-eslint/no-restricted-types': [ 'error', { @@ -392,6 +394,7 @@ export default typescript.config([ ], '@typescript-eslint/no-shadow': 'error', '@typescript-eslint/no-use-before-define': 'off', // Enabling this will cause a lot of thrash to the git history + '@typescript-eslint/no-useless-empty-export': 'error', }, }, // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/base.ts @@ -406,8 +409,8 @@ export default typescript.config([ // https://typescript-eslint.io/rules/ plugins: {'@typescript-eslint': typescript.plugin}, rules: { - 'no-var': 'off', // TODO(ryan953): Fix violations and delete this line 'prefer-spread': 'off', // TODO(ryan953): Fix violations and delete this line + '@typescript-eslint/prefer-enum-initializers': 'error', // Recommended overrides '@typescript-eslint/ban-ts-comment': 'off', // TODO(ryan953): Fix violations and delete this line @@ -427,7 +430,6 @@ export default typescript.config([ '@typescript-eslint/no-extraneous-class': 'off', // TODO(ryan953): Fix violations and delete this line '@typescript-eslint/no-invalid-void-type': 'off', // TODO(ryan953): Fix violations and delete this line '@typescript-eslint/no-non-null-assertion': 'off', // TODO(ryan953): Fix violations and delete this line - '@typescript-eslint/prefer-literal-enum-member': 'off', // TODO(ryan953): Fix violations and delete this line '@typescript-eslint/unified-signatures': 'off', // TODO(ryan953): Fix violations and delete this line // Stylistic overrides @@ -439,7 +441,6 @@ export default typescript.config([ '@typescript-eslint/no-empty-function': 'off', // TODO(ryan953): Fix violations and delete this line '@typescript-eslint/no-inferrable-types': 'off', // TODO(ryan953): Fix violations and delete this line '@typescript-eslint/prefer-for-of': 'off', // TODO(ryan953): Fix violations and delete this line - '@typescript-eslint/prefer-function-type': 'off', // TODO(ryan953): Fix violations and delete this line // Customization '@typescript-eslint/no-unused-vars': [ @@ -558,26 +559,18 @@ export default typescript.config([ // https://github.com/jest-community/eslint-plugin-jest/tree/main/docs/rules plugins: jest.configs['flat/recommended'].plugins, rules: { + 'jest/max-nested-describe': 'error', + 'jest/no-duplicate-hooks': 'error', + 'jest/no-large-snapshots': ['error', {maxSize: 2000}], // We don't recommend snapshots, but if there are any keep it small + // https://github.com/jest-community/eslint-plugin-jest/blob/main/src/index.ts ...jest.configs['flat/recommended'].rules, ...jest.configs['flat/style'].rules, - // `recommended` set this to warn, we've upgraded to error - 'jest/no-disabled-tests': 'error', - - // `recommended` set this to warn, we've downgraded to 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/expect-expect': 'off', // Disabled as we have many tests which render as simple validations 'jest/no-commented-out-tests': 'off', // TODO(ryan953): Fix violations then delete this line - - // Disabled as we do sometimes have conditional expects 'jest/no-conditional-expect': 'off', // TODO(ryan953): Fix violations then delete this line - - // We don't recommend snapshots, but if there are any keep it small - 'jest/no-large-snapshots': ['error', {maxSize: 2000}], + 'jest/no-disabled-tests': 'error', // `recommended` set this to warn, we've upgraded to error }, }, { diff --git a/package.json b/package.json index edbda0fe68329b..8d650e48337788 100644 --- a/package.json +++ b/package.json @@ -146,7 +146,6 @@ "qrcode.react": "^3.1.0", "query-string": "7.0.1", "react": "18.2.0", - "react-textarea-autosize": "8.5.7", "react-date-range": "^1.4.0", "react-dom": "18.2.0", "react-grid-layout": "^1.3.4", @@ -156,6 +155,7 @@ "react-router-dom": "^6.26.2", "react-select": "4.3.1", "react-sparklines": "1.7.0", + "react-textarea-autosize": "8.5.7", "react-virtualized": "^9.22.5", "reflux": "0.4.1", "screenfull": "^6.0.2", diff --git a/static/app/components/events/autofix/autofixMessageBox.tsx b/static/app/components/events/autofix/autofixMessageBox.tsx index 885d9837ce3193..5205f15c210084 100644 --- a/static/app/components/events/autofix/autofixMessageBox.tsx +++ b/static/app/components/events/autofix/autofixMessageBox.tsx @@ -481,7 +481,7 @@ function AutofixMessageBox({ } if (text.trim() !== '' || allowEmptyMessage) { - if (onSend != null) { + if (onSend !== null) { onSend(text); } else { send({ diff --git a/static/app/utils/profiling/renderers/UIFramesRenderer.tsx b/static/app/utils/profiling/renderers/UIFramesRenderer.tsx index 63180a6de93e92..fb0abc71f09c80 100644 --- a/static/app/utils/profiling/renderers/UIFramesRenderer.tsx +++ b/static/app/utils/profiling/renderers/UIFramesRenderer.tsx @@ -6,14 +6,12 @@ import type {UIFrameNode, UIFrames} from 'sentry/utils/profiling/uiFrames'; import {upperBound} from '../gl/utils'; -export interface UIFramesRendererConstructor { - new ( - canvas: HTMLCanvasElement, - uiFrames: UIFrames, - theme: FlamegraphTheme, - options?: {draw_border: boolean} - ): UIFramesRenderer; -} +export type UIFramesRendererConstructor = new ( + canvas: HTMLCanvasElement, + uiFrames: UIFrames, + theme: FlamegraphTheme, + options?: {draw_border: boolean} +) => UIFramesRenderer; export abstract class UIFramesRenderer { ctx: CanvasRenderingContext2D | WebGLRenderingContext | null = null; diff --git a/static/app/utils/profiling/renderers/flamegraphRenderer.tsx b/static/app/utils/profiling/renderers/flamegraphRenderer.tsx index 2f60b22e883b34..d07f68e2eaa5a4 100644 --- a/static/app/utils/profiling/renderers/flamegraphRenderer.tsx +++ b/static/app/utils/profiling/renderers/flamegraphRenderer.tsx @@ -17,14 +17,12 @@ export const DEFAULT_FLAMEGRAPH_RENDERER_OPTIONS: FlamegraphRendererOptions = { draw_border: false, }; -export interface FlamegraphRendererConstructor { - new ( - canvas: HTMLCanvasElement, - flamegraph: Flamegraph, - theme: FlamegraphTheme, - options?: FlamegraphRendererOptions - ): FlamegraphRenderer; -} +export type FlamegraphRendererConstructor = new ( + canvas: HTMLCanvasElement, + flamegraph: Flamegraph, + theme: FlamegraphTheme, + options?: FlamegraphRendererOptions +) => FlamegraphRenderer; export abstract class FlamegraphRenderer { ctx: CanvasRenderingContext2D | WebGLRenderingContext | null = null; diff --git a/static/app/utils/statics-setup.tsx b/static/app/utils/statics-setup.tsx index 6414e08c63724d..3ece75819321c9 100644 --- a/static/app/utils/statics-setup.tsx +++ b/static/app/utils/statics-setup.tsx @@ -1,7 +1,7 @@ /* eslint no-native-reassign:0 */ // biome-ignore lint/style/noVar: Not required -declare var __webpack_public_path__: string; +declare var __webpack_public_path__: string; // eslint-disable-line no-var /** * Set the webpack public path at runtime. This is necessary so that imports diff --git a/static/app/views/alerts/rules/issue/setupMessagingIntegrationButton.tsx b/static/app/views/alerts/rules/issue/setupMessagingIntegrationButton.tsx index 6eef65e5e55403..30295401b86bd7 100644 --- a/static/app/views/alerts/rules/issue/setupMessagingIntegrationButton.tsx +++ b/static/app/views/alerts/rules/issue/setupMessagingIntegrationButton.tsx @@ -63,7 +63,7 @@ function SetupMessagingIntegrationButton({ messagingIntegrationsQuery.isError || integrationProvidersQuery.some(({isPending}) => isPending) || integrationProvidersQuery.some(({isError}) => isError) || - integrationProvidersQuery[0]!.data == null + integrationProvidersQuery[0]!.data === undefined ) { return null; } diff --git a/static/app/views/insights/mobile/screens/utils.ts b/static/app/views/insights/mobile/screens/utils.ts index 0e7d02535019ce..a75706ea4f0203 100644 --- a/static/app/views/insights/mobile/screens/utils.ts +++ b/static/app/views/insights/mobile/screens/utils.ts @@ -5,7 +5,7 @@ import {formatPercentage} from 'sentry/utils/number/formatPercentage'; import {VitalState} from 'sentry/views/performance/vitalDetail/utils'; const formatMetricValue = (metric: MetricValue, field?: string | undefined): string => { - if (metric.value == null) { + if (metric.value === undefined) { return '-'; } if (typeof metric.value === 'number' && metric.type === 'duration' && metric.unit) { diff --git a/static/app/views/issueList/utils.tsx b/static/app/views/issueList/utils.tsx index a43e94f937bd4d..97a1750443cfad 100644 --- a/static/app/views/issueList/utils.tsx +++ b/static/app/views/issueList/utils.tsx @@ -10,7 +10,7 @@ import type {Organization} from 'sentry/types/organization'; export enum Query { FOR_REVIEW = 'is:unresolved is:for_review assigned_or_suggested:[me, my_teams, none]', // biome-ignore lint/style/useLiteralEnumMembers: Disable for maintenance cost. - PRIORITIZED = DEFAULT_QUERY, + PRIORITIZED = DEFAULT_QUERY, // eslint-disable-line @typescript-eslint/prefer-literal-enum-member UNRESOLVED = 'is:unresolved', IGNORED = 'is:ignored', NEW = 'is:new', diff --git a/tests/js/setup.ts b/tests/js/setup.ts index c75a70621b8602..737529f4233d36 100644 --- a/tests/js/setup.ts +++ b/tests/js/setup.ts @@ -159,10 +159,12 @@ declare global { /** * Generates a promise that resolves on the next macro-task */ + // eslint-disable-next-line no-var var tick: () => Promise; /** * Used to mock API requests */ + // eslint-disable-next-line no-var var MockApiClient: typeof Client; }