Browse Source

ref(ts): Fix lint issues that are being masked (#28454)

These are lint issues that will come up in a new version of `@typescript-eslint`. See https://github.com/getsentry/eslint-config-sentry/pull/105
Billy Vong 3 years ago
parent
commit
6ddff6a021

+ 1 - 0
.eslintignore

@@ -7,3 +7,4 @@
 !.github
 !.github
 !.github/workflows/scripts/*
 !.github/workflows/scripts/*
 !.storybook
 !.storybook
+*.d.ts

+ 1 - 1
static/app/components/commitLink.tsx

@@ -15,7 +15,7 @@ type CommitFormatterParameters = {
 type CommitProvider = {
 type CommitProvider = {
   icon: React.ReactNode;
   icon: React.ReactNode;
   providerIds: string[];
   providerIds: string[];
-  commitUrl: (CommitFormatterParameters) => string;
+  commitUrl: (opts: CommitFormatterParameters) => string;
 };
 };
 
 
 // TODO(epurkhiser, jess): This should be moved into plugins.
 // TODO(epurkhiser, jess): This should be moved into plugins.

+ 6 - 5
static/app/components/contextData/index.tsx

@@ -29,6 +29,10 @@ type State = {
   withAnnotatedText: boolean;
   withAnnotatedText: boolean;
 };
 };
 
 
+function getValueWithAnnotatedText(v: Value, meta?: Meta) {
+  return <AnnotatedText value={v} meta={meta} />;
+}
+
 class ContextData extends React.Component<Props, State> {
 class ContextData extends React.Component<Props, State> {
   static defaultProps = {
   static defaultProps = {
     data: null,
     data: null,
@@ -40,11 +44,8 @@ class ContextData extends React.Component<Props, State> {
       this.props;
       this.props;
     const maxDepth = maxDefaultDepth ?? 2;
     const maxDepth = maxDefaultDepth ?? 2;
 
 
-    function getValueWithAnnotatedText(v: Value, meta?: Meta) {
-      return <AnnotatedText value={v} meta={meta} />;
-    }
-
-    /* eslint no-shadow:0 */
+    // TODO(eslint): Remove `no-shadow`
+    // eslint-disable-next-line no-shadow,@typescript-eslint/no-shadow
     function walk(value: Value, depth: number) {
     function walk(value: Value, depth: number) {
       let i = 0;
       let i = 0;
       const children: React.ReactNode[] = [];
       const children: React.ReactNode[] = [];

+ 1 - 0
static/app/utils/theme.tsx

@@ -721,6 +721,7 @@ type MyTheme = Theme;
  * Configure Emotion to use our theme
  * Configure Emotion to use our theme
  */
  */
 declare module '@emotion/react' {
 declare module '@emotion/react' {
+  // eslint-disable-next-line @typescript-eslint/no-shadow
   export interface Theme extends MyTheme {}
   export interface Theme extends MyTheme {}
 }
 }
 
 

+ 2 - 2
static/app/utils/withExperiment.tsx

@@ -100,8 +100,8 @@ function withExperiment<
       }
       }
     }
     }
 
 
-    getProps<P extends ExperimentType>() {
-      return this.props as unknown as ExpectedProps<P>;
+    getProps<Q extends ExperimentType>() {
+      return this.props as unknown as ExpectedProps<Q>;
     }
     }
 
 
     get config() {
     get config() {

+ 2 - 1
static/app/views/settings/project/navigationConfiguration.tsx

@@ -89,7 +89,8 @@ export default function getConfiguration({
         {
         {
           path: `${pathPrefix}/processing-issues/`,
           path: `${pathPrefix}/processing-issues/`,
           title: t('Processing Issues'),
           title: t('Processing Issues'),
-          // eslint-disable-next-line no-shadow
+          // TODO(eslint): Remove `no-shadow`
+          // eslint-disable-next-line no-shadow,@typescript-eslint/no-shadow
           badge: ({project}) => {
           badge: ({project}) => {
             if (!project) {
             if (!project) {
               return null;
               return null;

+ 1 - 1
static/app/views/settings/project/projectOwnership/addCodeOwnerModal.tsx

@@ -132,7 +132,7 @@ class AddCodeOwnerModal extends Component<Props, State> {
     const {codeMappings} = this.props;
     const {codeMappings} = this.props;
     const codeMapping = codeMappings.find(mapping => mapping.id === codeMappingId);
     const codeMapping = codeMappings.find(mapping => mapping.id === codeMappingId);
     const {integrationId, provider} = codeMapping as RepositoryProjectPathConfig;
     const {integrationId, provider} = codeMapping as RepositoryProjectPathConfig;
-    const errActors = errorJSON?.raw?.[0].split('\n').map(el => <p>{el}</p>);
+    const errActors = errorJSON?.raw?.[0].split('\n').map((el, i) => <p key={i}>{el}</p>);
     return (
     return (
       <Alert type="error" icon={<IconNot size="md" />}>
       <Alert type="error" icon={<IconNot size="md" />}>
         {errActors}
         {errActors}

+ 2 - 0
tests/js/setupFramework.ts

@@ -7,6 +7,8 @@ export {};
 
 
 declare global {
 declare global {
   namespace jest {
   namespace jest {
+    // eslint complains that R is unused, but we need to match interface,
+    // eslint-disable-next-line @typescript-eslint/no-unused-vars
     interface Matchers<R> {
     interface Matchers<R> {
       toSnapshot(): CustomMatcherResult;
       toSnapshot(): CustomMatcherResult;
     }
     }

+ 1 - 1
tests/js/spec/views/organizationGroupDetails/groupEventDetails.spec.jsx

@@ -421,7 +421,7 @@ describe('groupEventDetails', () => {
         body: [unpublishedInstall, internalInstall],
         body: [unpublishedInstall, internalInstall],
       });
       });
 
 
-      wrapper = mountWithThemeWrapper();
+      mountWithThemeWrapper();
     });
     });
 
 
     it('loads Integration UI components', () => {
     it('loads Integration UI components', () => {