Browse Source

ci(eslint): Enable reportUnusedDisableDirectives (#82723)

<!-- Describe your PR here. -->
Ryan Albrecht 2 months ago
parent
commit
a91bd1df94

+ 4 - 6
eslint.config.mjs

@@ -19,6 +19,7 @@ import testingLibrary from 'eslint-plugin-testing-library';
 import typescriptSortKeys from 'eslint-plugin-typescript-sort-keys';
 import globals from 'globals';
 import invariant from 'invariant';
+// biome-ignore lint/correctness/noNodejsModules: Need to get the list of things!
 import {builtinModules} from 'node:module';
 import typescript from 'typescript-eslint';
 
@@ -652,7 +653,6 @@ const appRules = {
         ['^\\u0000'],
 
         // Node.js builtins.
-        // biome-ignore lint/correctness/noNodejsModules: Need to get the list of things!
         [`^(${builtinModules.join('|')})(/|$)`],
 
         // Packages. `react` related packages come first.
@@ -792,9 +792,7 @@ export default typescript.config([
         experimentalDecorators: undefined,
 
         // https://typescript-eslint.io/packages/parser/#jsdocparsingmode
-        jsDocParsingMode: Boolean(process.env.SENTRY_DETECT_DEPRECATIONS)
-          ? 'all'
-          : 'none',
+        jsDocParsingMode: process.env.SENTRY_DETECT_DEPRECATIONS ? 'all' : 'none',
 
         // https://typescript-eslint.io/packages/parser/#project
         project: './tsconfig.json',
@@ -807,7 +805,7 @@ export default typescript.config([
     },
     linterOptions: {
       noInlineConfig: false,
-      reportUnusedDisableDirectives: 'off', // TODO(ryan953): set to 'error' and autofix
+      reportUnusedDisableDirectives: 'error',
     },
     // TODO: move these potential overrides and plugin-specific rules into the
     // corresponding configuration object where the plugin is initially included
@@ -907,7 +905,7 @@ export default typescript.config([
   {
     name: 'deprecations',
     rules: {
-      '@typescript-eslint/no-deprecated': Boolean(process.env.SENTRY_DETECT_DEPRECATIONS)
+      '@typescript-eslint/no-deprecated': process.env.SENTRY_DETECT_DEPRECATIONS
         ? 'error'
         : 'off',
     },

+ 0 - 1
static/app/chartcuterie/config.tsx

@@ -8,7 +8,6 @@
  * into the configuration file loaded by the service.
  */
 
-// eslint-disable-next-line import/no-named-default
 import {discoverCharts} from './discover';
 import {metricAlertCharts} from './metricAlert';
 import {performanceCharts} from './performance';

+ 1 - 1
static/app/components/activity/note/inputWithStorage.tsx

@@ -129,7 +129,7 @@ function NoteInputWithStorage({
       }
 
       // Remove `itemKey` from stored object and save to storage
-      // eslint-disable-next-line no-unused-vars
+
       const {[itemKey]: _oldItem, ...newStorageObj} = storageObj;
       saveToStorage(storageKey, newStorageObj);
     },

+ 0 - 1
static/app/components/autoplayVideo.spec.tsx

@@ -1,4 +1,3 @@
-// eslint-disable-next-line no-restricted-imports
 import * as React from 'react';
 
 import {render, screen} from 'sentry-test/reactTestingLibrary';

+ 0 - 2
static/app/components/confirm.stories.tsx

@@ -1,5 +1,3 @@
-/* eslint-disable no-console */
-
 import {Fragment, useState} from 'react';
 import styled from '@emotion/styled';
 

+ 0 - 1
static/app/components/deprecatedSmartSearchBar/actionButton.tsx

@@ -1,4 +1,3 @@
-// eslint-disable-next-line no-restricted-imports
 import styled from '@emotion/styled';
 
 import {Button} from 'sentry/components/button';

+ 0 - 1
static/app/components/dropdownMenu/index.spec.tsx

@@ -319,7 +319,6 @@ describe('DropdownMenu', function () {
     // JSDOM throws an error on navigation to random urls
     expect(errorSpy).toHaveBeenCalledTimes(1);
 
-    // eslint-disable-next-line no-console
     errorSpy.mockRestore();
   });
 });

+ 37 - 41
static/app/components/events/eventProcessingErrors.tsx

@@ -45,47 +45,43 @@ export default function EventErrorCard({
 function EventErrorDescription({error}: {error: ErrorMessage}) {
   const {title, data: errorData} = error;
 
-  const cleanedData = useMemo(
-    () => {
-      const data = errorData || {};
-      if (data.message === 'None') {
-        // Python ensures a message string, but "None" doesn't make sense here
-        delete data.message;
-      }
-
-      if (typeof data.image_path === 'string') {
-        // Separate the image name for readability
-        const separator = /^([a-z]:\\|\\\\)/i.test(data.image_path) ? '\\' : '/';
-        const path = data.image_path.split(separator);
-        data.image_name = path.splice(-1, 1)[0];
-        data.image_path = path.length ? path.join(separator) + separator : '';
-      }
-
-      if (typeof data.server_time === 'string' && typeof data.sdk_time === 'string') {
-        data.message = t(
-          'Adjusted timestamps by %s',
-          moment
-            .duration(moment.utc(data.server_time).diff(moment.utc(data.sdk_time)))
-            .humanize()
-        );
-      }
-
-      return Object.entries(data)
-        .map(([key, value]) => ({
-          key,
-          value,
-          subject: keyMapping[key] || startCase(key),
-        }))
-        .filter(d => {
-          if (!d.value) {
-            return true;
-          }
-          return !!d.value;
-        });
-    },
-    // eslint-disable-next-line react-hooks/exhaustive-deps
-    [errorData]
-  );
+  const cleanedData = useMemo(() => {
+    const data = errorData || {};
+    if (data.message === 'None') {
+      // Python ensures a message string, but "None" doesn't make sense here
+      delete data.message;
+    }
+
+    if (typeof data.image_path === 'string') {
+      // Separate the image name for readability
+      const separator = /^([a-z]:\\|\\\\)/i.test(data.image_path) ? '\\' : '/';
+      const path = data.image_path.split(separator);
+      data.image_name = path.splice(-1, 1)[0];
+      data.image_path = path.length ? path.join(separator) + separator : '';
+    }
+
+    if (typeof data.server_time === 'string' && typeof data.sdk_time === 'string') {
+      data.message = t(
+        'Adjusted timestamps by %s',
+        moment
+          .duration(moment.utc(data.server_time).diff(moment.utc(data.sdk_time)))
+          .humanize()
+      );
+    }
+
+    return Object.entries(data)
+      .map(([key, value]) => ({
+        key,
+        value,
+        subject: keyMapping[key] || startCase(key),
+      }))
+      .filter(d => {
+        if (!d.value) {
+          return true;
+        }
+        return !!d.value;
+      });
+  }, [errorData]);
 
   return <EventErrorCard title={title} data={cleanedData} />;
 }

+ 0 - 1
static/app/components/events/eventTagsAndScreenshot/screenshot/screenshotPagination.tsx

@@ -1,4 +1,3 @@
-// eslint-disable-next-line no-restricted-imports
 import type {ReactEventHandler} from 'react';
 import styled from '@emotion/styled';
 

+ 0 - 1
static/app/components/events/interfaces/crashContent/exception/actionableItems.tsx

@@ -291,7 +291,6 @@ function ExpandableErrorList({handleExpandClick, errorList}: ExpandableErrorList
         });
     });
     return cleaned;
-    // eslint-disable-next-line react-hooks/exhaustive-deps
   }, [errorDataList]);
 
   return (

Some files were not shown because too many files changed in this diff