mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 17:31:43 +00:00
Remove unused eslint disables (#9572)
* Remove unused eslint-disable comments * Add stylelintignore file Else this causes broken fixes in TSX files
This commit is contained in:
parent
ff6bde0768
commit
3223e764f2
1
.github/CODEOWNERS
vendored
1
.github/CODEOWNERS
vendored
@ -58,6 +58,7 @@
|
||||
/internal/linkheader @efritz
|
||||
/renovate.json @felixfbecker
|
||||
/.stylelintrc.json @felixfbecker
|
||||
/.stylelintignore @felixfbecker
|
||||
/graphql-schema-linter.config.js @felixfbecker
|
||||
/.prettierignore @felixfbecker
|
||||
/.github @beyang
|
||||
|
||||
5
.stylelintignore
Normal file
5
.stylelintignore
Normal file
@ -0,0 +1,5 @@
|
||||
**/*.js
|
||||
**/*.jsx
|
||||
**/*.ts
|
||||
**/*.tsx
|
||||
node_modules/
|
||||
@ -44,7 +44,6 @@ async function init(): Promise<void> {
|
||||
return
|
||||
}
|
||||
|
||||
// eslint-disable-next-line require-atomic-updates
|
||||
window.SOURCEGRAPH_URL = sourcegraphURL
|
||||
const css = await getPhabricatorCSS(sourcegraphURL)
|
||||
const style = document.createElement('style')
|
||||
|
||||
@ -9,8 +9,6 @@ export function parseCursor<T>(cursorRaw: string | undefined): T | undefined {
|
||||
}
|
||||
|
||||
try {
|
||||
// False positive https://github.com/typescript-eslint/typescript-eslint/issues/1269
|
||||
// eslint-disable-next-line @typescript-eslint/return-await
|
||||
return JSON.parse(Buffer.from(cursorRaw, 'base64').toString())
|
||||
} catch {
|
||||
throw Object.assign(new Error(`Malformed cursor supplied ${cursorRaw}`), { status: 400 })
|
||||
|
||||
@ -127,7 +127,6 @@ async function* generate<T>(values: T[]): AsyncIterable<T> {
|
||||
async function consume(iterable: AsyncIterable<unknown>): Promise<void> {
|
||||
// We need to consume the iterable but can't make a meaningful
|
||||
// binding for each element of the iteration.
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
for await (const _ of iterable) {
|
||||
// no-op body, just consume iterable
|
||||
}
|
||||
|
||||
@ -24,8 +24,6 @@ export async function getClient(): Promise<OAuth2Client> {
|
||||
async function getAccessToken(oauth2Client: OAuth2Client): Promise<Credentials> {
|
||||
try {
|
||||
const content = await readFile(TOKEN_PATH, { encoding: 'utf8' })
|
||||
// False positive https://github.com/typescript-eslint/typescript-eslint/issues/1269
|
||||
// eslint-disable-next-line @typescript-eslint/return-await
|
||||
return JSON.parse(content)
|
||||
} catch (err) {
|
||||
const token = await getAccessTokenNoCache(oauth2Client)
|
||||
|
||||
@ -115,7 +115,6 @@ function score1(selector: DocumentSelector[0], candidateUri: URL, candidateLangu
|
||||
}
|
||||
}
|
||||
if (baseUri) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
||||
if (candidateUri.href.startsWith(baseUri.toString())) {
|
||||
ret = 5
|
||||
} else {
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
import { Observable } from 'rxjs'
|
||||
// eslint-disable-next-line import/extensions
|
||||
import ExtensionHostWorker from 'worker-loader?inline&name=extensionHostWorker.bundle.js!./main.worker.ts'
|
||||
import { EndpointPair } from '../../platform/context'
|
||||
|
||||
|
||||
@ -133,7 +133,6 @@ export function urlForOpenPanel(viewID: string, urlHash: string): string {
|
||||
params.set('tab', viewID)
|
||||
// In the URL fragment, the 'L1:2-3:4' is treated as a parameter with no value. Undo the escaping of ':'
|
||||
// and the addition of the '=' for the empty value, for aesthetic reasons.
|
||||
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
||||
const paramsString = params.toString().replace(/%3A/g, ':').replace(/=&/g, '&')
|
||||
return `#${paramsString}`
|
||||
}
|
||||
|
||||
@ -267,7 +267,6 @@ export class TabsWithURLViewStatePersistence<ID extends string, T extends Tab<ID
|
||||
}
|
||||
return {
|
||||
...location,
|
||||
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
||||
hash: hash.toString().replace(/%3A/g, ':').replace(/=$/, ''), // remove needless trailing `=` as in `#L12=`,
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,8 +39,6 @@ function parseValue<T>(v: string | null, defaultValue: T): T {
|
||||
return defaultValue
|
||||
}
|
||||
try {
|
||||
// False positive https://github.com/typescript-eslint/typescript-eslint/issues/1269
|
||||
// eslint-disable-next-line @typescript-eslint/return-await
|
||||
return JSON.parse(v)
|
||||
} catch (err) {
|
||||
return defaultValue
|
||||
|
||||
@ -596,7 +596,6 @@ export function buildSearchURLQuery(
|
||||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
||||
return searchParams.toString().replace(/%2F/g, '/').replace(/%3A/g, ':')
|
||||
}
|
||||
|
||||
|
||||
@ -233,8 +233,6 @@ async function fetcher(graphQLParams: _graphiqlModule.GraphQLParams): Promise<st
|
||||
})
|
||||
const responseBody = await response.text()
|
||||
try {
|
||||
// False positive https://github.com/typescript-eslint/typescript-eslint/issues/1269
|
||||
// eslint-disable-next-line @typescript-eslint/return-await
|
||||
return JSON.parse(responseBody)
|
||||
} catch (error) {
|
||||
return responseBody
|
||||
|
||||
@ -702,7 +702,6 @@ export class FilteredConnection<N, NP = {}, C extends Connection<N> = Connection
|
||||
if (arg.visible !== 0 && arg.visible !== arg.first) {
|
||||
q.set('visible', String(arg.visible))
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
||||
return q.toString()
|
||||
}
|
||||
|
||||
|
||||
@ -11,7 +11,6 @@ import { PageTitle } from '../../../components/PageTitle'
|
||||
|
||||
jest.mock('./form/CampaignTitleField', () => ({ CampaignTitleField: 'CampaignTitleField' }))
|
||||
jest.mock('./form/CampaignDescriptionField', () => ({ CampaignDescriptionField: 'CampaignDescriptionField' }))
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
jest.mock('./CampaignStatus', () => ({
|
||||
CampaignStatus: (props: CampaignStatusProps) => `CampaignStatus(state=${props.campaign.status.state})`,
|
||||
}))
|
||||
@ -64,7 +63,6 @@ describe('CampaignDetails', () => {
|
||||
_noSubject={true}
|
||||
/>
|
||||
)
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
act(() => undefined)
|
||||
expect(component.toJSON()).toMatchSnapshot()
|
||||
})
|
||||
@ -113,7 +111,7 @@ describe('CampaignDetails', () => {
|
||||
describe(`viewerCanAdminister: ${String(viewerCanAdminister)}`, () => {
|
||||
test('viewing existing', () => {
|
||||
const component = renderer.create(renderCampaignDetails({ viewerCanAdminister }))
|
||||
act(() => undefined) // eslint-disable-line @typescript-eslint/no-floating-promises
|
||||
act(() => undefined)
|
||||
expect(component).toMatchSnapshot()
|
||||
})
|
||||
})
|
||||
@ -121,8 +119,7 @@ describe('CampaignDetails', () => {
|
||||
|
||||
test('editing existing', () => {
|
||||
const component = renderer.create(renderCampaignDetails({ viewerCanAdminister: true }))
|
||||
act(() => undefined) // eslint-disable-line @typescript-eslint/no-floating-promises
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
act(() => undefined)
|
||||
act(() =>
|
||||
component.root.findByProps({ id: 'e2e-campaign-edit' }).props.onClick({ preventDefault: () => undefined })
|
||||
)
|
||||
|
||||
@ -34,7 +34,6 @@ describe('SearchStatsPage', () => {
|
||||
createNodeMock: () => ({ parentElement: document.implementation.createHTMLDocument().body }),
|
||||
}
|
||||
)
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
act(() => undefined) // wait for _querySearchResultsStats to emit
|
||||
expect(component.toJSON()).toMatchSnapshot()
|
||||
})
|
||||
@ -62,7 +61,6 @@ describe('SearchStatsPage', () => {
|
||||
createNodeMock: () => ({ parentElement: document.implementation.createHTMLDocument().body }),
|
||||
}
|
||||
)
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
act(() => undefined) // wait for _querySearchResultsStats to emit
|
||||
expect(component.toJSON()).toMatchSnapshot()
|
||||
})
|
||||
|
||||
@ -34,7 +34,6 @@ export const SearchStatsPage: React.FunctionComponent<Props> = ({
|
||||
const onSubmit = useCallback<React.FormEventHandler<HTMLFormElement>>(
|
||||
e => {
|
||||
e.preventDefault()
|
||||
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
||||
history.push({ ...location, search: new URLSearchParams({ q: uncommittedQuery }).toString() })
|
||||
},
|
||||
[history, location, uncommittedQuery]
|
||||
|
||||
@ -24,7 +24,6 @@ export const PaymentTokenFormControl: React.FunctionComponent<Props> = props =>
|
||||
props.disabled ? 'disabled' : ''
|
||||
}`}
|
||||
disabled={props.disabled}
|
||||
// eslint-disable-next-line react/forbid-dom-props
|
||||
style={{
|
||||
base: {
|
||||
fontFamily:
|
||||
|
||||
@ -144,7 +144,6 @@ export function productSubscriptionInputForLocationHash(value: GQL.IProductSubsc
|
||||
const params = new URLSearchParams()
|
||||
params.set('plan', value.billingPlanID)
|
||||
params.set('userCount', value.userCount.toString())
|
||||
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
||||
return '#' + params.toString()
|
||||
}
|
||||
|
||||
|
||||
@ -126,7 +126,6 @@ export class ExtensionsList extends React.PureComponent<Props, State> {
|
||||
if (query) {
|
||||
const searchParams = new URLSearchParams()
|
||||
searchParams.set(ExtensionsList.URL_QUERY_PARAM, query)
|
||||
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
||||
search = searchParams.toString()
|
||||
} else {
|
||||
search = ''
|
||||
|
||||
@ -47,11 +47,7 @@ export class ExtensionsQueryInputToolbar extends React.PureComponent<Props, Stat
|
||||
))}
|
||||
</DropdownMenu>
|
||||
</ButtonDropdown>{' '}
|
||||
<ButtonDropdown
|
||||
isOpen={this.state.open === 'options'}
|
||||
// eslint-disable-next-line react/jsx-no-bind
|
||||
toggle={this.toggleOptions}
|
||||
>
|
||||
<ButtonDropdown isOpen={this.state.open === 'options'} toggle={this.toggleOptions}>
|
||||
<DropdownToggle caret={true}>Options</DropdownToggle>
|
||||
<DropdownMenu right={true}>
|
||||
<DropdownItem
|
||||
|
||||
@ -106,6 +106,5 @@ export function extensionsQuery({
|
||||
export function urlToExtensionsQuery(query: string): string {
|
||||
const params = new URLSearchParams()
|
||||
params.set('query', query)
|
||||
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
||||
return `/extensions?${params.toString()}`
|
||||
}
|
||||
|
||||
@ -12,7 +12,6 @@ export const extensionAreaRoutes: readonly ExtensionAreaRoute[] = [
|
||||
{
|
||||
path: '',
|
||||
exact: true,
|
||||
// eslint-disable-next-line react/jsx-no-bind
|
||||
render: props => <RegistryExtensionOverviewPage eventLogger={eventLogger} {...props} />,
|
||||
},
|
||||
{
|
||||
|
||||
@ -80,8 +80,6 @@ export class UserNavItem extends React.PureComponent<Props, State> {
|
||||
<div className="px-2 py-1">
|
||||
<div className="d-flex align-items-center">
|
||||
<div className="mr-2">Theme</div>
|
||||
{/* <Select> doesn't support small version */}
|
||||
{/* eslint-disable-next-line react/forbid-elements */}
|
||||
<select
|
||||
className="custom-select custom-select-sm e2e-theme-toggle"
|
||||
onChange={this.onThemeChange}
|
||||
|
||||
@ -391,7 +391,6 @@ export class RepoContainer extends React.Component<RepoContainerProps, RepoRevCo
|
||||
key="hardcoded-key" // see https://github.com/ReactTraining/react-router/issues/4578#issuecomment-334489490
|
||||
exact={exact}
|
||||
// RouteProps.render is an exception
|
||||
// eslint-disable-next-line react/jsx-no-bind
|
||||
render={routeComponentProps => render({ ...context, ...routeComponentProps })}
|
||||
/>
|
||||
)
|
||||
|
||||
@ -43,7 +43,6 @@ export class ToggleRenderedFileMode extends React.PureComponent<Props> {
|
||||
} else {
|
||||
q.delete(ToggleRenderedFileMode.URL_QUERY_PARAM)
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
||||
return { ...location, search: q.toString() }
|
||||
}
|
||||
|
||||
|
||||
@ -101,7 +101,6 @@ export class DiscussionsCreate extends React.PureComponent<Props, State> {
|
||||
hash.set('tab', 'discussions')
|
||||
hash.set('threadID', thread.idWithoutKind)
|
||||
// TODO(slimsag:discussions): ASAP: focus the new thread's range
|
||||
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
||||
this.props.history.push(location.pathname + location.search + '#' + hash.toString())
|
||||
}),
|
||||
map(thread => undefined),
|
||||
|
||||
@ -29,7 +29,6 @@ export const DiscussionsGutterOverlay: React.FunctionComponent<DiscussionsGutter
|
||||
hash.set('tab', 'discussions')
|
||||
hash.set('createThread', 'true')
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
||||
const newURL = props.location.pathname + props.location.search + '#' + hash.toString()
|
||||
|
||||
return (
|
||||
|
||||
@ -66,7 +66,6 @@ export class DiscussionsNavbar extends React.PureComponent<Props> {
|
||||
} else {
|
||||
hash.delete('threadID')
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
||||
return location.pathname + location.search + '#' + hash.toString()
|
||||
}
|
||||
}
|
||||
|
||||
@ -163,8 +163,7 @@ export class DiscussionsThread extends React.PureComponent<Props, State> {
|
||||
},
|
||||
hash
|
||||
)
|
||||
: // eslint-disable-next-line @typescript-eslint/no-base-to-string
|
||||
'#' + hash.toString()
|
||||
: '#' + hash.toString()
|
||||
}
|
||||
|
||||
private onSubmit = (title: string, contents: string): Observable<void> => {
|
||||
|
||||
@ -8,6 +8,5 @@ export function redirectToExternalHost(externalRedirectURL: string): void {
|
||||
redirectURL.host = externalHostURL.host
|
||||
redirectURL.port = externalHostURL.port
|
||||
redirectURL.protocol = externalHostURL.protocol
|
||||
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
||||
window.location.replace(redirectURL.toString())
|
||||
}
|
||||
|
||||
@ -415,7 +415,6 @@ export class RepositoryStatsContributorsPage extends React.PureComponent<Props,
|
||||
if (spec.path) {
|
||||
query.set('path', spec.path)
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
||||
return query.toString()
|
||||
}
|
||||
|
||||
|
||||
@ -314,7 +314,6 @@ export class QueryInput extends React.Component<Props, State> {
|
||||
this.focusInputAndPositionCursorAtEnd()
|
||||
const q = new URLSearchParams(props.location.search)
|
||||
q.delete('focus')
|
||||
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
||||
this.props.history.replace({ search: q.toString() })
|
||||
})
|
||||
)
|
||||
|
||||
@ -320,7 +320,6 @@ export class SearchResults extends React.Component<SearchResultsProps, SearchRes
|
||||
query = `${query} count:${count}`
|
||||
}
|
||||
params.set('q', query)
|
||||
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
||||
this.props.history.replace({ search: params.toString() })
|
||||
}
|
||||
|
||||
|
||||
@ -61,6 +61,5 @@ export class SiteAdminAddExternalServicesPage extends React.Component<Props> {
|
||||
function getAddURL(id: string): string {
|
||||
const params = new URLSearchParams()
|
||||
params.append('id', id)
|
||||
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
||||
return `?${params.toString()}`
|
||||
}
|
||||
|
||||
@ -67,7 +67,6 @@ export const File: React.FunctionComponent<FileProps> = props => (
|
||||
draggable={false}
|
||||
title={props.entryInfo.path}
|
||||
// needed because of dynamic styling
|
||||
// eslint-disable-next-line react/forbid-dom-props
|
||||
style={treePadding(props.depth, false)}
|
||||
tabIndex={-1}
|
||||
>
|
||||
|
||||
@ -268,7 +268,6 @@ export class Tree extends React.PureComponent<Props, State> {
|
||||
// Strip the ?suggestion query param. Handle both when going from ancestor -> child and child -> ancestor.
|
||||
if (queryParams.has('suggestion')) {
|
||||
queryParams.delete('suggestion')
|
||||
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
||||
this.props.history.replace({ search: queryParams.toString() })
|
||||
}
|
||||
})
|
||||
|
||||
@ -273,7 +273,6 @@ export class TreeLayer extends React.Component<TreeLayerProps, TreeLayerState> {
|
||||
<ErrorAlert
|
||||
className="tree__row-alert"
|
||||
// needed because of dynamic styling
|
||||
// eslint-disable-next-line react/forbid-dom-props
|
||||
style={treePadding(this.props.depth, true)}
|
||||
error={treeOrError}
|
||||
prefix="Error loading file tree"
|
||||
|
||||
@ -157,7 +157,6 @@ export class TreeRoot extends React.Component<TreeRootProps, TreeRootState> {
|
||||
{isErrorLike(treeOrError) ? (
|
||||
<ErrorAlert
|
||||
// needed because of dynamic styling
|
||||
// eslint-disable-next-line react/forbid-dom-props
|
||||
style={errorWidth(localStorage.getItem(this.props.sizeKey) ? this.props.sizeKey : undefined)}
|
||||
className="tree__row tree__row-alert"
|
||||
prefix="Error loading tree"
|
||||
|
||||
@ -19,11 +19,9 @@ export function toTreeURL(ctx: RepoFile): string {
|
||||
*/
|
||||
export function formatHash(lpr: LineOrPositionOrRange, searchParams: URLSearchParams): string {
|
||||
if (!lpr.line) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
||||
return `#${searchParams.toString()}`
|
||||
}
|
||||
const anyParams = Array.from(searchParams).length > 0
|
||||
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
||||
return `#L${formatLineOrPositionOrRange(lpr)}${anyParams ? '&' + searchParams.toString() : ''}`
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user