mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 15:12:02 +00:00
disable slow eslint rules, remove unused disable directives (#57788)
* disable slow eslint rules, remove unused disable directives Disabling these eslint rules makes saving significantly faster. These rules are not worthless, but they are usually ignored anyway, and I can't recall a specific instance when they would have caught a bug. I am proposing we disable them and then set a checkpoint in 14 days to rerun eslint with the rules enabled and see if they would have caught any bad practices. In the meantime, we will all benefit from instant saves (with eslint fixes) instead of waiting 3-5 seconds or more after each save in VS Code, which is destructive to productivity. * upgrade eslint
This commit is contained in:
parent
ababbb9dcf
commit
c0442a2e9f
11
.eslintrc.js
11
.eslintrc.js
@ -52,6 +52,15 @@ const config = {
|
||||
],
|
||||
// This converts 'import {type foo} from ...' to 'import type {foo} from ...'
|
||||
'@typescript-eslint/no-import-type-side-effects': ['warn'],
|
||||
|
||||
// These rules are very slow on-save.
|
||||
'@typescript-eslint/no-unsafe-assignment': 'off',
|
||||
'@typescript-eslint/unbound-method': 'off',
|
||||
'@typescript-eslint/no-misused-promises': 'off',
|
||||
'@typescript-eslint/no-unnecessary-qualifier': 'off',
|
||||
'@typescript-eslint/no-unused-vars': 'off', // also duplicated by tsconfig noUnused{Locals,Parameters}
|
||||
'etc/no-deprecated': 'off',
|
||||
|
||||
'no-restricted-imports': [
|
||||
'error',
|
||||
{
|
||||
@ -244,7 +253,7 @@ See https://handbook.sourcegraph.com/community/faq#is-all-of-sourcegraph-open-so
|
||||
},
|
||||
],
|
||||
'import/order': 'off',
|
||||
'etc/no-deprecated': 'off',
|
||||
'unicorn/expiring-todo-comments': 'off',
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
|
||||
@ -261,7 +261,7 @@ export function searchQueryAutocompletion(sources: StandardSuggestionSource[], n
|
||||
key: 'Enter',
|
||||
run(view) {
|
||||
const selected = selectedCompletion(view.state)
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any
|
||||
const url = (selected as any)?.url
|
||||
if (navigate && typeof url === 'string') {
|
||||
navigate(url)
|
||||
|
||||
@ -96,7 +96,7 @@ async function main(): Promise<void> {
|
||||
|
||||
let previousSubscription: Subscription
|
||||
subscriptions.add(
|
||||
// eslint-disable-next-line rxjs/no-async-subscribe, @typescript-eslint/no-misused-promises
|
||||
// eslint-disable-next-line rxjs/no-async-subscribe
|
||||
observeSourcegraphURL(IS_EXTENSION).subscribe(async sourcegraphURL => {
|
||||
if (previousSubscription) {
|
||||
console.log('Sourcegraph detached code navigation')
|
||||
|
||||
@ -39,7 +39,7 @@ const createFeatureFlagStorage = ({ get, set }: FeatureFlagUtilities): FeatureFl
|
||||
async toggle<K extends keyof FeatureFlags>(key: K): Promise<boolean> {
|
||||
const value = await get(key)
|
||||
await set(key, !value)
|
||||
/* eslint-disable @typescript-eslint/return-await */
|
||||
|
||||
return !value
|
||||
},
|
||||
})
|
||||
|
||||
@ -61,7 +61,6 @@ export const stylePlugin: esbuild.Plugin = {
|
||||
|
||||
const isCSSModule = outputPath.endsWith('.module.css')
|
||||
const result = await postcss(
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
isCSSModule ? [...postcssConfig.plugins, modulesPlugin] : postcssConfig.plugins
|
||||
).process(css, {
|
||||
from: outputPath,
|
||||
@ -147,7 +146,7 @@ export const stylePlugin: esbuild.Plugin = {
|
||||
build.onResolve({ filter: /\.css$/, namespace: 'css-module' }, args => ({
|
||||
path: args.path,
|
||||
namespace: 'css',
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
pluginData: { contents: args.pluginData?.contents },
|
||||
}))
|
||||
|
||||
@ -159,13 +158,13 @@ import ${JSON.stringify(args.path)}
|
||||
export default ${modulesMap.get(args.path) || '{}'}`,
|
||||
loader: 'js',
|
||||
resolveDir: path.dirname(args.path),
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
|
||||
pluginData: args.pluginData,
|
||||
}))
|
||||
|
||||
// Load the contents of all CSS files. The transformed CSS was passed through `pluginData.contents`.
|
||||
build.onLoad({ filter: /\.css$/, namespace: 'css' }, args => ({
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
contents: args.pluginData?.contents,
|
||||
resolveDir: path.dirname(args.path),
|
||||
loader: 'css',
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// eslint-disable-next-line unicorn/prevent-abbreviations
|
||||
export interface HasGetBoundingClientRect {
|
||||
getBoundingClientRect: () => { left: number; top: number; bottom: number; height: number }
|
||||
}
|
||||
|
||||
@ -64,7 +64,6 @@ const createGitHubCodeView = (): CodeViewProps => {
|
||||
codeView.innerHTML = GITHUB_CODE_TABLE
|
||||
codeView.style.clear = 'both'
|
||||
|
||||
// eslint-disable-next-line unicorn/consistent-function-scoping
|
||||
const getCodeElementFromTarget = (target: HTMLElement): HTMLElement | null => {
|
||||
const row = target.closest('tr')
|
||||
if (!row) {
|
||||
@ -81,7 +80,6 @@ const createGitHubCodeView = (): CodeViewProps => {
|
||||
return codeCell
|
||||
}
|
||||
|
||||
// eslint-disable-next-line unicorn/consistent-function-scoping
|
||||
const getCodeElementFromLineNumber = (b: HTMLElement, line: number): HTMLElement | null => {
|
||||
const numberCell = b.querySelector(`[data-line-number="${line}"]`)
|
||||
if (!numberCell) {
|
||||
@ -96,7 +94,6 @@ const createGitHubCodeView = (): CodeViewProps => {
|
||||
return row.children.item(1) as HTMLElement | null
|
||||
}
|
||||
|
||||
// eslint-disable-next-line unicorn/consistent-function-scoping
|
||||
const getLineNumberFromCodeElement = (codeCell: HTMLElement): number => {
|
||||
const row = codeCell.closest('tr')
|
||||
if (!row) {
|
||||
@ -127,7 +124,6 @@ const createSourcegraphCodeView = (): CodeViewProps => {
|
||||
codeView.innerHTML = SOURCEGRAPH_CODE_TABLE
|
||||
codeView.style.clear = 'both'
|
||||
|
||||
// eslint-disable-next-line unicorn/consistent-function-scoping
|
||||
const getCodeElementFromTarget = (target: HTMLElement): HTMLElement | null => {
|
||||
const row = target.closest('tr')
|
||||
if (!row) {
|
||||
@ -144,7 +140,6 @@ const createSourcegraphCodeView = (): CodeViewProps => {
|
||||
return codeCell
|
||||
}
|
||||
|
||||
// eslint-disable-next-line unicorn/consistent-function-scoping
|
||||
const getCodeElementFromLineNumber = (b: HTMLElement, line: number): HTMLElement | null => {
|
||||
const numberCell = b.querySelector(`[data-line="${line}"]`)
|
||||
if (!numberCell) {
|
||||
@ -159,7 +154,6 @@ const createSourcegraphCodeView = (): CodeViewProps => {
|
||||
return row.children.item(1) as HTMLElement | null
|
||||
}
|
||||
|
||||
// eslint-disable-next-line unicorn/consistent-function-scoping
|
||||
const getLineNumberFromCodeElement = (codeCell: HTMLElement): number => {
|
||||
const row = codeCell.closest('tr')
|
||||
if (!row) {
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-use-before-define */
|
||||
/* eslint rxjs/no-internal: warn */
|
||||
import {
|
||||
asapScheduler,
|
||||
|
||||
@ -4,8 +4,6 @@
|
||||
* @template U The type to check for (explicitly specify this)
|
||||
* @template T The actual type (inferred, don't specify this)
|
||||
*/
|
||||
// needed for type parameter
|
||||
// eslint-disable-next-line unicorn/consistent-function-scoping
|
||||
export const subtypeOf =
|
||||
<U>() =>
|
||||
<T extends U>(value: T): T =>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
"description": "Custom rules and recommended config for consumers of the Wildcard component library",
|
||||
"main": "lib/index.js",
|
||||
"peerDependencies": {
|
||||
"eslint-plugin-react": "^7.32.1"
|
||||
"eslint-plugin-react": "^7.33.2"
|
||||
},
|
||||
"license": "Apache-2.0"
|
||||
}
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
import path from 'path'
|
||||
|
||||
import express from 'express'
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
// This file is a fork from SearchBox.tsx and contains JetBrains specific UI changes
|
||||
/* eslint-disable no-restricted-imports */
|
||||
|
||||
import React, { useCallback, useState } from 'react'
|
||||
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
// This file is a fork from Toggles.tsx and contains JetBrains specific UI changes
|
||||
/* eslint-disable no-restricted-imports */
|
||||
|
||||
import React, { useCallback, useMemo } from 'react'
|
||||
|
||||
|
||||
@ -52,13 +52,13 @@ class SpecFileReporter extends mocha.reporters.Spec {
|
||||
// We now want the Spec reporter (aka epilogue) to be written to a file, but Spec uses the console defined on Base!
|
||||
// So we swap out the consoleLog defined on Base with our customLog one
|
||||
// https://sourcegraph.com/github.com/mochajs/mocha/-/blob/lib/reporters/base.js?L43:5
|
||||
// eslint-disable-next-line @typescript-eslint/unbound-method
|
||||
|
||||
mocha.reporters.Base.consoleLog = customConsole.log
|
||||
// Generate report using custom logger
|
||||
// https://mochajs.org/api/reporters_base.js.html#line367
|
||||
super.epilogue()
|
||||
// The report has been written to a file, so now we swap the consoleLog back to the originalConsole logger
|
||||
// eslint-disable-next-line @typescript-eslint/unbound-method
|
||||
|
||||
mocha.reporters.Base.consoleLog = originalConsoleLog
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@ module.exports = class TestEnvironmentGlobal extends TestEnvironment {
|
||||
|
||||
// jsdom doesn't support document.queryCommandSupported(), needed for monaco-editor.
|
||||
// https://github.com/testing-library/react-testing-library/issues/546
|
||||
// eslint-disable-next-line @typescript-eslint/unbound-method
|
||||
|
||||
this.dom.window.document.queryCommandSupported = () => false
|
||||
|
||||
this.global.jsdom = this.dom
|
||||
|
||||
@ -1,9 +1,6 @@
|
||||
/* eslint-disable unicorn/prevent-abbreviations */
|
||||
|
||||
// JSDOM does not have support for DOMRect, needed for tooltips.
|
||||
// https://github.com/radix-ui/primitives/issues/420#issuecomment-771615182
|
||||
if ('DOMRect' in window === false) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
window.DOMRect = {
|
||||
fromRect: () => ({ top: 0, left: 0, bottom: 0, right: 0, width: 0, height: 0 }),
|
||||
} as any
|
||||
|
||||
@ -104,7 +104,7 @@ export const wrapRemoteObservable = <T>(
|
||||
* Must be used as the first parameter to `pipe()`, because the source must be a `RemoteObservable`.
|
||||
*/
|
||||
// needed for the type parameter
|
||||
// eslint-disable-next-line unicorn/consistent-function-scoping
|
||||
|
||||
export const finallyReleaseProxy =
|
||||
<T>() =>
|
||||
(source: Observable<T> & Partial<ProxySubscribed>): Observable<T> => {
|
||||
|
||||
@ -38,7 +38,7 @@ export function computeContext<T>(
|
||||
// reflect the types massively increases the impl complexity without any actual benefit
|
||||
// to the caller.
|
||||
//
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
|
||||
data[`config.${key}`] = value
|
||||
}
|
||||
}
|
||||
@ -68,14 +68,13 @@ export function computeContext<T>(
|
||||
data['component.type'] = 'CodeEditor'
|
||||
// See above for why we disable eslint rules related to `any`.
|
||||
//
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
|
||||
data['component.selections'] = component.selections as any // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
if (component.selections.length > 0) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
data['component.selection'] = (component.selections[0] || null) as any // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
|
||||
data['component.selection.start'] = (component.selections[0] ? component.selections[0].start : null) as any // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
|
||||
data['component.selection.end'] = (component.selections[0] ? component.selections[0].end : null) as any // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
data['component.selection.start.line'] = component.selections[0] ? component.selections[0].start.line : null
|
||||
data['component.selection.start.character'] = component.selections[0]
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import pTimeout from 'p-timeout'
|
||||
import { Subject } from 'rxjs'
|
||||
|
||||
@ -54,7 +54,7 @@ export const syncRemoteSubscription = (
|
||||
subscriptionPromise: Promise<Remote<Unsubscribable & ProxyMarked>>
|
||||
): Subscription =>
|
||||
// We cannot pass the proxy subscription directly to Rx because it is a Proxy that looks like a function
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||
|
||||
new Subscription(async () => {
|
||||
const subscriptionProxy = await subscriptionPromise
|
||||
await subscriptionProxy.unsubscribe()
|
||||
|
||||
@ -278,7 +278,7 @@ export function injectNewCodeintel(
|
||||
|
||||
return new Proxy(old, {
|
||||
get(target, prop) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any
|
||||
const codeintelFunction = (codeintelOverrides as any)[prop]
|
||||
if (codeintelFunction) {
|
||||
return codeintelFunction
|
||||
|
||||
@ -128,7 +128,7 @@ export const WrapDisabledIcon: React.FunctionComponent<React.PropsWithChildren<I
|
||||
)
|
||||
|
||||
// TODO: Rename name when refresh design is complete
|
||||
// eslint-disable-next-line react/display-name
|
||||
|
||||
export const CloudAlertIconRefresh = React.forwardRef((props, reference) => (
|
||||
<svg
|
||||
ref={reference}
|
||||
@ -158,7 +158,7 @@ export const CloudAlertIconRefresh = React.forwardRef((props, reference) => (
|
||||
CloudAlertIconRefresh.displayName = 'CloudAlertIconRefresh'
|
||||
|
||||
// TODO: Rename name when refresh design is complete
|
||||
// eslint-disable-next-line react/display-name
|
||||
|
||||
export const CloudSyncIconRefresh = React.forwardRef((props, reference) => (
|
||||
<svg
|
||||
ref={reference}
|
||||
@ -214,7 +214,7 @@ export const CloudInfoIconRefresh = React.forwardRef((props, reference) => (
|
||||
CloudInfoIconRefresh.displayName = 'CloudInfoIconRefresh'
|
||||
|
||||
// TODO: Rename name when refresh design is complete
|
||||
// eslint-disable-next-line react/display-name
|
||||
|
||||
export const CloudCheckIconRefresh = React.forwardRef((props, reference) => (
|
||||
<svg
|
||||
ref={reference}
|
||||
|
||||
@ -10,7 +10,7 @@ import type { ModifierKey } from './keys'
|
||||
describe('ShortcutManager', () => {
|
||||
// We only want to preserve the original implementation, not call it as a
|
||||
// function.
|
||||
// eslint-disable-next-line @typescript-eslint/unbound-method
|
||||
|
||||
const originalGetModifierState = KeyboardEvent.prototype.getModifierState
|
||||
|
||||
beforeAll(() => {
|
||||
|
||||
@ -80,7 +80,6 @@ export async function migrateLocalStorageToTemporarySettings(storage: TemporaryS
|
||||
const temporarySetting = await storage.get(migration.temporarySettingsKey).pipe(take(1)).toPromise()
|
||||
if (typeof temporarySetting === 'undefined') {
|
||||
try {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
const value = parse(migration.type, localStorage.getItem(migration.localStorageKey))
|
||||
if (!value) {
|
||||
continue
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
import childProcess from 'child_process'
|
||||
import fs from 'fs'
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
|
||||
import childProcess from 'child_process'
|
||||
import fs from 'fs'
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
|
||||
import childProcess from 'child_process'
|
||||
import fs from 'fs'
|
||||
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
import * as vscode from 'vscode'
|
||||
|
||||
import { getBlobContent } from '../backend/blobContent'
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
import {
|
||||
authentication,
|
||||
type AuthenticationProvider,
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-misused-promises */
|
||||
import React, { useEffect, useState } from 'react'
|
||||
|
||||
import { VSCodeButton } from '@vscode/webview-ui-toolkit/react'
|
||||
|
||||
@ -50,7 +50,7 @@ function extractZip(zipfile: ZipFile, targetPath: string): Promise<void> {
|
||||
}
|
||||
})
|
||||
zipfile.readEntry()
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||
|
||||
zipfile.on('entry', async (entry: Entry) => {
|
||||
const fileName = entry.fileName // .replace(options.sourcePathRegex, '')
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@ export function getAPIProxySettings(options: GetAPIProxySettingsOptions): ProxyS
|
||||
cookieDomainRewrite: '',
|
||||
// Prevent automatic call of res.end() in `onProxyRes`. It is handled by `responseInterceptor`.
|
||||
selfHandleResponse: true,
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises, @typescript-eslint/require-await
|
||||
// eslint-disable-next-line @typescript-eslint/require-await
|
||||
onProxyRes: conditionalResponseInterceptor(STREAMING_ENDPOINTS, async (responseBuffer, proxyRes) => {
|
||||
// Propagate cookies to enable authentication on the remote server.
|
||||
if (proxyRes.headers['set-cookie']) {
|
||||
|
||||
@ -12,7 +12,6 @@ const { SITE_CONFIG_PATH } = ENVIRONMENT_CONFIG
|
||||
// Get site-config from `SITE_CONFIG_PATH` as an object with camel cased keys.
|
||||
export const getSiteConfig = (): Partial<SourcegraphContext> => {
|
||||
try {
|
||||
// eslint-disable-next-line no-sync
|
||||
const siteConfig = parse(fs.readFileSync(SITE_CONFIG_PATH, 'utf-8'))
|
||||
|
||||
return lodash.mapKeys(siteConfig, (_value, key) => lodash.camelCase(key))
|
||||
|
||||
@ -92,7 +92,7 @@ export const usePageSwitcherPagination = <TResult, TVariables extends PaginatedC
|
||||
|
||||
// TODO(philipp-spiess): Find out why Omit<TVariables, "first" | ...> & { first: number, ... }
|
||||
// does not work here and get rid of the any cast.
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
|
||||
const queryVariables: TVariables = {
|
||||
...variables,
|
||||
...initialPaginationArgs,
|
||||
|
||||
@ -7,7 +7,6 @@ import { waitForNextApolloResponse } from '@sourcegraph/shared/src/testing/apoll
|
||||
import { FuzzyWrapper, FUZZY_FILES_MOCK } from './FuzzyFinder.mocks'
|
||||
|
||||
describe('FuzzyModal', () => {
|
||||
// eslint-disable-next-line @typescript-eslint/unbound-method
|
||||
const originalScrollIntoView = Element.prototype.scrollIntoView
|
||||
beforeAll(() => {
|
||||
// scrollIntoView is not supported in JSDOM, so we mock it for this one test
|
||||
|
||||
@ -3,7 +3,6 @@ import React from 'react'
|
||||
import type { JSONSchemaType } from 'ajv'
|
||||
import classNames from 'classnames'
|
||||
import { cloneDeep } from 'lodash'
|
||||
// eslint-disable-next-line import/order
|
||||
import type * as monaco from 'monaco-editor/esm/vs/editor/editor.api'
|
||||
|
||||
import 'monaco-yaml'
|
||||
|
||||
@ -104,7 +104,6 @@ const buildMocks = (batchSpec: BatchSpecExecutionFields): MockedResponses => [
|
||||
|
||||
const buildWorkspacesQuery =
|
||||
(workspaceFields?: Partial<VisibleBatchSpecWorkspaceFields>): typeof _queryWorkspacesList =>
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
() =>
|
||||
of(mockWorkspaces(50, workspaceFields).node.workspaceResolution!.workspaces)
|
||||
|
||||
|
||||
@ -375,7 +375,6 @@ export const CodeIntelPreciseIndexesPage: FunctionComponent<CodeIntelPreciseInde
|
||||
className="mr-2"
|
||||
variant="secondary"
|
||||
disabled={selection !== 'all' && selection.size === 0}
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||
onClick={onReindex}
|
||||
>
|
||||
<Icon aria-hidden={true} svgPath={mdiRedo} /> Mark{' '}
|
||||
@ -399,7 +398,6 @@ export const CodeIntelPreciseIndexesPage: FunctionComponent<CodeIntelPreciseInde
|
||||
className="mr-2"
|
||||
variant="danger"
|
||||
disabled={selection !== 'all' && selection.size === 0}
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||
onClick={onDelete}
|
||||
>
|
||||
<Icon aria-hidden={true} svgPath={mdiDelete} /> Delete{' '}
|
||||
|
||||
@ -37,7 +37,6 @@ export const FormColorInput: React.FunctionComponent<React.PropsWithChildren<For
|
||||
{COLORS_KEYS.map(key => (
|
||||
<Label
|
||||
key={key}
|
||||
/* eslint-disable-next-line react/forbid-dom-props */
|
||||
style={{ color: DATA_SERIES_COLORS[key] }}
|
||||
title={startCase(key.toLocaleLowerCase())}
|
||||
className={styles.formColorPickerColorBlock}
|
||||
|
||||
@ -232,3 +232,4 @@ export const BackendInsightView = forwardRef<HTMLElement, BackendInsightProps>((
|
||||
</InsightCard>
|
||||
)
|
||||
})
|
||||
BackendInsightView.displayName = 'BackendInsightView'
|
||||
|
||||
@ -29,7 +29,6 @@ export function useInsightData<D>(
|
||||
|
||||
useEffect(() => {
|
||||
if (hasIntersected) {
|
||||
// eslint-disable-next-line @typescript-eslint/unbound-method
|
||||
const { unsubscribe } = query(request)
|
||||
|
||||
return unsubscribe
|
||||
|
||||
@ -68,7 +68,7 @@ const MAX_PARALLEL_QUERIES = 3
|
||||
* these hooks unit tests.
|
||||
*/
|
||||
/* eslint-disable react-hooks/rules-of-hooks */
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type,@typescript-eslint/explicit-module-boundary-types
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
||||
export function createUseParallelRequestsHook<T>({ maxRequests } = { maxRequests: MAX_PARALLEL_QUERIES }) {
|
||||
const requests = new Subject<Request<T>>()
|
||||
const cancelledRequests = new Set<Request<T>>()
|
||||
|
||||
@ -139,6 +139,7 @@ export const CodeInsightsExamplesSliderItem = forwardRef((props, publicReference
|
||||
|
||||
return <Comp ref={mergedReference} {...attributes} />
|
||||
}) as ForwardReferenceComponent<'div', CodeInsightsExamplesSliderItemProps>
|
||||
CodeInsightsExamplesSliderItem.displayName = 'CodeInsightsExamplesSliderItem'
|
||||
|
||||
interface ArrowIconProps {
|
||||
side: 'right' | 'left'
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import { FC } from 'react'
|
||||
import type { FC } from 'react'
|
||||
|
||||
import { Badge, BadgeVariantType } from '@sourcegraph/wildcard'
|
||||
import { Badge, type BadgeVariantType } from '@sourcegraph/wildcard'
|
||||
|
||||
import { SearchJobNode, SearchJobState } from '../../../graphql-operations'
|
||||
import { type SearchJobNode, SearchJobState } from '../../../graphql-operations'
|
||||
|
||||
import styles from './SearchJobBadge.module.scss'
|
||||
|
||||
|
||||
@ -27,7 +27,6 @@ const TestApp = () => (
|
||||
)
|
||||
|
||||
describe('useScrollManager', () => {
|
||||
// eslint-disable-next-line @typescript-eslint/unbound-method
|
||||
const originalScrollTo = Element.prototype.scrollTo
|
||||
const scrollToMock = spy()
|
||||
beforeAll(() => {
|
||||
|
||||
@ -40,7 +40,7 @@ export class TemporarySettingsContext {
|
||||
|
||||
private editTemporarySettings(contents: string): EditTemporarySettingsResult {
|
||||
// This parsing is safe in integration tests
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
|
||||
this.settings = { ...this.settings, ...JSON.parse(contents) }
|
||||
|
||||
return {
|
||||
|
||||
@ -3,7 +3,7 @@ import React, { useEffect, useMemo, useRef, useState } from 'react'
|
||||
import { mdiChevronRight, mdiChevronLeft } from '@mdi/js'
|
||||
import classNames from 'classnames'
|
||||
// We're using marked import here to access the `marked` package type definitions.
|
||||
// eslint-disable-next-line no-restricted-imports
|
||||
|
||||
import { type marked, Slugger } from 'marked'
|
||||
import ReactDOM from 'react-dom'
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { escapeRegExp } from 'lodash'
|
||||
// We're using marked import here to access the `marked` package type definitions.
|
||||
// eslint-disable-next-line no-restricted-imports
|
||||
|
||||
import { type marked, Renderer } from 'marked'
|
||||
import { type Observable, forkJoin, of } from 'rxjs'
|
||||
import { startWith, catchError, mapTo, map, switchMap } from 'rxjs/operators'
|
||||
|
||||
@ -99,7 +99,7 @@ export const LicenseKeyModal: FC<LicenseKeyModalProps> = ({
|
||||
<H3 className="m-0 pb-4">Upgrade your license</H3>
|
||||
<Text className="m-0 pb-3">Enter your license key to start your enterprise set up:</Text>
|
||||
{error && <Alert variant="danger">License key not recognized. Please try again.</Alert>}
|
||||
{/* eslint-disable @typescript-eslint/no-misused-promises */}
|
||||
{}
|
||||
<Form onSubmit={onSubmit}>
|
||||
<Label htmlFor="license-key">License key</Label>
|
||||
<Input
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import React, {
|
||||
createContext,
|
||||
type FC,
|
||||
PropsWithChildren,
|
||||
RefObject,
|
||||
type PropsWithChildren,
|
||||
type RefObject,
|
||||
Suspense,
|
||||
useContext,
|
||||
useEffect,
|
||||
@ -60,7 +60,7 @@ import type { RouteV6Descriptor } from '../util/contributions'
|
||||
import { parseBrowserRepoURL } from '../util/url'
|
||||
|
||||
import { GoToCodeHostAction } from './actions/GoToCodeHostAction'
|
||||
import { fetchFileExternalLinks, type ResolvedRevision, resolveRepoRevision, Repo } from './backend'
|
||||
import { fetchFileExternalLinks, type ResolvedRevision, resolveRepoRevision, type Repo } from './backend'
|
||||
import { AskCodyButton } from './cody/AskCodyButton'
|
||||
import { RepoContainerError } from './RepoContainerError'
|
||||
import { RepoHeader, type RepoHeaderActionButton, type RepoHeaderContributionsLifecycleProps } from './RepoHeader'
|
||||
|
||||
@ -22,7 +22,6 @@ type RepoHeaderButtonLinkProps = ButtonLinkProps & {
|
||||
file?: boolean
|
||||
}
|
||||
|
||||
// eslint-disable-next-line react/display-name
|
||||
export const RepoHeaderActionButtonLink = React.forwardRef(
|
||||
({ children, className, file, ...rest }: React.PropsWithChildren<RepoHeaderButtonLinkProps>, reference) => (
|
||||
<ButtonLink
|
||||
@ -51,7 +50,6 @@ export type RepoHeaderActionAnchorProps = Omit<ButtonLinkProps, 'as' | 'href'> &
|
||||
file?: boolean
|
||||
}
|
||||
|
||||
// eslint-disable-next-line react/display-name
|
||||
export const RepoHeaderActionAnchor = React.forwardRef((props: RepoHeaderActionAnchorProps, reference) => {
|
||||
const { children, className, file, ...rest } = props
|
||||
|
||||
|
||||
@ -45,6 +45,7 @@ import styles from './index.module.scss'
|
||||
|
||||
/**
|
||||
* Converts a name to a username by removing all non-alphanumeric characters and converting to lowercase.
|
||||
*
|
||||
* @param name user's name / full name
|
||||
* @param randomize whether to add a random suffix to the username to avoid collisions
|
||||
* @returns username
|
||||
|
||||
@ -13,7 +13,6 @@ const getFieldsAsObject = (value: object): object =>
|
||||
Object.entries(Object.getOwnPropertyDescriptors(value))
|
||||
// eslint-disable-next-line no-prototype-builtins
|
||||
.filter(([, desc]) => desc.hasOwnProperty('value') && typeof desc.value !== 'function')
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
.reduce((result, [key]) => ({ ...result, [key]: (value as any)[key] }), {})
|
||||
|
||||
const TourId = 'MockTour'
|
||||
|
||||
@ -56,7 +56,6 @@ export type IconProps = HiddenIconProps | ScreenReaderIconProps
|
||||
* Note: In order to be accessible, we enforce that either an `aria-label` OR an `aria-hidden` prop is provided.
|
||||
* If the icon is not decorative, and adds value to the users journey, we should use a descriptive `aria-label`.
|
||||
*/
|
||||
// eslint-disable-next-line react/display-name
|
||||
export const Icon = React.memo(
|
||||
React.forwardRef(function Icon(
|
||||
{ children, className, size, role = 'img', inline = true, svgPath, ...props },
|
||||
|
||||
@ -14,7 +14,6 @@ type LinkOrSpanProps = React.PropsWithChildren<
|
||||
* The LinkOrSpan component renders a <Link> if the "to" property is a non-empty string; otherwise it renders the
|
||||
* text in a <span> (with no link).
|
||||
*/
|
||||
// eslint-disable-next-line react/display-name
|
||||
const LinkOrSpan = React.forwardRef(({ to, className = '', children, ...otherProps }: LinkOrSpanProps, reference) => {
|
||||
if (to) {
|
||||
return (
|
||||
|
||||
@ -237,9 +237,10 @@
|
||||
"dedent": "^0.7.0",
|
||||
"envalid": "^7.3.1",
|
||||
"esbuild": "^0.17.14",
|
||||
"eslint": "^8.13.0",
|
||||
"eslint": "^8.52.0",
|
||||
"eslint-plugin-monorepo": "^0.3.2",
|
||||
"eslint-plugin-storybook": "^0.6.12",
|
||||
"eslint-plugin-react": "^7.33.2",
|
||||
"eslint-plugin-storybook": "^0.6.15",
|
||||
"events": "^3.3.0",
|
||||
"execa": "^5.0.0",
|
||||
"expect": "^27.5.1",
|
||||
|
||||
763
pnpm-lock.yaml
763
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user