From 75b0ae9e2fa924681fb778de83eb5ce4d94b5058 Mon Sep 17 00:00:00 2001 From: Felix Becker Date: Tue, 2 Apr 2019 04:00:10 +0200 Subject: [PATCH] Update TSLint (#3148) Brings with it quite a few really useful rules that detect e.g. always-true/false expressions, noop casts, rxjs antipatterns and more. I left most as warnings for now, we can turn them into errors when all instances are fixed. --- .prettierignore | 1 - .../browser/src/extension/manifest.spec.json | 8 +- .../src/extension/scripts/background.tsx | 2 +- .../browser/src/extension/scripts/inject.tsx | 6 +- .../src/libs/bitbucket/code_intelligence.tsx | 4 +- client/browser/src/libs/bitbucket/context.tsx | 3 +- client/browser/src/libs/bitbucket/scrape.ts | 2 +- .../code_intelligence/code_intelligence.tsx | 12 +- .../libs/code_intelligence/util/file_info.ts | 3 +- .../src/libs/github/code_intelligence.ts | 2 +- client/browser/src/libs/github/extensions.tsx | 2 +- client/browser/src/libs/github/inject.tsx | 2 +- client/browser/src/libs/github/util.tsx | 39 +++--- .../src/libs/gitlab/code_intelligence.ts | 2 +- client/browser/src/libs/gitlab/scrape.ts | 2 +- .../browser/src/libs/phabricator/backend.tsx | 51 ++++---- .../src/libs/phabricator/extension.tsx | 2 +- .../browser/src/libs/phabricator/file_info.ts | 4 +- client/browser/src/libs/phabricator/util.tsx | 2 +- client/browser/src/shared/backend/diffs.tsx | 2 +- .../src/shared/backend/graphql.test.tsx | 4 +- client/browser/src/shared/backend/lsp.tsx | 2 +- client/browser/src/shared/backend/server.ts | 3 +- .../browser/src/shared/backend/userEvents.tsx | 14 ++- client/browser/src/shared/repo/backend.tsx | 2 +- package.json | 4 +- shared/src/api/client/api/codeEditor.ts | 1 + shared/src/api/client/context/expr/lexer.ts | 6 +- .../api/client/services/contribution.test.ts | 3 +- .../api/client/services/decoration.test.ts | 2 +- .../client/services/extensionsService.test.ts | 2 +- .../api/client/services/extensionsService.ts | 6 +- shared/src/api/client/services/hover.test.ts | 2 +- .../src/api/client/services/location.test.ts | 2 +- shared/src/api/client/services/view.test.ts | 2 +- shared/src/api/client/types/textDocument.ts | 8 +- shared/src/api/extension/types/errors.ts | 3 +- shared/src/api/extension/types/position.ts | 24 ++-- shared/src/api/extension/types/range.ts | 6 +- .../integration-test/languageFeatures.test.ts | 3 +- shared/src/components/FileMatchChildren.tsx | 2 +- shared/src/extensions/helpers.ts | 32 ++--- shared/src/highlight/contributions.ts | 2 + shared/src/hover/actions.ts | 3 +- shared/src/panel/views/FileLocations.tsx | 3 +- .../panel/views/HierarchicalLocationsView.tsx | 3 +- shared/src/settings/settings.test.ts | 20 +-- shared/src/util/dom.tsx | 5 +- shared/src/util/memoizeObservable.ts | 6 +- web/src/SourcegraphWebApp.tsx | 13 +- web/src/api/APIConsole.tsx | 3 +- web/src/auth/ResetPasswordPage.tsx | 2 +- web/src/auth/SignUpPage.tsx | 3 +- web/src/backend/graphql.tsx | 4 +- web/src/components/DismissibleAlert.tsx | 2 +- web/src/components/ExternalServiceCard.tsx | 3 +- web/src/components/FilteredConnection.tsx | 11 +- web/src/components/Overview.tsx | 19 ++- web/src/components/SearchResultMatch.tsx | 4 +- web/src/components/d3/BarChart.tsx | 4 +- web/src/components/tooltip/Tooltip.tsx | 3 +- .../enterprise/extensions/registry/backend.ts | 6 +- .../SiteAdminProductSubscriptionPage.tsx | 2 +- .../ProductSubscriptionForm.tsx | 3 +- ...erSubscriptionsProductSubscriptionPage.tsx | 6 +- web/src/extensions/ExtensionCard.tsx | 3 +- web/src/extensions/ExtensionToggle.tsx | 13 +- .../extensions/extension/ExtensionArea.tsx | 5 +- web/src/marketing/backend.tsx | 8 +- web/src/nav/NavLinks.test.tsx | 14 ++- web/src/org/area/OrgArea.tsx | 2 +- web/src/repo/FilePathBreadcrumb.tsx | 3 +- web/src/repo/RepositoryGitDataContainer.tsx | 3 +- web/src/repo/blob/Blob.tsx | 2 +- .../blob/discussions/DiscussionsCreate.tsx | 2 +- .../blob/discussions/DiscussionsThread.tsx | 2 +- .../RepositoryBranchesOverviewPage.tsx | 2 +- web/src/search/input/QueryBuilder.test.tsx | 12 +- web/src/search/input/QueryBuilder.tsx | 2 +- web/src/search/input/ScopePage.tsx | 3 +- web/src/search/input/Suggestion.tsx | 2 +- web/src/search/results/CommitSearchResult.tsx | 7 +- web/src/search/results/SearchResultsList.tsx | 8 +- .../search/saved-queries/SavedQueryForm.tsx | 4 +- web/src/search/saved-queries/Sparkline.tsx | 2 +- web/src/settings/SettingsArea.tsx | 4 +- .../SiteAdminAddExternalServicePage.tsx | 5 +- .../SiteAdminAddExternalServicesPage.tsx | 28 ++--- .../site-admin/SiteAdminConfigurationPage.tsx | 2 +- .../SiteAdminExternalServicesPage.tsx | 4 +- web/src/site-admin/SiteAdminOverviewPage.tsx | 10 +- web/src/site-admin/backend.tsx | 2 +- .../tracking/services/telligentWrapper.tsx | 3 +- web/src/tracking/withActivation.tsx | 2 +- web/src/tree/Tree.tsx | 3 +- web/src/tree/util.tsx | 2 +- .../user/account/UserAccountPasswordPage.tsx | 4 +- .../user/account/UserAccountProfilePage.tsx | 6 +- web/src/user/area/UserArea.tsx | 2 +- yarn.lock | 118 +++++++++++++----- 100 files changed, 359 insertions(+), 349 deletions(-) diff --git a/.prettierignore b/.prettierignore index c9b462c4da4..86c189e840a 100644 --- a/.prettierignore +++ b/.prettierignore @@ -20,7 +20,6 @@ testdata .github/* doc/ shared/src/types/abort-controller/index.d.ts -client/browser/src/extension/*.json cmd/management-console/assets/ **/.cache shared/dev/**/*.js diff --git a/client/browser/src/extension/manifest.spec.json b/client/browser/src/extension/manifest.spec.json index a4efd788e3c..52fc468ce3d 100644 --- a/client/browser/src/extension/manifest.spec.json +++ b/client/browser/src/extension/manifest.spec.json @@ -3,8 +3,7 @@ "version": "0.0.0", "name": "Sourcegraph", "manifest_version": 2, - "description": - "Code intelligence for your code host and code reviews: hovers, documentation, definitions, and references in files, PRs, and diffs", + "description": "Code intelligence for your code host and code reviews: hovers, documentation, definitions, and references in files, PRs, and diffs", "browser_action": { "default_title": "Sourcegraph", "default_icon": { @@ -30,7 +29,7 @@ }, "optional_permissions": ["tabs", "http://*/*", "https://*/*"], "content_security_policy": "script-src 'self' blob:; object-src 'self'", - "web_accessible_resources": ["img/*", "css/style.bundle.css"], + "web_accessible_resources": ["img/*", "css/style.bundle.css"], "omnibox": { "keyword": "src" }, @@ -64,8 +63,7 @@ "https://sourcegraph.com/*", "http://localhost:32773/*" ], - "key": - "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvyGmcOkw4cTnhO0bgl3fQLAdv1jZp8T1ZHYI+4d8FgwwVKLYWE+pAuJ/0LrI69ibed4Nnnw5YleB1xCpI+mzB56xfXWboKp6lljevKqWJ5TpJk/Vam3kSSoZwpmJRXnzmcM3qKpL6viUhTfwGmQO6WVTsN4YCx+KWXv97IyF6yDTgd6hwFsvCZY2n1ADgurrQkE6AcJ3kK4xZ14jaHllXEdFcqwh0+Am5qLcIJ1cNo5iFD35exXsjwdQbmpt8sEk5f95pK5FEEbJFmOTguu2fOZycqIoTgoDrbbhT5k9TUogZaN5Lup0Iwh0Cv60i4C1f7IdPrxHuaYmYCfoUezXnQIDAQAB" + "key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvyGmcOkw4cTnhO0bgl3fQLAdv1jZp8T1ZHYI+4d8FgwwVKLYWE+pAuJ/0LrI69ibed4Nnnw5YleB1xCpI+mzB56xfXWboKp6lljevKqWJ5TpJk/Vam3kSSoZwpmJRXnzmcM3qKpL6viUhTfwGmQO6WVTsN4YCx+KWXv97IyF6yDTgd6hwFsvCZY2n1ADgurrQkE6AcJ3kK4xZ14jaHllXEdFcqwh0+Am5qLcIJ1cNo5iFD35exXsjwdQbmpt8sEk5f95pK5FEEbJFmOTguu2fOZycqIoTgoDrbbhT5k9TUogZaN5Lup0Iwh0Cv60i4C1f7IdPrxHuaYmYCfoUezXnQIDAQAB" }, "prod": { "content_scripts": [ diff --git a/client/browser/src/extension/scripts/background.tsx b/client/browser/src/extension/scripts/background.tsx index 3e525e824df..7b1653313eb 100644 --- a/client/browser/src/extension/scripts/background.tsx +++ b/client/browser/src/extension/scripts/background.tsx @@ -262,7 +262,7 @@ runtime.onMessage((message, _, cb) => { runtime.openOptionsPage() return true case 'createBlobURL': - createBlobURLForBundle(message.payload! as string) + createBlobURLForBundle(message.payload) .then(url => { if (cb) { cb(url) diff --git a/client/browser/src/extension/scripts/inject.tsx b/client/browser/src/extension/scripts/inject.tsx index 38af62583cd..726568596c7 100644 --- a/client/browser/src/extension/scripts/inject.tsx +++ b/client/browser/src/extension/scripts/inject.tsx @@ -59,7 +59,7 @@ function observe(): void { Boolean(items.enterpriseUrls.find(url => url === window.location.origin)) const isGitHub = /^https?:\/\/(www.)?github.com/.test(href) - const ogSiteName = document.head!.querySelector(`meta[property='og:site_name']`) as HTMLMetaElement + const ogSiteName = document.head.querySelector(`meta[property='og:site_name']`) as HTMLMetaElement const isGitHubEnterprise = ogSiteName ? ogSiteName.content === 'GitHub Enterprise' : false const isBitbucket = document.querySelector('.bitbucket-header-logo') || @@ -68,12 +68,12 @@ function observe(): void { if (!isSourcegraphServer && !document.getElementById('ext-style-sheet')) { if (isPhabricator || isGitHub || isGitHubEnterprise || isBitbucket || isGitlab) { - const styleSheet = document.createElement('link') as HTMLLinkElement + const styleSheet = document.createElement('link') styleSheet.id = 'ext-style-sheet' styleSheet.rel = 'stylesheet' styleSheet.type = 'text/css' styleSheet.href = getURL('css/style.bundle.css') - document.head!.appendChild(styleSheet) + document.head.appendChild(styleSheet) } } diff --git a/client/browser/src/libs/bitbucket/code_intelligence.tsx b/client/browser/src/libs/bitbucket/code_intelligence.tsx index c5111c19663..37f6eb6ead9 100644 --- a/client/browser/src/libs/bitbucket/code_intelligence.tsx +++ b/client/browser/src/libs/bitbucket/code_intelligence.tsx @@ -157,7 +157,7 @@ function getCommandPaletteMount(): HTMLElement { const createCommandList = (): HTMLElement => { const commandListElem = document.createElement('li') commandListElem.className = commandListClasses.join(' ') - headerElem!.insertAdjacentElement('beforeend', commandListElem) + headerElem.insertAdjacentElement('beforeend', commandListElem) return commandListElem } @@ -170,7 +170,7 @@ function getViewContextOnSourcegraphMount(): HTMLElement | null { if (!branchSelectorButtons) { return null } - const preexisting = branchSelectorButtons.querySelector('#open-on-sourcegraph') as HTMLElement | null + const preexisting = branchSelectorButtons.querySelector('#open-on-sourcegraph') if (preexisting) { return preexisting } diff --git a/client/browser/src/libs/bitbucket/context.tsx b/client/browser/src/libs/bitbucket/context.tsx index c42c53ffdd3..8818593c87f 100644 --- a/client/browser/src/libs/bitbucket/context.tsx +++ b/client/browser/src/libs/bitbucket/context.tsx @@ -36,9 +36,8 @@ function getRevSpecFromRevisionSelector(): RevSpec { return { rev: revisionRefInfo.latestCommit, } - } else { - throw new Error(`revisionRefInfo is empty or has no latestCommit (revisionRefStr: ${revisionRefStr})`) } + throw new Error(`revisionRefInfo is empty or has no latestCommit (revisionRefStr: ${revisionRefStr})`) } export function getContext(): CodeHostContext { diff --git a/client/browser/src/libs/bitbucket/scrape.ts b/client/browser/src/libs/bitbucket/scrape.ts index 3657c2304ee..e8e490fea39 100644 --- a/client/browser/src/libs/bitbucket/scrape.ts +++ b/client/browser/src/libs/bitbucket/scrape.ts @@ -32,7 +32,7 @@ const getFileInfoFromLinkInSingleFileView = ( const errors: Error[] = [] for (const selector of LINK_SELECTORS) { try { - const linkElement = codeView.querySelector(selector) as HTMLLinkElement | null + const linkElement = codeView.querySelector(selector) if (!linkElement) { throw new Error(`Could not find selector ${selector} in code view`) } diff --git a/client/browser/src/libs/code_intelligence/code_intelligence.tsx b/client/browser/src/libs/code_intelligence/code_intelligence.tsx index a5561ac9e83..6aaf1552531 100644 --- a/client/browser/src/libs/code_intelligence/code_intelligence.tsx +++ b/client/browser/src/libs/code_intelligence/code_intelligence.tsx @@ -302,10 +302,7 @@ export function initCodeIntelligence({ map(([, hoverOverlayElement]) => ({ hoverOverlayElement, relativeElement })), filter(propertyIsDefined('hoverOverlayElement')) ), - getHover: ({ line, character, part, ...rest }) => - getHover({ ...rest, position: { line, character } }).pipe( - map(hover => (hover ? (hover as HoverMerged) : hover)) - ), + getHover: ({ line, character, part, ...rest }) => getHover({ ...rest, position: { line, character } }), getActions: context => getHoverActions({ extensionsController, platformContext }, context), }) @@ -369,8 +366,8 @@ export function initCodeIntelligence({ , @@ -598,6 +595,9 @@ export function handleCodeHost({ codeViewState.subscriptions.add( extensionsController.services.textDocumentDecoration .getDecorations(toTextDocumentIdentifier(fileInfo)) + // The nested subscribe cannot be replaced with a switchMap() + // We manage the subscription correctly. + // tslint:disable-next-line: rxjs-no-nested-subscribe .subscribe(decorations => { decoratedLines = applyDecorations( domFunctions, diff --git a/client/browser/src/libs/code_intelligence/util/file_info.ts b/client/browser/src/libs/code_intelligence/util/file_info.ts index 0b957798179..b2ee00362d4 100644 --- a/client/browser/src/libs/code_intelligence/util/file_info.ts +++ b/client/browser/src/libs/code_intelligence/util/file_info.ts @@ -31,9 +31,8 @@ export const ensureRevisionsAreCloned = (files: Observable): Observabl catchError(err => { if (err.code === ERPRIVATEREPOPUBLICSOURCEGRAPHCOM) { return [{ repoName, commitID, baseCommitID, ...rest }] - } else { - throw err } + throw err }) ) }) diff --git a/client/browser/src/libs/github/code_intelligence.ts b/client/browser/src/libs/github/code_intelligence.ts index 26f7f0c6c4d..2c39b4b6238 100644 --- a/client/browser/src/libs/github/code_intelligence.ts +++ b/client/browser/src/libs/github/code_intelligence.ts @@ -163,7 +163,7 @@ function checkIsGithub(): boolean { const href = window.location.href const isGithub = /^https?:\/\/(www.)?github.com/.test(href) - const ogSiteName = document.head!.querySelector(`meta[property='og:site_name']`) as HTMLMetaElement + const ogSiteName = document.head.querySelector(`meta[property='og:site_name']`) as HTMLMetaElement const isGitHubEnterprise = ogSiteName ? ogSiteName.content === 'GitHub Enterprise' : false return isGithub || isGitHubEnterprise diff --git a/client/browser/src/libs/github/extensions.tsx b/client/browser/src/libs/github/extensions.tsx index 15366315a48..9b1ca4af024 100644 --- a/client/browser/src/libs/github/extensions.tsx +++ b/client/browser/src/libs/github/extensions.tsx @@ -9,7 +9,7 @@ export function getCommandPaletteMount(): HTMLElement { const createCommandList = (): HTMLElement => { const commandListElem = document.createElement('div') commandListElem.className = commandListClass - headerElem!.insertAdjacentElement('afterbegin', commandListElem) + headerElem.insertAdjacentElement('afterbegin', commandListElem) return commandListElem } diff --git a/client/browser/src/libs/github/inject.tsx b/client/browser/src/libs/github/inject.tsx index 634d89c9175..d81e751ead7 100644 --- a/client/browser/src/libs/github/inject.tsx +++ b/client/browser/src/libs/github/inject.tsx @@ -81,7 +81,7 @@ function injectInlineSearch(): void { const className = 'symbols-autocomplete' - const existingMount = parentDiv.querySelector(`.${className}`) as HTMLDivElement | null + const existingMount = parentDiv.querySelector(`.${className}`) if (existingMount) { return existingMount } diff --git a/client/browser/src/libs/github/util.tsx b/client/browser/src/libs/github/util.tsx index 5c5d396b8dd..ffb699d5dc7 100644 --- a/client/browser/src/libs/github/util.tsx +++ b/client/browser/src/libs/github/util.tsx @@ -64,10 +64,9 @@ export function getDeltaFileName(container: HTMLElement): { headFilePath: string if (info.title) { // for PR conversation snippets return getPathNamesFromElement(info) - } else { - const link = info.querySelector('a') as HTMLElement - return getPathNamesFromElement(link) } + const link = info.querySelector('a') as HTMLElement + return getPathNamesFromElement(link) } function getPathNamesFromElement(element: HTMLElement): { headFilePath: string; baseFilePath: string | null } { @@ -99,20 +98,18 @@ export function isDomSplitDiff(): boolean { (disabledToggle && !disabledToggle.href.includes('diff=split')) || !!document.querySelector('.file-diff-split') ) - } else { - // delta for a commit view - const headerBar = document.getElementsByClassName('details-collapse table-of-contents js-details-container') - if (!headerBar || headerBar.length !== 1) { - return false - } - - const diffToggles = headerBar[0].getElementsByClassName('BtnGroup float-right') - const selectedToggle = diffToggles[0].querySelector('.selected') as HTMLAnchorElement - return ( - (selectedToggle && selectedToggle.href.includes('diff=split')) || - !!document.querySelector('.file-diff-split') - ) } + // delta for a commit view + const headerBar = document.getElementsByClassName('details-collapse table-of-contents js-details-container') + if (!headerBar || headerBar.length !== 1) { + return false + } + + const diffToggles = headerBar[0].getElementsByClassName('BtnGroup float-right') + const selectedToggle = diffToggles[0].querySelector('.selected') as HTMLAnchorElement + return ( + (selectedToggle && selectedToggle.href.includes('diff=split')) || !!document.querySelector('.file-diff-split') + ) } /** @@ -193,7 +190,7 @@ export function getDiffResolvedRev(codeView: HTMLElement): DiffResolvedRevSpec | } if (baseCommitID === '' || headCommitID === '') { - return getDiffResolvedRevFromPageSource(document.documentElement!.innerHTML, isPullRequest!) + return getDiffResolvedRevFromPageSource(document.documentElement.innerHTML, isPullRequest!) } return { baseCommitID, headCommitID } } @@ -216,7 +213,7 @@ function getResolvedDiffFromCommentedSnippet(codeView: HTMLElement): DiffResolve } const headCommitID = match[3] // The file header may not contain the base commit ID, so we get it from the page source. - const resolvedRevFromPageSource = getDiffResolvedRevFromPageSource(document.documentElement!.innerHTML, true) + const resolvedRevFromPageSource = getDiffResolvedRevFromPageSource(document.documentElement.innerHTML, true) return headCommitID && resolvedRevFromPageSource ? { ...resolvedRevFromPageSource, @@ -226,9 +223,7 @@ function getResolvedDiffFromCommentedSnippet(codeView: HTMLElement): DiffResolve } function getResolvedDiffForCompare(): DiffResolvedRevSpec | undefined { - const branchElements = document.querySelectorAll('.commitish-suggester .select-menu-button span') as NodeListOf< - HTMLSpanElement - > + const branchElements = document.querySelectorAll('.commitish-suggester .select-menu-button span') if (branchElements && branchElements.length === 2) { return { baseCommitID: branchElements[0].innerText, headCommitID: branchElements[1].innerText } } @@ -344,7 +339,7 @@ function getBranchName(): string | null { return null } // otherwise, the branch name is fully rendered in the button - return (innerButtonEls[0] as HTMLElement).innerText as string + return (innerButtonEls[0] as HTMLElement).innerText } function getRevOrBranch(revAndPath: string): string | null { diff --git a/client/browser/src/libs/gitlab/code_intelligence.ts b/client/browser/src/libs/gitlab/code_intelligence.ts index 311b93d637a..bca5f56a7cd 100644 --- a/client/browser/src/libs/gitlab/code_intelligence.ts +++ b/client/browser/src/libs/gitlab/code_intelligence.ts @@ -10,7 +10,7 @@ const toolbarButtonProps = { } export function checkIsGitlab(): boolean { - return !!document.head!.querySelector('meta[content="GitLab"]') + return !!document.head.querySelector('meta[content="GitLab"]') } const adjustOverlayPosition: CodeHost['adjustOverlayPosition'] = ({ top, left }) => { diff --git a/client/browser/src/libs/gitlab/scrape.ts b/client/browser/src/libs/gitlab/scrape.ts index d5315859678..e3c515a0a02 100644 --- a/client/browser/src/libs/gitlab/scrape.ts +++ b/client/browser/src/libs/gitlab/scrape.ts @@ -157,7 +157,7 @@ export function getHeadCommitIDFromCodeView(codeView: HTMLElement): FileInfo['co throw buildFileError('no-commit-sha') } - const commitAnchor = commitSHA.closest('a')! as HTMLAnchorElement + const commitAnchor = commitSHA.closest('a')! const revMatch = new URL(commitAnchor.href).pathname.match(/blob\/(.*?)\//) if (!revMatch) { throw new Error('Unable to determine head revision from code view') diff --git a/client/browser/src/libs/phabricator/backend.tsx b/client/browser/src/libs/phabricator/backend.tsx index b5c0a5f0164..6342234f298 100644 --- a/client/browser/src/libs/phabricator/backend.tsx +++ b/client/browser/src/libs/phabricator/backend.tsx @@ -102,13 +102,13 @@ interface ConduitDiffDetailsResponse { } function createConduitRequestForm(): FormData { - const searchForm = document.querySelector('.phabricator-search-menu form') as any + const searchForm = document.querySelector('.phabricator-search-menu form') if (!searchForm) { throw new Error('cannot create conduit request form') } const form = new FormData() - form.set('__csrf__', searchForm.querySelector('input[name=__csrf__]')!.value) - form.set('__form__', searchForm.querySelector('input[name=__form__]')!.value) + form.set('__csrf__', searchForm.querySelector('input[name=__csrf__]')!.value) + form.set('__form__', searchForm.querySelector('input[name=__form__]')!.value) return form } @@ -316,9 +316,8 @@ export function getRepoDetailsFromCallsign(callsign: string): Promise resolve(details)) - } else { - return reject(new Error('could not parse repo details')) } + return reject(new Error('could not parse repo details')) }) }) .catch(reject) @@ -394,9 +393,8 @@ function getRepoDetailsFromRepoPHID(phid: string): Promise { resolve(details) }) - } else { - return reject(new Error('could not parse repo details')) } + return reject(new Error('could not parse repo details')) }) }) .catch(reject) @@ -423,29 +421,28 @@ function convertConduitRepoToRepoDetails(repo: ConduitRepo): Promise { getPhabricatorCSS() .then(css => { - const style = document.createElement('style') as HTMLStyleElement + const style = document.createElement('style') style.setAttribute('type', 'text/css') style.id = 'sourcegraph-styles' style.textContent = css diff --git a/client/browser/src/libs/phabricator/file_info.ts b/client/browser/src/libs/phabricator/file_info.ts index 1a5c73a99d6..f2b0961ec52 100644 --- a/client/browser/src/libs/phabricator/file_info.ts +++ b/client/browser/src/libs/phabricator/file_info.ts @@ -23,7 +23,7 @@ export const resolveRevisionFileInfo = (codeView: HTMLElement): Observable { const fetchingBaseFile = fetchBlobContentLines({ repoName: info.repoName, - filePath: info.filePath || info.filePath, + filePath: info.filePath, commitID: info.baseCommitID, }) @@ -151,7 +151,7 @@ export const resolveDiffusionFileInfo = (codeView: HTMLElement): Observable { const fetchingBaseFile = fetchBlobContentLines({ repoName: info.repoName, - filePath: info.filePath || info.filePath, + filePath: info.filePath, commitID: info.commitID, }) diff --git a/client/browser/src/libs/phabricator/util.tsx b/client/browser/src/libs/phabricator/util.tsx index ff2c5208993..b62a81e8081 100644 --- a/client/browser/src/libs/phabricator/util.tsx +++ b/client/browser/src/libs/phabricator/util.tsx @@ -71,7 +71,7 @@ function getMaxDiffFromTabView(): { diffID: number; revDescription: string } | n continue } const revDescription = (link.parentNode!.parentNode!.childNodes[2].childNodes[0] as any).href - const shaMatch = TAG_PATTERN.exec(revDescription!) + const shaMatch = TAG_PATTERN.exec(revDescription) if (!shaMatch) { continue } diff --git a/client/browser/src/shared/backend/diffs.tsx b/client/browser/src/shared/backend/diffs.tsx index e129d885b4c..0cf97462073 100644 --- a/client/browser/src/shared/backend/diffs.tsx +++ b/client/browser/src/shared/backend/diffs.tsx @@ -40,7 +40,7 @@ export const queryRepositoryComparisonFileDiffs = memoizeObservable( if (!data || !data.repository) { throw createAggregateError(errors) } - const repo = data.repository as GQL.IRepository + const repo = data.repository if (!repo.comparison || !repo.comparison.fileDiffs || errors) { throw createAggregateError(errors) } diff --git a/client/browser/src/shared/backend/graphql.test.tsx b/client/browser/src/shared/backend/graphql.test.tsx index 6787c80b815..9299c0d8984 100644 --- a/client/browser/src/shared/backend/graphql.test.tsx +++ b/client/browser/src/shared/backend/graphql.test.tsx @@ -121,7 +121,7 @@ describe('requestGraphQL()', () => { }) it('errors if the repository is private and the user is logged out of his private instance', async () => { - const ajaxRequest = () => throwError({ status: 401 }) + const ajaxRequest = () => throwError(Object.assign(new Error(), { status: 401 })) await expect( requestGraphQL({ ctx: MOCK_CONTEXT_PRIVATE, @@ -137,7 +137,7 @@ describe('requestGraphQL()', () => { }) it('errors without retrying the user is logged out of his private instance and retry is false', async () => { - const ajaxRequest = () => throwError({ status: 401 }) + const ajaxRequest = () => throwError(Object.assign(new Error(), { status: 401 })) await expect( requestGraphQL({ ctx: MOCK_CONTEXT_PRIVATE, diff --git a/client/browser/src/shared/backend/lsp.tsx b/client/browser/src/shared/backend/lsp.tsx index a197e89bb5d..0b0884d4fa5 100644 --- a/client/browser/src/shared/backend/lsp.tsx +++ b/client/browser/src/shared/backend/lsp.tsx @@ -19,7 +19,7 @@ export const toTextDocumentIdentifier = (pos: RepoSpec & ResolvedRevSpec & FileS const toTextDocumentPositionParams = (pos: AbsoluteRepoFilePosition): TextDocumentPositionParams => ({ textDocument: toTextDocumentIdentifier(pos), position: { - character: pos.position.character! - 1, + character: pos.position.character - 1, line: pos.position.line - 1, }, }) diff --git a/client/browser/src/shared/backend/server.ts b/client/browser/src/shared/backend/server.ts index 37267dddc0a..8ddbc453f22 100644 --- a/client/browser/src/shared/backend/server.ts +++ b/client/browser/src/shared/backend/server.ts @@ -1,7 +1,6 @@ import { Observable } from 'rxjs' import { catchError, map } from 'rxjs/operators' import * as GQL from '../../../../../shared/src/graphql/schema' -import { IClientConfigurationDetails } from '../../../../../shared/src/graphql/schema' import { isOptions } from '../../context' import { sourcegraphUrl } from '../util/context' import { getContext } from './context' @@ -11,7 +10,7 @@ import { queryGraphQL } from './graphql' * @return Observable that emits the client configuration details. * Errors */ -export const resolveClientConfiguration = (): Observable => +export const resolveClientConfiguration = (): Observable => queryGraphQL({ ctx: getContext({ repoKey: '' }), request: `query ClientConfiguration() { diff --git a/client/browser/src/shared/backend/userEvents.tsx b/client/browser/src/shared/backend/userEvents.tsx index f64d00b167e..92067a77d42 100644 --- a/client/browser/src/shared/backend/userEvents.tsx +++ b/client/browser/src/shared/backend/userEvents.tsx @@ -24,11 +24,13 @@ export const logUserEvent = (event: string, uid: string): void => { }`, variables: { event, userCookieID: uid }, retry: false, - }).subscribe(undefined, error => { - // Swallow errors. If a Sourcegraph instance isn't upgraded, this request may fail - // (e.g., if CODEINTELINTEGRATION user events aren't yet supported). - // However, end users shouldn't experience this failure, as their admin is - // responsible for updating the instance, and has been (or will be) notified - // that an upgrade is available via site-admin messaging. + }).subscribe({ + error: error => { + // Swallow errors. If a Sourcegraph instance isn't upgraded, this request may fail + // (e.g., if CODEINTELINTEGRATION user events aren't yet supported). + // However, end users shouldn't experience this failure, as their admin is + // responsible for updating the instance, and has been (or will be) notified + // that an upgrade is available via site-admin messaging. + }, }) } diff --git a/client/browser/src/shared/repo/backend.tsx b/client/browser/src/shared/repo/backend.tsx index 168ec30423e..28b973428f0 100644 --- a/client/browser/src/shared/repo/backend.tsx +++ b/client/browser/src/shared/repo/backend.tsx @@ -141,7 +141,7 @@ export const fetchBlobContentLines = memoizeObservable( ) { return [] } - return data.repository.commit.file!.content.split('\n') + return data.repository.commit.file.content.split('\n') }), catchError(({ errors, ...rest }) => { if (errors && errors.length === 1) { diff --git a/package.json b/package.json index 42406b99ee1..2b2f37d1adf 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "@sourcegraph/prettierrc": "^2.2.0", "@sourcegraph/stylelint-config": "^1.1.2", "@sourcegraph/tsconfig": "^4.0.0", - "@sourcegraph/tslint-config": "^12.3.1", + "@sourcegraph/tslint-config": "^13.0.0", "@storybook/addon-actions": "^4.1.4", "@storybook/addon-console": "^1.1.0", "@storybook/addon-info": "^4.1.4", @@ -173,7 +173,7 @@ "ts-jest": "^24.0.0", "ts-loader": "^5.3.2", "ts-node": "^7.0.1", - "tslint": "^5.12.0", + "tslint": "^5.15.0", "tslint-language-service": "^0.9.9", "typedoc": "^0.14.0", "typescript": "^3.4.1", diff --git a/shared/src/api/client/api/codeEditor.ts b/shared/src/api/client/api/codeEditor.ts index b48e6665095..68222b5e0a4 100644 --- a/shared/src/api/client/api/codeEditor.ts +++ b/shared/src/api/client/api/codeEditor.ts @@ -39,6 +39,7 @@ export class ClientCodeEditor implements ClientCodeEditorAPI { } public $setDecorations(resource: string, decorationType: string, decorations: TextDocumentDecoration[]): void { + // tslint:disable-next-line: rxjs-no-ignored-observable this.getDecorationsSubject(resource, decorationType, decorations) } diff --git a/shared/src/api/client/context/expr/lexer.ts b/shared/src/api/client/context/expr/lexer.ts index 51303eaba15..bc9bd15a95f 100644 --- a/shared/src/api/client/context/expr/lexer.ts +++ b/shared/src/api/client/context/expr/lexer.ts @@ -316,7 +316,8 @@ export class Lexer { if (ch === quote) { terminated = true break - } else if (ch === '\\') { + } + if (ch === '\\') { str += backslashEscapeCodeString(this.getNextChar()) } else { str += ch @@ -356,7 +357,8 @@ export class Lexer { tail = true terminated = true break - } else if (ch === '\\') { + } + if (ch === '\\') { str += backslashEscapeCodeString(this.getNextChar()) } else { if (ch === '$') { diff --git a/shared/src/api/client/services/contribution.test.ts b/shared/src/api/client/services/contribution.test.ts index 2d7bda26932..bbf0a3c847b 100644 --- a/shared/src/api/client/services/contribution.test.ts +++ b/shared/src/api/client/services/contribution.test.ts @@ -1,5 +1,4 @@ -import { Observable, of } from 'rxjs' -import { Subscription } from 'rxjs' +import { Observable, of, Subscription } from 'rxjs' import { TestScheduler } from 'rxjs/testing' import { EMPTY_SETTINGS_CASCADE, SettingsCascadeOrError } from '../../../settings/settings' import { ContributableMenu, Contributions, EvaluatedContributions } from '../../protocol' diff --git a/shared/src/api/client/services/decoration.test.ts b/shared/src/api/client/services/decoration.test.ts index c4664d07b1c..2a1f5b67804 100644 --- a/shared/src/api/client/services/decoration.test.ts +++ b/shared/src/api/client/services/decoration.test.ts @@ -106,7 +106,7 @@ describe('getDecorations', () => { FIXTURE.TextDocumentIdentifier ) ).toBe('-a-|', { - a: [...FIXTURE_RESULT!, ...FIXTURE_RESULT!], + a: [...FIXTURE_RESULT, ...FIXTURE_RESULT], }) )) }) diff --git a/shared/src/api/client/services/extensionsService.test.ts b/shared/src/api/client/services/extensionsService.test.ts index a4722e5e63a..302157520b9 100644 --- a/shared/src/api/client/services/extensionsService.test.ts +++ b/shared/src/api/client/services/extensionsService.test.ts @@ -173,7 +173,7 @@ describe('activeExtensions', () => { }, enabledExtensions => enabledExtensions, cold('a-|', { a: 'bar' }), - () => throwError('baz') + () => throwError(new Error('baz')) ).activeExtensions ) ).toBe('a-|', { diff --git a/shared/src/api/client/services/extensionsService.ts b/shared/src/api/client/services/extensionsService.ts index 282e0720569..1d2995028e2 100644 --- a/shared/src/api/client/services/extensionsService.ts +++ b/shared/src/api/client/services/extensionsService.ts @@ -185,10 +185,12 @@ function extensionsWithMatchedActivationEvent( console.warn(`Extension ${x.id} was not found. Remove it from settings to suppress this warning.`) } return false - } else if (isErrorLike(x.manifest)) { + } + if (isErrorLike(x.manifest)) { console.warn(x.manifest) return false - } else if (!x.manifest.activationEvents) { + } + if (!x.manifest.activationEvents) { console.warn(`Extension ${x.id} has no activation events, so it will never be activated.`) return false } diff --git a/shared/src/api/client/services/hover.test.ts b/shared/src/api/client/services/hover.test.ts index 7b42f03a4d9..dfd713c0e66 100644 --- a/shared/src/api/client/services/hover.test.ts +++ b/shared/src/api/client/services/hover.test.ts @@ -87,7 +87,7 @@ describe('getHover', () => { expectObservable( getHover( cold('-a-|', { - a: [() => of(FIXTURE_RESULT), () => throwError('err')], + a: [() => of(FIXTURE_RESULT), () => throwError(new Error('err'))], }), FIXTURE.TextDocumentPositionParams, false diff --git a/shared/src/api/client/services/location.test.ts b/shared/src/api/client/services/location.test.ts index 1c76284465c..d59fc668134 100644 --- a/shared/src/api/client/services/location.test.ts +++ b/shared/src/api/client/services/location.test.ts @@ -143,7 +143,7 @@ describe('getLocationsFromProviders', () => { expectObservable( getLocationsFromProviders( cold('-a-|', { - a: [() => of([FIXTURE_LOCATION]), () => throwError('x')], + a: [() => of([FIXTURE_LOCATION]), () => throwError(new Error('x'))], }), FIXTURE.TextDocumentPositionParams, false diff --git a/shared/src/api/client/services/view.test.ts b/shared/src/api/client/services/view.test.ts index 5e24540f16c..05ccd003933 100644 --- a/shared/src/api/client/services/view.test.ts +++ b/shared/src/api/client/services/view.test.ts @@ -109,7 +109,7 @@ describe('getViews', () => { a: [ { registrationOptions: { container: FIXTURE_CONTAINER, id: 'err' }, - provider: throwError('err'), + provider: throwError(new Error('err')), }, FIXTURE_ENTRY_1, ], diff --git a/shared/src/api/client/types/textDocument.ts b/shared/src/api/client/types/textDocument.ts index 2bb36f98bd3..4274e2c211f 100644 --- a/shared/src/api/client/types/textDocument.ts +++ b/shared/src/api/client/types/textDocument.ts @@ -80,11 +80,11 @@ function score1(selector: DocumentSelector[0], candidateUri: string, candidateLa // Shorthand notation: "mylang" -> {language: "mylang"}, "*" -> {language: "*""}. if (selector === '*') { return 5 - } else if (selector === candidateLanguage) { - return 10 - } else { - return 0 } + if (selector === candidateLanguage) { + return 10 + } + return 0 } const { language, scheme, pattern } = selector diff --git a/shared/src/api/extension/types/errors.ts b/shared/src/api/extension/types/errors.ts index 017fe025863..5f79d2e8f3e 100644 --- a/shared/src/api/extension/types/errors.ts +++ b/shared/src/api/extension/types/errors.ts @@ -1,7 +1,6 @@ export function illegalArgument(name?: string): Error { if (name) { return new Error(`Illegal argument: ${name}`) - } else { - return new Error('Illegal argument') } + return new Error('Illegal argument') } diff --git a/shared/src/api/extension/types/position.ts b/shared/src/api/extension/types/position.ts index df214bb2512..d273df93de4 100644 --- a/shared/src/api/extension/types/position.ts +++ b/shared/src/api/extension/types/position.ts @@ -103,19 +103,19 @@ export class Position { public compareTo(other: sourcegraph.Position): number { if (this._line < other.line) { return -1 - } else if (this._line > other.line) { - return 1 - } else { - // equal line - if (this._character < other.character) { - return -1 - } else if (this._character > other.character) { - return 1 - } else { - // equal line and character - return 0 - } } + if (this._line > other.line) { + return 1 + } + // equal line + if (this._character < other.character) { + return -1 + } + if (this._character > other.character) { + return 1 + } + // equal line and character + return 0 } public translate(lineDelta?: number, characterDelta?: number): sourcegraph.Position diff --git a/shared/src/api/extension/types/range.ts b/shared/src/api/extension/types/range.ts index 697ec6f01ba..7c8752c015b 100644 --- a/shared/src/api/extension/types/range.ts +++ b/shared/src/api/extension/types/range.ts @@ -65,7 +65,8 @@ export class Range implements sourcegraph.Range { public contains(positionOrRange: sourcegraph.Position | sourcegraph.Range): boolean { if (positionOrRange instanceof Range) { return this.contains(positionOrRange._start) && this.contains(positionOrRange._end) - } else if (positionOrRange instanceof Position) { + } + if (positionOrRange instanceof Position) { if (positionOrRange.isBefore(this._start)) { return false } @@ -96,7 +97,8 @@ export class Range implements sourcegraph.Range { public union(other: sourcegraph.Range): sourcegraph.Range { if (this.contains(other)) { return this - } else if (other.contains(this)) { + } + if (other.contains(this)) { return other } const start = Position.min(other.start, this._start) diff --git a/shared/src/api/integration-test/languageFeatures.test.ts b/shared/src/api/integration-test/languageFeatures.test.ts index a589177dedc..ae671280c63 100644 --- a/shared/src/api/integration-test/languageFeatures.test.ts +++ b/shared/src/api/integration-test/languageFeatures.test.ts @@ -2,7 +2,6 @@ import { Location } from '@sourcegraph/extension-api-types' import { asyncScheduler, Observable, of } from 'rxjs' import { observeOn, switchMap, take, toArray } from 'rxjs/operators' import * as sourcegraph from 'sourcegraph' -import { languages as sourcegraphLanguages } from 'sourcegraph' import { Services } from '../client/services' import { assertToJSON } from '../extension/types/testHelpers' import { createBarrier, integrationTestContext } from './testHelpers' @@ -107,7 +106,7 @@ function testLocationProvider

({ providerWithImplementation, getResult, }: { - name: keyof typeof sourcegraphLanguages + name: keyof typeof sourcegraph.languages registerProvider: ( extensionAPI: typeof sourcegraph ) => (selector: sourcegraph.DocumentSelector, provider: P) => sourcegraph.Unsubscribable diff --git a/shared/src/components/FileMatchChildren.tsx b/shared/src/components/FileMatchChildren.tsx index 9065bc56c45..f9c46ec40db 100644 --- a/shared/src/components/FileMatchChildren.tsx +++ b/shared/src/components/FileMatchChildren.tsx @@ -95,7 +95,7 @@ export const FileMatchChildren: React.FunctionComponent = props ))} {groupsOfItems.map(items => { - const item = items[0]! + const item = items[0] const position = { line: item.line + 1, character: item.character + 1 } return ( extensionIDsFromSettings(settings)), distinctUntilChanged((a, b) => isEqual(a, b)), - switchMap(extensionIDs => - queryConfiguredRegistryExtensions({ queryGraphQL }, extensionIDs).pipe(startWith(LOADING)) - ), - catchError(error => [asError(error) as ErrorLike]), - filter((extensions): extensions is ConfiguredRegistryExtension[] | ErrorLike => extensions !== LOADING), - switchMap(extensions => (isErrorLike(extensions) ? throwError(extensions) : [extensions])), + switchMap(extensionIDs => queryConfiguredRegistryExtensions({ queryGraphQL }, extensionIDs)), + catchError(error => throwError(asError(error))), publishReplay(), refCount() ) @@ -52,6 +37,10 @@ export function queryConfiguredRegistryExtensions( if (extensionIDs.length === 0) { return of([]) } + const variables: GQL.IExtensionsOnExtensionRegistryArguments = { + first: extensionIDs.length, + prioritizeExtensionIDs: extensionIDs, + } return from( queryGraphQL( gql` @@ -71,10 +60,7 @@ export function queryConfiguredRegistryExtensions( } } `[graphQLContent], - { - first: extensionIDs.length, - prioritizeExtensionIDs: extensionIDs, - } as GQL.IExtensionsOnExtensionRegistryArguments, + variables, false ) ).pipe( diff --git a/shared/src/highlight/contributions.ts b/shared/src/highlight/contributions.ts index af2874d2d35..d1e313c0925 100644 --- a/shared/src/highlight/contributions.ts +++ b/shared/src/highlight/contributions.ts @@ -16,6 +16,7 @@ export function registerHighlightContributions(): void { return } registered = true + // tslint:disable no-require-imports registerLanguage('go', require('highlight.js/lib/languages/go')) registerLanguage('javascript', require('highlight.js/lib/languages/javascript')) registerLanguage('typescript', require('highlight.js/lib/languages/typescript')) @@ -43,4 +44,5 @@ export function registerHighlightContributions(): void { registerLanguage('yaml', require('highlight.js/lib/languages/yaml')) registerLanguage('kotlin', require('highlight.js/lib/languages/kotlin')) registerLanguage('dart', require('highlight.js/lib/languages/dart')) + // tslint:enable no-require-imports } diff --git a/shared/src/hover/actions.ts b/shared/src/hover/actions.ts index 54e8bea404a..f4b7fd9b5e0 100644 --- a/shared/src/hover/actions.ts +++ b/shared/src/hover/actions.ts @@ -139,8 +139,7 @@ export function getHoverActionsContext( definitionURLOrError !== LOADING && !isErrorLike(definitionURLOrError) && definitionURLOrError === null, - 'goToDefinition.error': - isErrorLike(definitionURLOrError) && ((definitionURLOrError as any).stack as any), + 'goToDefinition.error': isErrorLike(definitionURLOrError) && (definitionURLOrError as any).stack, 'findReferences.url': hasReferenceProvider && showFindReferences diff --git a/shared/src/panel/views/FileLocations.tsx b/shared/src/panel/views/FileLocations.tsx index 501aab6c203..36da09815a9 100644 --- a/shared/src/panel/views/FileLocations.tsx +++ b/shared/src/panel/views/FileLocations.tsx @@ -11,8 +11,7 @@ import { FetchFileCtx } from '../../components/CodeExcerpt' import { FileMatch, IFileMatch, ILineMatch } from '../../components/FileMatch' import { VirtualList } from '../../components/VirtualList' import { SettingsCascadeProps } from '../../settings/settings' -import { asError } from '../../util/errors' -import { ErrorLike, isErrorLike } from '../../util/errors' +import { asError, ErrorLike, isErrorLike } from '../../util/errors' import { propertyIsDefined } from '../../util/types' import { parseRepoURI, toPrettyBlobURL } from '../../util/url' diff --git a/shared/src/panel/views/HierarchicalLocationsView.tsx b/shared/src/panel/views/HierarchicalLocationsView.tsx index 8d76bab6542..adb98e8ee36 100644 --- a/shared/src/panel/views/HierarchicalLocationsView.tsx +++ b/shared/src/panel/views/HierarchicalLocationsView.tsx @@ -10,8 +10,7 @@ import { RepoLink } from '../../components/RepoLink' import { Resizable } from '../../components/Resizable' import { ExtensionsControllerProps } from '../../extensions/controller' import { SettingsCascadeProps } from '../../settings/settings' -import { ErrorLike, isErrorLike } from '../../util/errors' -import { asError } from '../../util/errors' +import { asError, ErrorLike, isErrorLike } from '../../util/errors' import { parseRepoURI } from '../../util/url' import { registerPanelToolbarContributions } from './contributions' import { FileLocations, FileLocationsError, FileLocationsNotFound } from './FileLocations' diff --git a/shared/src/settings/settings.test.ts b/shared/src/settings/settings.test.ts index 336aacc972e..6a4cfc64be0 100644 --- a/shared/src/settings/settings.test.ts +++ b/shared/src/settings/settings.test.ts @@ -1,4 +1,4 @@ -import { createAggregateError, ErrorLike, isErrorLike } from '../util/errors' +import { createAggregateError, isErrorLike } from '../util/errors' import { CustomMergeFunctions, gqlToCascade, @@ -39,18 +39,20 @@ const FIXTURE_USER_WITH_SETTINGS_ERROR: SettingsSubject & SubjectSettingsContent const SETTINGS_ERROR_FOR_FIXTURE_USER = createAggregateError([new Error('parse error (code: 0, offset: 0, length: 1)')]) describe('gqlToCascade', () => { - test('converts a value', () => - expect( - gqlToCascade({ - subjects: [FIXTURE_ORG, FIXTURE_USER], - }) - ).toEqual({ + test('converts a value', () => { + const expected: SettingsCascade = { subjects: [ { subject: FIXTURE_ORG, settings: { a: 1 }, lastID: 1 }, { subject: FIXTURE_USER, settings: { b: 2 }, lastID: 2 }, ], final: { a: 1, b: 2 }, - } as SettingsCascade)) + } + expect( + gqlToCascade({ + subjects: [FIXTURE_ORG, FIXTURE_USER], + }) + ).toEqual(expected) + }) test('preserves errors', () => { const value = gqlToCascade({ subjects: [FIXTURE_ORG, FIXTURE_USER_WITH_SETTINGS_ERROR, FIXTURE_USER], @@ -60,7 +62,7 @@ describe('gqlToCascade', () => { value.subjects && !isErrorLike(value.subjects) && isErrorLike(value.subjects[1].settings) && - (value.subjects[1].settings as ErrorLike).message + value.subjects[1].settings.message ).toBe(SETTINGS_ERROR_FOR_FIXTURE_USER.message) }) }) diff --git a/shared/src/util/dom.tsx b/shared/src/util/dom.tsx index 213bdfa2881..159eb70f569 100644 --- a/shared/src/util/dom.tsx +++ b/shared/src/util/dom.tsx @@ -134,10 +134,9 @@ function highlightNodeHelper( ) if (res.highlightingCompleted) { return res - } else { - currOffset += res.charsConsumed - charsHighlighted += res.charsHighlighted } + currOffset += res.charsConsumed + charsHighlighted += res.charsHighlighted break } } diff --git a/shared/src/util/memoizeObservable.ts b/shared/src/util/memoizeObservable.ts index 38836e5dddb..04f314128ab 100644 --- a/shared/src/util/memoizeObservable.ts +++ b/shared/src/util/memoizeObservable.ts @@ -42,8 +42,10 @@ export function memoizeObservable( const obs = func(params).pipe( publishReplay(), refCount(), - tap(undefined as any, e => { - cache.delete(key) + tap({ + error: () => { + cache.delete(key) + }, }) ) cache.set(key, obs) diff --git a/web/src/SourcegraphWebApp.tsx b/web/src/SourcegraphWebApp.tsx index 0ac5abab4cc..e5993af161f 100644 --- a/web/src/SourcegraphWebApp.tsx +++ b/web/src/SourcegraphWebApp.tsx @@ -159,16 +159,11 @@ export class SourcegraphWebApp extends React.Component { if (authenticatedUser) { return { viewerSubject: authenticatedUser } - } else if ( - cascade && - !isErrorLike(cascade) && - cascade.subjects && - cascade.subjects.length > 0 - ) { - return { viewerSubject: cascade.subjects[0].subject } - } else { - return { viewerSubject: SITE_SUBJECT_NO_ADMIN } } + if (cascade && !isErrorLike(cascade) && cascade.subjects && cascade.subjects.length > 0) { + return { viewerSubject: cascade.subjects[0].subject } + } + return { viewerSubject: SITE_SUBJECT_NO_ADMIN } }) } ) diff --git a/web/src/api/APIConsole.tsx b/web/src/api/APIConsole.tsx index e85eb9fee69..f7b2df4360c 100644 --- a/web/src/api/APIConsole.tsx +++ b/web/src/api/APIConsole.tsx @@ -5,8 +5,7 @@ import { upperFirst } from 'lodash' import * as React from 'react' import { Link } from 'react-router-dom' import { from as fromPromise, Subject, Subscription } from 'rxjs' -import { catchError } from 'rxjs/operators' -import { debounceTime } from 'rxjs/operators' +import { catchError, debounceTime } from 'rxjs/operators' import { asError, ErrorLike, isErrorLike } from '../../../shared/src/util/errors' import { eventLogger } from '../tracking/eventLogger' diff --git a/web/src/auth/ResetPasswordPage.tsx b/web/src/auth/ResetPasswordPage.tsx index 492bf6653bc..d5b80389f98 100644 --- a/web/src/auth/ResetPasswordPage.tsx +++ b/web/src/auth/ResetPasswordPage.tsx @@ -224,7 +224,7 @@ export class ResetPasswordPage extends React.PureComponent } else { body =

The password reset link you followed is invalid.
diff --git a/web/src/auth/SignUpPage.tsx b/web/src/auth/SignUpPage.tsx index e25d31dba03..3f2ce711b56 100644 --- a/web/src/auth/SignUpPage.tsx +++ b/web/src/auth/SignUpPage.tsx @@ -4,8 +4,7 @@ import { upperFirst } from 'lodash' import HelpCircleOutlineIcon from 'mdi-react/HelpCircleOutlineIcon' import UserIcon from 'mdi-react/UserIcon' import * as React from 'react' -import { Redirect } from 'react-router-dom' -import { Link } from 'react-router-dom' +import { Link, Redirect } from 'react-router-dom' import { from, Subscription } from 'rxjs' import * as GQL from '../../../shared/src/graphql/schema' import { asError } from '../../../shared/src/util/errors' diff --git a/web/src/backend/graphql.tsx b/web/src/backend/graphql.tsx index 9b5c9f0a887..3828134ffae 100644 --- a/web/src/backend/graphql.tsx +++ b/web/src/backend/graphql.tsx @@ -43,7 +43,7 @@ export function requestGraphQL( * @return Observable That emits the result or errors if the HTTP request failed */ export function queryGraphQL(query: GraphQLDocument, variables: any = {}): Observable> { - return requestGraphQL(query, variables) as Observable> + return requestGraphQL(query, variables) } /** @@ -57,5 +57,5 @@ export function mutateGraphQL( mutation: GraphQLDocument, variables: any = {} ): Observable> { - return requestGraphQL(mutation, variables) as Observable> + return requestGraphQL(mutation, variables) } diff --git a/web/src/components/DismissibleAlert.tsx b/web/src/components/DismissibleAlert.tsx index d5069badb40..5498940a3fc 100644 --- a/web/src/components/DismissibleAlert.tsx +++ b/web/src/components/DismissibleAlert.tsx @@ -22,7 +22,7 @@ export class DismissibleAlert extends React.PureComponent { constructor(props: Props) { super(props) - this.key = 'DismissibleAlert/' + props.partialStorageKey + '/dismissed' + this.key = `DismissibleAlert/${props.partialStorageKey}/dismissed` this.state = { dismissed: localStorage.getItem(this.key) === 'true', diff --git a/web/src/components/ExternalServiceCard.tsx b/web/src/components/ExternalServiceCard.tsx index d40dc41433b..dc20e6cfe05 100644 --- a/web/src/components/ExternalServiceCard.tsx +++ b/web/src/components/ExternalServiceCard.tsx @@ -60,8 +60,7 @@ export class ExternalServiceCard extends React.PureComponent ) - } else { - return
{cardContent}
} + return
{cardContent}
} } diff --git a/web/src/components/FilteredConnection.tsx b/web/src/components/FilteredConnection.tsx index 9c70fb8b8b1..6d030cfd81a 100644 --- a/web/src/components/FilteredConnection.tsx +++ b/web/src/components/FilteredConnection.tsx @@ -507,12 +507,11 @@ export class FilteredConnection = Connection .pipe( catchError(error => [asError(error)]), map( - c => - ({ - connectionOrError: c, - connectionQuery: query, - loading: false, - } as PartialStateUpdate) + (c): PartialStateUpdate => ({ + connectionOrError: c, + connectionQuery: query, + loading: false, + }) ), publishReplay(), refCount() diff --git a/web/src/components/Overview.tsx b/web/src/components/Overview.tsx index 667d8489a58..c3cc0c35e88 100644 --- a/web/src/components/Overview.tsx +++ b/web/src/components/Overview.tsx @@ -98,17 +98,16 @@ export class OverviewItem extends React.Component { )} ) - } else { - return ( -
-
{e}
- {actions} - {this.props.children && this.state.expanded && ( -
{this.props.children}
- )} -
- ) } + return ( +
+
{e}
+ {actions} + {this.props.children && this.state.expanded && ( +
{this.props.children}
+ )} +
+ ) } private toggleExpand = () => this.setState(prevState => ({ expanded: !prevState.expanded })) diff --git a/web/src/components/SearchResultMatch.tsx b/web/src/components/SearchResultMatch.tsx index c0f8051d387..8657fb56d88 100644 --- a/web/src/components/SearchResultMatch.tsx +++ b/web/src/components/SearchResultMatch.tsx @@ -1,8 +1,6 @@ import { LoadingSpinner } from '@sourcegraph/react-loading-spinner' import { decode } from 'he' -import { isEqual } from 'lodash' -import { range } from 'lodash' -import { escapeRegExp } from 'lodash' +import { escapeRegExp, isEqual, range } from 'lodash' import React from 'react' import { Link } from 'react-router-dom' import VisibilitySensor from 'react-visibility-sensor' diff --git a/web/src/components/d3/BarChart.tsx b/web/src/components/d3/BarChart.tsx index aca933166c1..1c1ec84a5ff 100644 --- a/web/src/components/d3/BarChart.tsx +++ b/web/src/components/d3/BarChart.tsx @@ -85,7 +85,7 @@ export class BarChart extends React.Component .range(barColors) const xAxis = axisBottom(x) - const svg = select(this.svgRef!) + const svg = select(this.svgRef) svg.selectAll('*').remove() const barWidth = width / columns - 2 @@ -139,7 +139,7 @@ export class BarChart extends React.Component barHolder .append('g') .classed('axis', true) - .attr('transform', 'translate(0,' + height + ')') + .attr('transform', `translate(0, ${height})`) .call(xAxis) .selectAll('.tick text') .call(wrapLabel, barWidth) diff --git a/web/src/components/tooltip/Tooltip.tsx b/web/src/components/tooltip/Tooltip.tsx index 774ee35f6fd..aff8b442476 100644 --- a/web/src/components/tooltip/Tooltip.tsx +++ b/web/src/components/tooltip/Tooltip.tsx @@ -31,8 +31,7 @@ export class Tooltip extends React.PureComponent { const instance = Tooltip.INSTANCE if (instance) { instance.setState(prevState => { - const subject = - prevState.lastEventTarget && instance.getSubject(prevState.lastEventTarget as HTMLElement) + const subject = prevState.lastEventTarget && instance.getSubject(prevState.lastEventTarget) return { subject, content: subject ? instance.getContent(subject) : undefined, diff --git a/web/src/enterprise/extensions/registry/backend.ts b/web/src/enterprise/extensions/registry/backend.ts index 34e80433d4e..595b718264a 100644 --- a/web/src/enterprise/extensions/registry/backend.ts +++ b/web/src/enterprise/extensions/registry/backend.ts @@ -1,11 +1,9 @@ import { Observable, of } from 'rxjs' import { map, mapTo, switchMap } from 'rxjs/operators' import { gql } from '../../../../../shared/src/graphql/graphql' -import { RegistryPublisher } from '../../../../../shared/src/graphql/schema' import * as GQL from '../../../../../shared/src/graphql/schema' import { createAggregateError } from '../../../../../shared/src/util/errors' -import { queryGraphQL } from '../../../backend/graphql' -import { mutateGraphQL } from '../../../backend/graphql' +import { mutateGraphQL, queryGraphQL } from '../../../backend/graphql' export function deleteRegistryExtensionWithConfirmation(extension: GQL.ID): Observable { return of(window.confirm('Really delete this extension from the extension registry?')).pipe( @@ -41,7 +39,7 @@ export function deleteRegistryExtensionWithConfirmation(extension: GQL.ID): Obse ) } -export function queryViewerRegistryPublishers(): Observable { +export function queryViewerRegistryPublishers(): Observable { return queryGraphQL(gql` query ViewerRegistryPublishers { extensionRegistry { diff --git a/web/src/enterprise/site-admin/dotcom/productSubscriptions/SiteAdminProductSubscriptionPage.tsx b/web/src/enterprise/site-admin/dotcom/productSubscriptions/SiteAdminProductSubscriptionPage.tsx index b4c909c98b2..01af6929c13 100644 --- a/web/src/enterprise/site-admin/dotcom/productSubscriptions/SiteAdminProductSubscriptionPage.tsx +++ b/web/src/enterprise/site-admin/dotcom/productSubscriptions/SiteAdminProductSubscriptionPage.tsx @@ -165,7 +165,7 @@ export class SiteAdminProductSubscriptionPage extends React.Component Archive diff --git a/web/src/enterprise/user/productSubscriptions/ProductSubscriptionForm.tsx b/web/src/enterprise/user/productSubscriptions/ProductSubscriptionForm.tsx index 40363fd54f3..7ed011196de 100644 --- a/web/src/enterprise/user/productSubscriptions/ProductSubscriptionForm.tsx +++ b/web/src/enterprise/user/productSubscriptions/ProductSubscriptionForm.tsx @@ -1,6 +1,5 @@ import { LoadingSpinner } from '@sourcegraph/react-loading-spinner' -import { upperFirst } from 'lodash' -import { isEqual } from 'lodash' +import { isEqual, upperFirst } from 'lodash' import * as React from 'react' import { Link } from 'react-router-dom' import { ReactStripeElements } from 'react-stripe-elements' diff --git a/web/src/enterprise/user/productSubscriptions/UserSubscriptionsProductSubscriptionPage.tsx b/web/src/enterprise/user/productSubscriptions/UserSubscriptionsProductSubscriptionPage.tsx index 9d4050d8624..f38fe71e75e 100644 --- a/web/src/enterprise/user/productSubscriptions/UserSubscriptionsProductSubscriptionPage.tsx +++ b/web/src/enterprise/user/productSubscriptions/UserSubscriptionsProductSubscriptionPage.tsx @@ -110,20 +110,20 @@ export class UserSubscriptionsProductSubscriptionPage extends React.Component, 'id' | 'manifest' | 'registryExtension' > - subject: Pick + subject: Pick } /** Displays an extension as a card. */ diff --git a/web/src/extensions/ExtensionToggle.tsx b/web/src/extensions/ExtensionToggle.tsx index 22832fb89a9..94c315903d7 100644 --- a/web/src/extensions/ExtensionToggle.tsx +++ b/web/src/extensions/ExtensionToggle.tsx @@ -111,11 +111,12 @@ function confirmAddExtension(extensionID: string): boolean { function extractErrors(c: SettingsCascadeOrError): SettingsCascade | ErrorLike { if (c.subjects === null) { return new Error('Subjects was ' + c.subjects) - } else if (c.final === null || isErrorLike(c.final)) { - return new Error('Merged was ' + c.final) - } else if (c.subjects.find(isErrorLike)) { - return new Error('One of the subjects was ' + c.subjects.find(isErrorLike)) - } else { - return c as SettingsCascade } + if (c.final === null || isErrorLike(c.final)) { + return new Error('Merged was ' + c.final) + } + if (c.subjects.find(isErrorLike)) { + return new Error('One of the subjects was ' + c.subjects.find(isErrorLike)) + } + return c as SettingsCascade } diff --git a/web/src/extensions/extension/ExtensionArea.tsx b/web/src/extensions/extension/ExtensionArea.tsx index ffaf14017d1..55ef938eebe 100644 --- a/web/src/extensions/extension/ExtensionArea.tsx +++ b/web/src/extensions/extension/ExtensionArea.tsx @@ -11,8 +11,7 @@ import { gql } from '../../../../shared/src/graphql/graphql' import * as GQL from '../../../../shared/src/graphql/schema' import { PlatformContextProps } from '../../../../shared/src/platform/context' import { SettingsCascadeProps } from '../../../../shared/src/settings/settings' -import { ErrorLike, isErrorLike } from '../../../../shared/src/util/errors' -import { createAggregateError } from '../../../../shared/src/util/errors' +import { createAggregateError, ErrorLike, isErrorLike } from '../../../../shared/src/util/errors' import { queryGraphQL } from '../../backend/graphql' import { ErrorBoundary } from '../../components/ErrorBoundary' import { HeroPage } from '../../components/HeroPage' @@ -134,7 +133,7 @@ export class ExtensionArea extends React.Component { type PartialStateUpdate = Pick return queryExtension(extensionID).pipe( catchError(error => [error]), - map(c => ({ extensionOrError: c } as PartialStateUpdate)), + map((c): PartialStateUpdate => ({ extensionOrError: c })), // Don't clear old data while we reload, to avoid unmounting all components during // loading. diff --git a/web/src/marketing/backend.tsx b/web/src/marketing/backend.tsx index 45e7a470d31..7243deedcc4 100644 --- a/web/src/marketing/backend.tsx +++ b/web/src/marketing/backend.tsx @@ -137,8 +137,10 @@ export const submitTrialRequest = (email: string): void => { map(dataOrThrowErrors), map(() => undefined) ) - .subscribe(undefined, error => { - // Swallow errors since the form submission is a non-blocking request that happens during site-init - // if a trial license key is requested. + .subscribe({ + error: error => { + // Swallow errors since the form submission is a non-blocking request that happens during site-init + // if a trial license key is requested. + }, }) } diff --git a/web/src/nav/NavLinks.test.tsx b/web/src/nav/NavLinks.test.tsx index f738b386e17..7270858d738 100644 --- a/web/src/nav/NavLinks.test.tsx +++ b/web/src/nav/NavLinks.test.tsx @@ -19,16 +19,18 @@ const renderShallow = (element: React.ReactElement): any => { const getDisplayName = (element: React.ReactChild): string | string[] => { if (element === null) { return [] - } else if (typeof element === 'string' || typeof element === 'number') { + } + if (typeof element === 'string' || typeof element === 'number') { return element.toString() - } else if (element.type === 'li' && (element.props.children.props.href || element.props.children.props.to)) { + } + if (element.type === 'li' && (element.props.children.props.href || element.props.children.props.to)) { return `${element.props.children.props.children} ${element.props.children.props.href || element.props.children.props.to}` - } else if (typeof element.type === 'symbol' || typeof element.type === 'string') { - return flatten(React.Children.map(element.props.children, element => getDisplayName(element))) - } else { - return (element.type as any).displayName || element.type.name || 'Unknown' } + if (typeof element.type === 'symbol' || typeof element.type === 'string') { + return flatten(React.Children.map(element.props.children, element => getDisplayName(element))) + } + return (element.type as any).displayName || element.type.name || 'Unknown' } return flatten( diff --git a/web/src/org/area/OrgArea.tsx b/web/src/org/area/OrgArea.tsx index b480a7f97d2..fca201ce271 100644 --- a/web/src/org/area/OrgArea.tsx +++ b/web/src/org/area/OrgArea.tsx @@ -118,7 +118,7 @@ export class OrgArea extends React.Component { type PartialStateUpdate = Pick return queryOrganization({ name }).pipe( catchError(error => [error]), - map(c => ({ orgOrError: c } as PartialStateUpdate)), + map((c): PartialStateUpdate => ({ orgOrError: c })), // Don't clear old org data while we reload, to avoid unmounting all components during // loading. diff --git a/web/src/repo/FilePathBreadcrumb.tsx b/web/src/repo/FilePathBreadcrumb.tsx index e6476cf51ff..8fa72bb8259 100644 --- a/web/src/repo/FilePathBreadcrumb.tsx +++ b/web/src/repo/FilePathBreadcrumb.tsx @@ -1,7 +1,6 @@ import * as React from 'react' import { LinkOrSpan } from '../../../shared/src/components/LinkOrSpan' -import { toPrettyBlobURL } from '../../../shared/src/util/url' -import { RepoRev } from '../../../shared/src/util/url' +import { RepoRev, toPrettyBlobURL } from '../../../shared/src/util/url' import { toTreeURL } from '../util/url' interface Props { diff --git a/web/src/repo/RepositoryGitDataContainer.tsx b/web/src/repo/RepositoryGitDataContainer.tsx index 6dac6529496..ade5138df4f 100644 --- a/web/src/repo/RepositoryGitDataContainer.tsx +++ b/web/src/repo/RepositoryGitDataContainer.tsx @@ -3,8 +3,7 @@ import AlertCircleIcon from 'mdi-react/AlertCircleIcon' import * as React from 'react' import { defer, Subject, Subscription } from 'rxjs' import { catchError, delay, distinctUntilChanged, map, retryWhen, switchMap, tap } from 'rxjs/operators' -import { RepoQuestionIcon } from '../../../shared/src/components/icons' -import { RepositoryIcon } from '../../../shared/src/components/icons' // TODO: Switch to mdi icon +import { RepoQuestionIcon, RepositoryIcon } from '../../../shared/src/components/icons' // TODO: Switch to mdi icon import { displayRepoName } from '../../../shared/src/components/RepoFileLink' import { ErrorLike, isErrorLike } from '../../../shared/src/util/errors' import { HeroPage } from '../components/HeroPage' diff --git a/web/src/repo/blob/Blob.tsx b/web/src/repo/blob/Blob.tsx index 82896d1785e..9ad834fe1a9 100644 --- a/web/src/repo/blob/Blob.tsx +++ b/web/src/repo/blob/Blob.tsx @@ -387,7 +387,7 @@ export class Blob extends React.Component { } if (decoration.after) { - const codeCell = row.cells[1]! + const codeCell = row.cells[1] this.createLineDecorationAttachmentDOMNode(line, codeCell) } } diff --git a/web/src/repo/blob/discussions/DiscussionsCreate.tsx b/web/src/repo/blob/discussions/DiscussionsCreate.tsx index 94f058c7f74..c6cd0c67ce4 100644 --- a/web/src/repo/blob/discussions/DiscussionsCreate.tsx +++ b/web/src/repo/blob/discussions/DiscussionsCreate.tsx @@ -103,7 +103,7 @@ export class DiscussionsCreate extends React.PureComponent { this.props.history.push(location.pathname + location.search + '#' + hash.toString()) }), map(thread => undefined), - catchError(e => throwError('Error creating thread: ' + asError(e).message)) + catchError(e => throwError(new Error('Error creating thread: ' + asError(e).message))) ) } diff --git a/web/src/repo/blob/discussions/DiscussionsThread.tsx b/web/src/repo/blob/discussions/DiscussionsThread.tsx index 3aa5d61eb10..7c87749eea6 100644 --- a/web/src/repo/blob/discussions/DiscussionsThread.tsx +++ b/web/src/repo/blob/discussions/DiscussionsThread.tsx @@ -164,7 +164,7 @@ export class DiscussionsThread extends React.PureComponent { return addCommentToThread(this.props.threadID, contents).pipe( tap(thread => this.setState({ thread })), map(thread => undefined), - catchError(e => throwError('Error creating comment: ' + asError(e).message)) + catchError(e => throwError(new Error('Error creating comment: ' + asError(e).message))) ) } diff --git a/web/src/repo/branches/RepositoryBranchesOverviewPage.tsx b/web/src/repo/branches/RepositoryBranchesOverviewPage.tsx index 01450fc54c7..39873564749 100644 --- a/web/src/repo/branches/RepositoryBranchesOverviewPage.tsx +++ b/web/src/repo/branches/RepositoryBranchesOverviewPage.tsx @@ -92,7 +92,7 @@ export class RepositoryBranchesOverviewPage extends React.PureComponent return queryGitBranches({ repo: repo.id, first: 10 }).pipe( catchError(error => [error]), - map(c => ({ dataOrError: c } as PartialStateUpdate)), + map((c): PartialStateUpdate => ({ dataOrError: c })), startWith({ dataOrError: undefined }) ) }) diff --git a/web/src/search/input/QueryBuilder.test.tsx b/web/src/search/input/QueryBuilder.test.tsx index ddb864dea0f..0842e8f11e2 100644 --- a/web/src/search/input/QueryBuilder.test.tsx +++ b/web/src/search/input/QueryBuilder.test.tsx @@ -84,7 +84,7 @@ describe('QueryBuilder', () => { const onChange = sinon.spy() const { container } = render() - const typeField = getBySelectText(container, 'Code (default)')! + const typeField = getBySelectText(container, 'Code (default)') fireEvent.change(typeField, { target: { value: 'diff' } }) await wait(() => queryByTestId(container, 'test-author')) @@ -101,7 +101,7 @@ describe('QueryBuilder', () => { const onChange = sinon.spy() const { container } = render() - const typeField = getBySelectText(container, 'Code (default)')! + const typeField = getBySelectText(container, 'Code (default)') fireEvent.change(typeField, { target: { value: 'commit' } }) await wait(() => queryByTestId(container, 'test-author')) @@ -118,7 +118,7 @@ describe('QueryBuilder', () => { const onChange = sinon.spy() const { container } = render() - const typeField = getBySelectText(container, 'Code (default)')! + const typeField = getBySelectText(container, 'Code (default)') fireEvent.change(typeField, { target: { value: 'diff' } }) await wait(() => queryByTestId(container, 'test-author')) @@ -132,7 +132,7 @@ describe('QueryBuilder', () => { const onChange = sinon.spy() const { container } = render() - const typeField = getBySelectText(container, 'Code (default)')! + const typeField = getBySelectText(container, 'Code (default)') fireEvent.change(typeField, { target: { value: 'diff' } }) await wait(() => queryByTestId(container, 'test-after')) @@ -147,7 +147,7 @@ describe('QueryBuilder', () => { const onChange = sinon.spy() const { container } = render() - const typeField = getBySelectText(container, 'Code (default)')! + const typeField = getBySelectText(container, 'Code (default)') fireEvent.change(typeField, { target: { value: 'diff' } }) await wait(() => queryByTestId(container, 'test-before')) @@ -162,7 +162,7 @@ describe('QueryBuilder', () => { const onChange = sinon.spy() const { container } = render() - const typeField = getBySelectText(container, 'Code (default)')! + const typeField = getBySelectText(container, 'Code (default)') fireEvent.change(typeField, { target: { value: 'diff' } }) await wait(() => queryByTestId(container, 'test-message')) diff --git a/web/src/search/input/QueryBuilder.tsx b/web/src/search/input/QueryBuilder.tsx index f80167b5813..a2d05047f61 100644 --- a/web/src/search/input/QueryBuilder.tsx +++ b/web/src/search/input/QueryBuilder.tsx @@ -402,7 +402,7 @@ function formatFieldForQuery(field: string, value: string, alwaysQuote?: boolean // if they do, then be helpful and remove it for them to avoid double fields like // 'repo:repo:foo'. if (field) { - value = value.replace(new RegExp('^' + field + ':', 'g'), '') + value = value.replace(new RegExp(`^${field}:`, 'g'), '') } // See if we need to double-quote value. diff --git a/web/src/search/input/ScopePage.tsx b/web/src/search/input/ScopePage.tsx index 8db93527294..69990a3365f 100644 --- a/web/src/search/input/ScopePage.tsx +++ b/web/src/search/input/ScopePage.tsx @@ -16,8 +16,7 @@ import { SearchScope, Settings } from '../../schema/settings.schema' import { eventLogger } from '../../tracking/eventLogger' import { fetchReposByQuery } from '../backend' import { submitSearch } from '../helpers' -import { queryUpdates } from './QueryInput' -import { QueryInput } from './QueryInput' +import { QueryInput, queryUpdates } from './QueryInput' import { SearchButton } from './SearchButton' const ScopeNotFound = () => ( diff --git a/web/src/search/input/Suggestion.tsx b/web/src/search/input/Suggestion.tsx index ff41b01a5b9..b240c1aaf82 100644 --- a/web/src/search/input/Suggestion.tsx +++ b/web/src/search/input/Suggestion.tsx @@ -54,7 +54,7 @@ export function createSuggestion(item: GQL.SearchSuggestion): Suggestion { case 'File': { const descriptionParts = [] const dir = dirname(item.path) - if (dir !== undefined && dir !== '.') { + if (dir !== '.') { descriptionParts.push(`${dir}/`) } descriptionParts.push(basename(item.repository.name)) diff --git a/web/src/search/results/CommitSearchResult.tsx b/web/src/search/results/CommitSearchResult.tsx index c74118fbca7..d462857be88 100644 --- a/web/src/search/results/CommitSearchResult.tsx +++ b/web/src/search/results/CommitSearchResult.tsx @@ -76,8 +76,8 @@ export const CommitSearchResult: React.FunctionComponent = (props: Props) onClick={stopPropagationToCollapseOrExpand} onMouseDown={logClickOnPerson} > - - {props.result.commit.author.person!.displayName} + + {props.result.commit.author.person.displayName} = (props: Props) if (ignoreUntilAtAt && !line.startsWith('@@')) { lineClasses.push({ line: i + 1, className: 'hidden' }) continue - } else { - ignoreUntilAtAt = false } + ignoreUntilAtAt = false if (line.startsWith('diff ')) { ignoreUntilAtAt = true diff --git a/web/src/search/results/SearchResultsList.tsx b/web/src/search/results/SearchResultsList.tsx index fc9ca7fb4a2..ce342d2e17c 100644 --- a/web/src/search/results/SearchResultsList.tsx +++ b/web/src/search/results/SearchResultsList.tsx @@ -136,11 +136,9 @@ export class SearchResultsList extends React.PureComponent this.setCheckpoint(checkpoint)) ) // Remove the "Jump to top" button when the user starts scrolling diff --git a/web/src/search/saved-queries/SavedQueryForm.tsx b/web/src/search/saved-queries/SavedQueryForm.tsx index 9abe6669e8a..ecd5cb82963 100644 --- a/web/src/search/saved-queries/SavedQueryForm.tsx +++ b/web/src/search/saved-queries/SavedQueryForm.tsx @@ -95,7 +95,7 @@ export class SavedQueryForm extends React.Component { try { const settings = subject.settings if (settings && settings['notifications.slack']) { - slackWebhookURL = settings['notifications.slack']!.webhookURL + slackWebhookURL = settings['notifications.slack'].webhookURL } } catch (e) { slackWebhookURL = null @@ -328,7 +328,7 @@ export class SavedQueryForm extends React.Component { return [] }) ) - .subscribe(this.props.onDidCommit) + .subscribe(() => this.props.onDidCommit()) ) } diff --git a/web/src/search/saved-queries/Sparkline.tsx b/web/src/search/saved-queries/Sparkline.tsx index b98a756f041..443098f6c8c 100644 --- a/web/src/search/saved-queries/Sparkline.tsx +++ b/web/src/search/saved-queries/Sparkline.tsx @@ -33,7 +33,7 @@ export class Sparkline extends React.PureComponent { .x((d, i) => x(i)) .y((d, i) => y(Number(d))) - const svg = select(ref!) + const svg = select(ref) svg.selectAll('*').remove() const strokeColor = this.props.isLightTheme ? '#cad2e2' : '#566e9f' diff --git a/web/src/settings/SettingsArea.tsx b/web/src/settings/SettingsArea.tsx index 560c82a5970..286c539b2fb 100644 --- a/web/src/settings/SettingsArea.tsx +++ b/web/src/settings/SettingsArea.tsx @@ -8,7 +8,6 @@ import { catchError, distinctUntilChanged, map, startWith, switchMap } from 'rxj import { extensionIDsFromSettings } from '../../../shared/src/extensions/extension' import { queryConfiguredRegistryExtensions } from '../../../shared/src/extensions/helpers' import { gql } from '../../../shared/src/graphql/graphql' -import { ISettingsCascade } from '../../../shared/src/graphql/schema' import * as GQL from '../../../shared/src/graphql/schema' import { PlatformContextProps } from '../../../shared/src/platform/context' import { gqlToCascade, SettingsCascadeProps } from '../../../shared/src/settings/settings' @@ -19,6 +18,7 @@ import { ThemeProps } from '../theme' import { eventLogger } from '../tracking/eventLogger' import { mergeSettingsSchemas } from './configuration' import { SettingsPage } from './SettingsPage' + const NotFoundPage = () => /** Props shared by SettingsArea and its sub-pages. */ @@ -180,7 +180,7 @@ export class SettingsArea extends React.Component { } } -function fetchSettingsCascade(subject: GQL.ID): Observable> { +function fetchSettingsCascade(subject: GQL.ID): Observable> { return queryGraphQL( gql` query SettingsCascade($subject: ID!) { diff --git a/web/src/site-admin/SiteAdminAddExternalServicePage.tsx b/web/src/site-admin/SiteAdminAddExternalServicePage.tsx index 758997a775a..6ff64f049b7 100644 --- a/web/src/site-admin/SiteAdminAddExternalServicePage.tsx +++ b/web/src/site-admin/SiteAdminAddExternalServicePage.tsx @@ -3,7 +3,6 @@ import React from 'react' import { Observable, Subject, Subscription } from 'rxjs' import { catchError, map, switchMap, tap } from 'rxjs/operators' import { gql } from '../../../shared/src/graphql/graphql' -import { ExternalServiceKind } from '../../../shared/src/graphql/schema' import * as GQL from '../../../shared/src/graphql/schema' import { createAggregateError } from '../../../shared/src/util/errors' import { mutateGraphQL } from '../backend/graphql' @@ -16,7 +15,7 @@ import { SiteAdminExternalServiceForm } from './SiteAdminExternalServiceForm' interface Props extends ThemeProps { history: H.History - kind: ExternalServiceKind + kind: GQL.ExternalServiceKind variant?: ExternalServiceVariant eventLogger: { logViewEvent: (event: 'AddExternalService') => void @@ -67,7 +66,7 @@ export class SiteAdminAddExternalServicePage extends React.Component { // Refresh site flags so that global site alerts // reflect the latest configuration. - refreshSiteFlags().subscribe(undefined, err => console.error(err)) + refreshSiteFlags().subscribe({ error: err => console.error(err) }) this.setState({ loading: false }) this.props.history.push(`/site-admin/external-services`) diff --git a/web/src/site-admin/SiteAdminAddExternalServicesPage.tsx b/web/src/site-admin/SiteAdminAddExternalServicesPage.tsx index b9dc12a1bc9..85d44f3f826 100644 --- a/web/src/site-admin/SiteAdminAddExternalServicesPage.tsx +++ b/web/src/site-admin/SiteAdminAddExternalServicesPage.tsx @@ -58,22 +58,18 @@ export class SiteAdminAddExternalServicesPage extends React.Component { const { kind, variant } = this.getExternalServiceKind() if (kind) { return - } else { - return ( -
- -

Add external service

-

Choose an external service to add to Sourcegraph.

- {ALL_EXTERNAL_SERVICE_ADD_VARIANTS.map((service, i) => ( -
- -
- ))} -
- ) } + return ( +
+ +

Add external service

+

Choose an external service to add to Sourcegraph.

+ {ALL_EXTERNAL_SERVICE_ADD_VARIANTS.map((service, i) => ( +
+ +
+ ))} +
+ ) } } diff --git a/web/src/site-admin/SiteAdminConfigurationPage.tsx b/web/src/site-admin/SiteAdminConfigurationPage.tsx index 0b8c675b56f..8d805930548 100644 --- a/web/src/site-admin/SiteAdminConfigurationPage.tsx +++ b/web/src/site-admin/SiteAdminConfigurationPage.tsx @@ -82,7 +82,7 @@ export class SiteAdminConfigurationPage extends React.Component { } else { // Refresh site flags so that global site alerts // reflect the latest configuration. - refreshSiteFlags().subscribe(undefined, err => console.error(err)) + refreshSiteFlags().subscribe({ error: err => console.error(err) }) } this.setState({ restartToApply }) this.remoteRefreshes.next() diff --git a/web/src/site-admin/SiteAdminExternalServicesPage.tsx b/web/src/site-admin/SiteAdminExternalServicesPage.tsx index 2788c768704..39fc80d229e 100644 --- a/web/src/site-admin/SiteAdminExternalServicesPage.tsx +++ b/web/src/site-admin/SiteAdminExternalServicesPage.tsx @@ -80,7 +80,7 @@ class ExternalServiceNode extends React.PureComponent { // Refresh site flags so that global site alerts // reflect the latest configuration. - refreshSiteFlags().subscribe(undefined, err => console.error(err)) + refreshSiteFlags().subscribe({ error: err => console.error(err) }) this.setState({ loading: false }) if (this.props.onDidUpdate) { @@ -163,7 +163,7 @@ export class SiteAdminExternalServicesPage extends React.PureComponent this.completeConnectedCodeHostActivation(externalServices)) ) public render(): JSX.Element | null { diff --git a/web/src/site-admin/SiteAdminOverviewPage.tsx b/web/src/site-admin/SiteAdminOverviewPage.tsx index 62cdc96c753..9196a28b42c 100644 --- a/web/src/site-admin/SiteAdminOverviewPage.tsx +++ b/web/src/site-admin/SiteAdminOverviewPage.tsx @@ -143,11 +143,11 @@ export class SiteAdminOverviewPage extends React.Component { )} {this.state.info.users > 1 && ( diff --git a/web/src/site-admin/backend.tsx b/web/src/site-admin/backend.tsx index bb219a64201..14091ca4906 100644 --- a/web/src/site-admin/backend.tsx +++ b/web/src/site-admin/backend.tsx @@ -394,7 +394,7 @@ export function updateSiteConfiguration(lastID: number, input: string): Observab { lastID, input } ).pipe( map(dataOrThrowErrors), - map(data => data.updateSiteConfiguration as boolean) + map(data => data.updateSiteConfiguration) ) } diff --git a/web/src/tracking/services/telligentWrapper.tsx b/web/src/tracking/services/telligentWrapper.tsx index 1d055ea0dfc..42c7998d2b4 100644 --- a/web/src/tracking/services/telligentWrapper.tsx +++ b/web/src/tracking/services/telligentWrapper.tsx @@ -96,9 +96,8 @@ class TelligentWrapper { const match = window.document.cookie.match(matcher) if (match && match[1]) { return match[1].split('.') - } else { - return null } + return null } } diff --git a/web/src/tracking/withActivation.tsx b/web/src/tracking/withActivation.tsx index 671bc72ad44..3e89d6397ba 100644 --- a/web/src/tracking/withActivation.tsx +++ b/web/src/tracking/withActivation.tsx @@ -103,7 +103,7 @@ const fetchReferencesLink = (): Observable => } const repositoryURLs = data.repositories.nodes .filter(r => r.gitRefs && r.gitRefs.totalCount > 0) - .sort((r1, r2) => r2.gitRefs!.totalCount! - r1.gitRefs!.totalCount) + .sort((r1, r2) => r2.gitRefs.totalCount - r1.gitRefs.totalCount) .map(r => r.url) if (repositoryURLs.length === 0) { return null diff --git a/web/src/tree/Tree.tsx b/web/src/tree/Tree.tsx index 87c53a61a16..3c81df23c4a 100644 --- a/web/src/tree/Tree.tsx +++ b/web/src/tree/Tree.tsx @@ -1,8 +1,7 @@ import * as H from 'history' import { isEqual } from 'lodash' import * as React from 'react' -import { Subscription } from 'rxjs' -import { Subject } from 'rxjs' +import { Subject, Subscription } from 'rxjs' import { distinctUntilChanged, startWith } from 'rxjs/operators' import { Key } from 'ts-key-enum' import { AbsoluteRepo } from '../../../shared/src/util/url' diff --git a/web/src/tree/util.tsx b/web/src/tree/util.tsx index e6a238c3bf0..19076f4353c 100644 --- a/web/src/tree/util.tsx +++ b/web/src/tree/util.tsx @@ -37,7 +37,7 @@ export function scrollIntoView(el: Element, scrollRoot: Element): void { export const getDomElement = (path: string): Element | null => document.querySelector(`[data-tree-path='${path}']`) export const treePadding = (depth: number, isTree: boolean) => ({ - marginLeft: depth * 12 + (isTree ? 0 : 12) + 12 + 'px', + marginLeft: `${depth * 12 + (isTree ? 0 : 12) + 12}px`, paddingRight: '16px', }) diff --git a/web/src/user/account/UserAccountPasswordPage.tsx b/web/src/user/account/UserAccountPasswordPage.tsx index a3d7eb214fb..1fcc925918a 100644 --- a/web/src/user/account/UserAccountPasswordPage.tsx +++ b/web/src/user/account/UserAccountPasswordPage.tsx @@ -57,7 +57,7 @@ export class UserAccountPasswordPage extends React.Component { }).pipe( // Change URL after updating to trigger Chrome to show "Update password?" dialog. tap(() => this.props.history.replace({ hash: 'updated' })), - catchError(this.handleError) + catchError(err => this.handleError(err)) ) ) ) @@ -71,7 +71,7 @@ export class UserAccountPasswordPage extends React.Component { newPasswordConfirmation: '', saved: true, }), - this.handleError + err => this.handleError(err) ) ) } diff --git a/web/src/user/account/UserAccountProfilePage.tsx b/web/src/user/account/UserAccountProfilePage.tsx index c0bf8ec2254..ae9898e5423 100644 --- a/web/src/user/account/UserAccountProfilePage.tsx +++ b/web/src/user/account/UserAccountProfilePage.tsx @@ -99,7 +99,7 @@ export class UserAccountProfilePage extends React.Component { switchMap(([user]) => queryUser(user.id).pipe( catchError(error => [asError(error)]), - map(c => ({ userOrError: c } as Pick)) + map((c): Pick => ({ userOrError: c })) ) ) ) @@ -120,7 +120,7 @@ export class UserAccountProfilePage extends React.Component { username: this.state.username === undefined ? null : this.state.username, displayName: this.state.displayName === undefined ? null : this.state.displayName, avatarURL: this.state.avatarURL === undefined ? null : this.state.avatarURL, - }).pipe(catchError(this.handleError)) + }).pipe(catchError(err => this.handleError(err))) ), tap(() => { this.setState({ loading: false, saved: true }) @@ -139,7 +139,7 @@ export class UserAccountProfilePage extends React.Component { // In case the edited user is the current user, immediately reflect the changes in the UI. mergeMap(() => concat(refreshAuthenticatedUser(), [null])) ) - .subscribe(undefined, this.handleError) + .subscribe({ error: err => this.handleError(err) }) ) this.componentUpdates.next(this.props) } diff --git a/web/src/user/area/UserArea.tsx b/web/src/user/area/UserArea.tsx index 2fffeb68053..7e8caeb6914 100644 --- a/web/src/user/area/UserArea.tsx +++ b/web/src/user/area/UserArea.tsx @@ -143,7 +143,7 @@ export class UserArea extends React.Component { type PartialStateUpdate = Pick return fetchUser({ username }).pipe( catchError(error => [error]), - map(c => ({ userOrError: c } as PartialStateUpdate)), + map((c): PartialStateUpdate => ({ userOrError: c })), // Don't clear old user data while we reload, to avoid unmounting all components during // loading. diff --git a/yarn.lock b/yarn.lock index 23a8eee0d1d..6922c0dd5ca 100644 --- a/yarn.lock +++ b/yarn.lock @@ -853,6 +853,14 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-transform-typescript" "^7.1.0" +"@babel/runtime-corejs2@^7.2.0": + version "7.4.2" + resolved "https://registry.npmjs.org/@babel/runtime-corejs2/-/runtime-corejs2-7.4.2.tgz#a0cec2c41717fa415e9c204f32b603d88b1796c2" + integrity sha512-y/Br/9uQnumcqcakkmobFqOTzYCWSS6Kuy1b2o7LTXR4lpeU0AhaOcPqIHW85LCxRWUDW5Vg0pU1KlE3YkORlg== + dependencies: + core-js "^2.6.5" + regenerator-runtime "^0.13.2" + "@babel/runtime@7.0.0": version "7.0.0" resolved "https://registry.npmjs.org/@babel/runtime/-/runtime-7.0.0.tgz#adeb78fedfc855aa05bc041640f3f6f98e85424c" @@ -1436,7 +1444,8 @@ integrity sha512-Te7F1RQJLBH4C8wQ2xz0nPC2vpe13F80V+Yv+c3GySOoh4DcLNN4P5u51Kh4aZPqeS5DJ7CKvHyX2SM/1EBXNg== "@sourcegraph/extension-api-types@link:packages/@sourcegraph/extension-api-types": - version "2.0.0" + version "0.0.0" + uid "" "@sourcegraph/prettierrc@^2.2.0": version "2.2.0" @@ -1462,14 +1471,14 @@ resolved "https://registry.npmjs.org/@sourcegraph/tsconfig/-/tsconfig-4.0.0.tgz#dd2a406f90760bb789fd89fde4bd0a8d681f2767" integrity sha512-jxrhKbek4yu1HUDpUhqR9hAGFiUgaJ9NIM+c8JEkAnvpW67ab1AUFWb82aSVfZWX1UVqfR84AMr7xP3E8LlL+A== -"@sourcegraph/tslint-config@^12.3.1": - version "12.3.1" - resolved "https://registry.npmjs.org/@sourcegraph/tslint-config/-/tslint-config-12.3.1.tgz#54570f56255c3c4139105fd18ea542e847e0710f" - integrity sha512-XG/H+QPARCTIXtL4bLBP1W93MniqBYIkDEkld6gdbRT3i4sBMXw+IwZwC3NdroEjEe5OKgXNBh1Y8edxBL/hdw== +"@sourcegraph/tslint-config@^13.0.0": + version "13.0.0" + resolved "https://registry.npmjs.org/@sourcegraph/tslint-config/-/tslint-config-13.0.0.tgz#f75d2ea51972c9f8cab233de98824b954457729b" + integrity sha512-kDWngKXc7Qu8rdtsUP1pics0vOIx37e1ygjyrxMfhav722dhByxYowK3AxcbyECyaKEYt0wCp+bCqeVQX+XksQ== dependencies: - rxjs-tslint-rules "^4.12.0" - tslint-config-prettier "^1.6.0" - tslint-react "^3.2.0" + rxjs-tslint-rules "^4.19.1" + tslint-config-prettier "^1.18.0" + tslint-react "^4.0.0" "@sqs/jsonc-parser@^1.0.3": version "1.0.3" @@ -4990,6 +4999,11 @@ core-js@^2.4.0, core-js@^2.5.7: resolved "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz#f972608ff0cead68b841a16a932d0b183791814e" integrity sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw== +core-js@^2.6.5: + version "2.6.5" + resolved "https://registry.npmjs.org/core-js/-/core-js-2.6.5.tgz#44bc8d249e7fb2ff5d00e0341a7ffb94fbf67895" + integrity sha512-klh/kDpwX8hryYL14M9w/xei6vrv6sE8gTHDG7/T/+SEovB/G4ejwcfE/CBzO6Edsu+OETZMZ3wcX/EjUkrl5A== + core-util-is@1.0.2, core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" @@ -5558,6 +5572,13 @@ decamelize@^2.0.0: dependencies: xregexp "4.0.0" +decamelize@^3.0.0: + version "3.1.1" + resolved "https://registry.npmjs.org/decamelize/-/decamelize-3.1.1.tgz#ebf473c6f8607bd70fd9ed6d892da27c5eb8539e" + integrity sha512-pSJTQCBDZxv8siK5p/M42ZdhThhTtx3JU/OKli0yQSKebfM9q92op6zF7krYrWVKRtsE/RwTDiZLliMV3ECkXQ== + dependencies: + xregexp "^4.2.4" + decode-uri-component@^0.2.0: version "0.2.0" resolved "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" @@ -8851,7 +8872,7 @@ js-tokens@^3.0.2: resolved "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" integrity sha1-mGbfOVECEw449/mWvOtlRDIJwls= -js-yaml@^3.10.0, js-yaml@^3.12.0, js-yaml@^3.7.0, js-yaml@^3.9.0: +js-yaml@^3.10.0, js-yaml@^3.12.0, js-yaml@^3.9.0: version "3.12.0" resolved "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.0.tgz#eaed656ec8344f10f527c6bfa1b6e2244de167d1" integrity sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A== @@ -8859,6 +8880,14 @@ js-yaml@^3.10.0, js-yaml@^3.12.0, js-yaml@^3.7.0, js-yaml@^3.9.0: argparse "^1.0.7" esprima "^4.0.0" +js-yaml@^3.13.0: + version "3.13.0" + resolved "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.0.tgz#38ee7178ac0eea2c97ff6d96fff4b18c7d8cf98e" + integrity sha512-pZZoSxcCYco+DIKBTimr67J6Hy+EYGZDY/HCWC+iAEA9h1ByhMXAIVUXMcMFpOCxQ/xjXmPI2MkDL5HRm5eFrQ== + dependencies: + argparse "^1.0.7" + esprima "^4.0.0" + jsbn@~0.1.0: version "0.1.1" resolved "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" @@ -12261,6 +12290,11 @@ regenerator-runtime@^0.13.1: resolved "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.1.tgz#522ea2aafd9200a00eee143dc14219a35a0f3991" integrity sha512-5KzMIyPLvfdPmvsdlYsHqITrDfK9k7bmvf97HvHSN4810i254ponbxCQ1NukpRWlu6en2MBWzAlhDExEKISwAA== +regenerator-runtime@^0.13.2: + version "0.13.2" + resolved "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.2.tgz#32e59c9a6fb9b1a4aff09b4930ca2d4477343447" + integrity sha512-S/TQAZJO+D3m9xeN1WTI8dLKBBiRgXBlTJvbWjCThHWZj9EvHK70Ff50/tYj2J/fvBY6JtFVwRuazHN2E7M9BA== + regenerator-transform@^0.13.3: version "0.13.3" resolved "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.13.3.tgz#264bd9ff38a8ce24b06e0636496b2c856b57bcbb" @@ -12679,16 +12713,17 @@ run-queue@^1.0.0, run-queue@^1.0.3: dependencies: aproba "^1.1.1" -rxjs-tslint-rules@^4.12.0: - version "4.12.0" - resolved "https://registry.npmjs.org/rxjs-tslint-rules/-/rxjs-tslint-rules-4.12.0.tgz#92cf4c26d53163afdc32d4d8a23c7c13faa9e988" - integrity sha512-JaCcoy7m4r/uktKjAdh70e+ijcTqozwKEU82N66tJ1dhSfzBgUX7bxopv/yQiHZ2BOeqRN61VfRMagqXTuzgdg== +rxjs-tslint-rules@^4.19.1: + version "4.19.1" + resolved "https://registry.npmjs.org/rxjs-tslint-rules/-/rxjs-tslint-rules-4.19.1.tgz#e5328cface0a0d0b52f2601082fa1ffd617f7869" + integrity sha512-TwosfLg5HgG6vSq6uHM49cUMJxX6ZfF8Cd4/r7TPc/h4hV2vm675T7zwO49MD2YxNpQbge4Xi8EOzn8XvJwYAA== dependencies: "@phenomnomnominal/tsquery" "^3.0.0" - decamelize "^2.0.0" + decamelize "^3.0.0" resolve "^1.4.0" tslib "^1.8.0" tsutils "^3.0.0" + tsutils-etc "^1.1.0" rxjs@^6.0.0, rxjs@^6.1.0, rxjs@^6.3.2, rxjs@^6.3.3, rxjs@^6.4.0: version "6.4.0" @@ -13249,7 +13284,8 @@ source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.0, source-map@~0.6.1: integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== "sourcegraph@link:packages/sourcegraph-extension-api": - version "23.0.0" + version "0.0.0" + uid "" space-separated-tokens@^1.0.0: version "1.1.2" @@ -14185,10 +14221,10 @@ tslib@^1, tslib@^1.8.0, tslib@^1.8.1, tslib@^1.9.0, tslib@^1.9.3: resolved "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286" integrity sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ== -tslint-config-prettier@^1.6.0: - version "1.15.0" - resolved "https://registry.npmjs.org/tslint-config-prettier/-/tslint-config-prettier-1.15.0.tgz#76b9714399004ab6831fdcf76d89b73691c812cf" - integrity sha512-06CgrHJxJmNYVgsmeMoa1KXzQRoOdvfkqnJth6XUkNeOz707qxN0WfxfhYwhL5kXHHbYJRby2bqAPKwThlZPhw== +tslint-config-prettier@^1.18.0: + version "1.18.0" + resolved "https://registry.npmjs.org/tslint-config-prettier/-/tslint-config-prettier-1.18.0.tgz#75f140bde947d35d8f0d238e0ebf809d64592c37" + integrity sha512-xPw9PgNPLG3iKRxmK7DWr+Ea/SzrvfHtjFt5LBl61gk2UBG/DB9kCXRjv+xyIU1rUtnayLeMUVJBcMX8Z17nDg== tslint-language-service@^0.9.9: version "0.9.9" @@ -14197,17 +14233,17 @@ tslint-language-service@^0.9.9: dependencies: mock-require "^2.0.2" -tslint-react@^3.2.0: - version "3.6.0" - resolved "https://registry.npmjs.org/tslint-react/-/tslint-react-3.6.0.tgz#7f462c95c4a0afaae82507f06517ff02942196a1" - integrity sha512-AIv1QcsSnj7e9pFir6cJ6vIncTqxfqeFF3Lzh8SuuBljueYzEAtByuB6zMaD27BL0xhMEqsZ9s5eHuCONydjBw== +tslint-react@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/tslint-react/-/tslint-react-4.0.0.tgz#b4bb4c01c32448cb14d23f143a2f5e4989bb961e" + integrity sha512-9fNE0fm9zNDx1+b6hgy8rgDN2WsQLRiIrn3+fbqm0tazBVF6jiaCFAITxmU+WSFWYE03Xhp1joCircXOe1WVAQ== dependencies: - tsutils "^2.13.1" + tsutils "^3.9.1" -tslint@^5.12.0: - version "5.12.0" - resolved "https://registry.npmjs.org/tslint/-/tslint-5.12.0.tgz#47f2dba291ed3d580752d109866fb640768fca36" - integrity sha512-CKEcH1MHUBhoV43SA/Jmy1l24HJJgI0eyLbBNSRyFlsQvb9v6Zdq+Nz2vEOH00nC5SUx4SneJ59PZUS/ARcokQ== +tslint@^5.15.0: + version "5.15.0" + resolved "https://registry.npmjs.org/tslint/-/tslint-5.15.0.tgz#6ffb180986d63afa1e531feb2a134dbf961e27d3" + integrity sha512-6bIEujKR21/3nyeoX2uBnE8s+tMXCQXhqMmaIPJpHmXJoBJPTLcI7/VHRtUwMhnLVdwLqqY3zmd8Dxqa5CVdJA== dependencies: babel-code-frame "^6.22.0" builtin-modules "^1.1.1" @@ -14215,14 +14251,20 @@ tslint@^5.12.0: commander "^2.12.1" diff "^3.2.0" glob "^7.1.1" - js-yaml "^3.7.0" + js-yaml "^3.13.0" minimatch "^3.0.4" + mkdirp "^0.5.1" resolve "^1.3.2" semver "^5.3.0" tslib "^1.8.0" - tsutils "^2.27.2" + tsutils "^2.29.0" -tsutils@^2.13.1, tsutils@^2.27.2: +tsutils-etc@^1.1.0: + version "1.1.0" + resolved "https://registry.npmjs.org/tsutils-etc/-/tsutils-etc-1.1.0.tgz#82ce1c92da29e07d3cde95692d5c5e8dbdc92fd0" + integrity sha512-pJlLtLmQPUyGHqY/Pq6EGnpGmQCnnTDZetQ7eWkeQ5xaw4GtfcR1Zt7HMKFHGDDp53HzQfbqQ+7ps6iJbfa9Hw== + +tsutils@^2.29.0: version "2.29.0" resolved "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz#32b488501467acbedd4b85498673a0812aca0b99" integrity sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA== @@ -14236,6 +14278,13 @@ tsutils@^3.0.0: dependencies: tslib "^1.8.1" +tsutils@^3.9.1: + version "3.9.1" + resolved "https://registry.npmjs.org/tsutils/-/tsutils-3.9.1.tgz#2a40dc742943c71eca6d5c1994fcf999956be387" + integrity sha512-hrxVtLtPqQr//p8/msPT1X1UYXUjizqSit5d9AQ5k38TcV38NyecL5xODNxa73cLe/5sdiJ+w1FqzDhRBA/anA== + dependencies: + tslib "^1.8.1" + tty-browserify@0.0.0: version "0.0.0" resolved "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6" @@ -15140,6 +15189,13 @@ xregexp@4.0.0: resolved "https://registry.npmjs.org/xregexp/-/xregexp-4.0.0.tgz#e698189de49dd2a18cc5687b05e17c8e43943020" integrity sha512-PHyM+sQouu7xspQQwELlGwwd05mXUFqwFYfqPO0cC7x4fxyHnnuetmQr6CjJiafIDoH4MogHb9dOoJzR/Y4rFg== +xregexp@^4.2.4: + version "4.2.4" + resolved "https://registry.npmjs.org/xregexp/-/xregexp-4.2.4.tgz#02a4aea056d65a42632c02f0233eab8e4d7e57ed" + integrity sha512-sO0bYdYeJAJBcJA8g7MJJX7UrOZIfJPd8U2SC7B2Dd/J24U0aQNoGp33shCaBSWeb0rD5rh6VBUIXOkGal1TZA== + dependencies: + "@babel/runtime-corejs2" "^7.2.0" + xtend@^4.0.0, xtend@^4.0.1, xtend@~4.0.0, xtend@~4.0.1: version "4.0.1" resolved "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af"