diff --git a/x-pack/package.json b/x-pack/package.json index 78ee232873f4..9ab36f5f0b2c 100644 --- a/x-pack/package.json +++ b/x-pack/package.json @@ -45,8 +45,8 @@ "@types/d3-array": "^1.2.1", "@types/d3-scale": "^2.0.0", "@types/d3-shape": "^1.3.1", - "@types/d3-time-format": "^2.1.0", "@types/d3-time": "^1.0.7", + "@types/d3-time-format": "^2.1.0", "@types/elasticsearch": "^5.0.30", "@types/git-url-parse": "^9.0.0", "@types/glob": "^7.1.1", @@ -63,11 +63,11 @@ "@types/nock": "^9.3.0", "@types/node": "^10.12.27", "@types/node-fetch": "^2.1.4", + "@types/object-hash": "^1.2.0", "@types/papaparse": "^4.5.5", "@types/pngjs": "^3.3.1", "@types/prop-types": "^15.5.3", "@types/proper-lockfile": "^3.0.0", - "@types/object-hash": "^1.2.0", "@types/react": "^16.8.0", "@types/react-dom": "^16.8.0", "@types/react-infinite-scroller": "^1.2.0", @@ -87,6 +87,7 @@ "@types/tar-fs": "^1.16.1", "@types/tinycolor2": "^1.4.1", "@types/uuid": "^3.4.4", + "@types/wreck": "^14.0.0", "abab": "^1.0.4", "ansi-colors": "^3.0.5", "ansicolors": "0.3.2", diff --git a/x-pack/plugins/code/public/components/admin_page/import_project.tsx b/x-pack/plugins/code/public/components/admin_page/import_project.tsx index 639e49c5fb94..350a599290d6 100644 --- a/x-pack/plugins/code/public/components/admin_page/import_project.tsx +++ b/x-pack/plugins/code/public/components/admin_page/import_project.tsx @@ -85,8 +85,8 @@ class CodeImportProject extends React.PureComponent< - {/* - // @ts-ignore */} + {/* + // @ts-ignore */} { } public updateLayout(renderSideBySide: boolean) { - // @ts-ignore - this.diffEditor!.diffEditor!.updateOptions({ renderSideBySide }); + this.diffEditor!.diffEditor!.updateOptions({ renderSideBySide } as editor.IDiffEditorOptions); } public render() { diff --git a/x-pack/plugins/code/public/components/hover/hover_widget.tsx b/x-pack/plugins/code/public/components/hover/hover_widget.tsx index 4317a3785a7d..67701dfc9a5d 100644 --- a/x-pack/plugins/code/public/components/hover/hover_widget.tsx +++ b/x-pack/plugins/code/public/components/hover/hover_widget.tsx @@ -96,8 +96,6 @@ export class HoverWidget extends React.PureComponent { private renderInitialting() { return (
- {/* - // @ts-ignore */}

Language Server is initializing…

Depending on the size of your repo, this could take a few minutes.

diff --git a/x-pack/plugins/code/public/components/main/content.tsx b/x-pack/plugins/code/public/components/main/content.tsx index 8918e2a30e66..66ad7919114b 100644 --- a/x-pack/plugins/code/public/components/main/content.tsx +++ b/x-pack/plugins/code/public/components/main/content.tsx @@ -4,7 +4,6 @@ * you may not use this file except in compliance with the Elastic License. */ -// @ts-ignore import { EuiButton, EuiButtonGroup, EuiTitle } from '@elastic/eui'; import theme from '@elastic/eui/dist/eui_theme_light.json'; import 'github-markdown-css/github-markdown.css'; diff --git a/x-pack/plugins/code/public/components/main/error_panel.tsx b/x-pack/plugins/code/public/components/main/error_panel.tsx index f9deedfd2010..5c32102f5d11 100644 --- a/x-pack/plugins/code/public/components/main/error_panel.tsx +++ b/x-pack/plugins/code/public/components/main/error_panel.tsx @@ -20,24 +20,16 @@ export const ErrorPanel = (props: { title: ReactNode; content: string }) => { - {/* - // @ts-ignore */} - {/* - // @ts-ignore */} {props.title} - {/* - // @ts-ignore */} {props.content} - {/* - // @ts-ignore */} Go Back diff --git a/x-pack/plugins/code/public/components/query_bar/components/typeahead/suggestion_component.tsx b/x-pack/plugins/code/public/components/query_bar/components/typeahead/suggestion_component.tsx index 89befae7cbf0..d19932c0dd67 100644 --- a/x-pack/plugins/code/public/components/query_bar/components/typeahead/suggestion_component.tsx +++ b/x-pack/plugins/code/public/components/query_bar/components/typeahead/suggestion_component.tsx @@ -61,7 +61,6 @@ export const SuggestionComponent: SFC = props => { onClick={click} // active={props.selected} onMouseEnter={props.onMouseEnter} - // @ts-ignore ref={props.innerRef} id={props.ariaId} aria-selected={props.selected} diff --git a/x-pack/plugins/code/public/components/search_page/side_bar.tsx b/x-pack/plugins/code/public/components/search_page/side_bar.tsx index 42c4f8461d20..20445418b85f 100644 --- a/x-pack/plugins/code/public/components/search_page/side_bar.tsx +++ b/x-pack/plugins/code/public/components/search_page/side_bar.tsx @@ -5,9 +5,7 @@ */ import { - // @ts-ignore EuiFacetButton, - // @ts-ignore EuiFacetGroup, EuiFlexGroup, EuiFlexItem, diff --git a/x-pack/plugins/code/public/components/symbol_tree/code_symbol_tree.tsx b/x-pack/plugins/code/public/components/symbol_tree/code_symbol_tree.tsx index 3e2c828003bd..bb6961f1c0a7 100644 --- a/x-pack/plugins/code/public/components/symbol_tree/code_symbol_tree.tsx +++ b/x-pack/plugins/code/public/components/symbol_tree/code_symbol_tree.tsx @@ -5,6 +5,7 @@ */ import { EuiFlexGroup, EuiFlexItem, EuiIcon, EuiSideNav, EuiText, EuiToken } from '@elastic/eui'; +import { IconType } from '@elastic/eui'; import theme from '@elastic/eui/dist/eui_theme_light.json'; import React from 'react'; import { Link } from 'react-router-dom'; @@ -104,9 +105,7 @@ export class CodeSymbolTree extends React.PureComponent - {/* - // @ts-ignore */} - + {name} diff --git a/x-pack/plugins/code/public/monaco/monaco.ts b/x-pack/plugins/code/public/monaco/monaco.ts index fcfa93a5544f..9afb09f279a7 100644 --- a/x-pack/plugins/code/public/monaco/monaco.ts +++ b/x-pack/plugins/code/public/monaco/monaco.ts @@ -99,25 +99,6 @@ import chrome from 'ui/chrome'; const IS_DARK_THEME = chrome.getUiSettingsClient().get('theme:darkMode'); -// @ts-ignore -/*self.MonacoEnvironment = { - getWorkerUrl(moduleId: string, label: string) { - // if (label === 'json') { - // return './json.worker.bundle.js'; - // } - // if (label === 'css') { - // return './css.worker.bundle.js'; - // } - // if (label === 'html') { - // return './html.worker.bundle.js'; - // } - // if (label === 'typescript' || label === 'javascript') { - // return './ts.worker.bundle.js'; - // } - return './editor.worker.bundle.js'; - }, -};*/ - const themeName = IS_DARK_THEME ? darkTheme : lightTheme; const syntaxTheme = { diff --git a/x-pack/plugins/code/server/__tests__/lsp_service.ts b/x-pack/plugins/code/server/__tests__/lsp_service.ts index b7345ad85df0..7ed133685eee 100644 --- a/x-pack/plugins/code/server/__tests__/lsp_service.ts +++ b/x-pack/plugins/code/server/__tests__/lsp_service.ts @@ -3,23 +3,22 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ -/* tslint:disable */ -import fs from 'fs'; import Git from '@elastic/nodegit'; +import fs from 'fs'; +import mkdirp from 'mkdirp'; +import path from 'path'; // import rimraf from 'rimraf'; import sinon from 'sinon'; -import path from 'path'; -import mkdirp from 'mkdirp'; -import { LspService } from "../lsp/lsp_service"; -import { ConsoleLoggerFactory } from "../utils/console_logger_factory"; -import { RepositoryGitStatusReservedField, RepositoryConfigReservedField } from '../indexer/schema'; -import { InstallManager } from "../lsp/install_manager"; import assert from 'assert'; +import { Server } from 'hapi'; +import { RepositoryConfigReservedField, RepositoryGitStatusReservedField } from '../indexer/schema'; +import { InstallManager } from '../lsp/install_manager'; +import { LspService } from '../lsp/lsp_service'; import { RepositoryConfigController } from '../repository_config_controller'; import { createTestServerOption } from '../test_utils'; -import { Server } from 'hapi'; +import { ConsoleLoggerFactory } from '../utils/console_logger_factory'; const filename = 'hello.ts'; describe('lsp_service tests', () => { @@ -32,9 +31,16 @@ describe('lsp_service tests', () => { await index.addByPath(filename); index.write(); const treeId = await index.writeTree(); - const committer = Git.Signature.create("tester", - "test@test.com", Date.now() / 1000, 60); - const commit = await repo.createCommit("HEAD", committer, committer, "commit for test", treeId, []); + const committer = Git.Signature.create('tester', 'test@test.com', Date.now() / 1000, 60); + const commit = await repo.createCommit( + 'HEAD', + committer, + committer, + 'commit for test', + treeId, + [] + ); + // tslint:disable-next-line:no-console console.log(`created commit ${commit.tostrS()}`); return repo; } @@ -44,19 +50,19 @@ describe('lsp_service tests', () => { function mockEsClient(): any { const api = { - get: function (params: any) { + get(params: any) { return { _source: { [RepositoryGitStatusReservedField]: { cloneProgress: { - isCloned: true - } - } , + isCloned: true, + }, + }, [RepositoryConfigReservedField]: { - disableTypescript: false - } - } - } + disableTypescript: false, + }, + }, + }; }, }; return api; @@ -66,12 +72,9 @@ describe('lsp_service tests', () => { // @ts-ignore before(async () => { - await prepareProject( - path.join(serverOptions.repoPath, repoUri) - ); + await prepareProject(path.join(serverOptions.repoPath, repoUri)); }); - function comparePath(pathA: string, pathB: string) { const pa = fs.realpathSync(pathA); const pb = fs.realpathSync(pathB); @@ -79,11 +82,17 @@ describe('lsp_service tests', () => { } it('process a hover request', async () => { - - let esClient = mockEsClient(); + const esClient = mockEsClient(); const revision = 'master'; - const lspservice = new LspService('127.0.0.1', serverOptions, esClient, installManager, new ConsoleLoggerFactory(), new RepositoryConfigController(esClient)); + const lspservice = new LspService( + '127.0.0.1', + serverOptions, + esClient, + installManager, + new ConsoleLoggerFactory(), + new RepositoryConfigController(esClient) + ); try { const params = { textDocument: { @@ -92,44 +101,59 @@ describe('lsp_service tests', () => { position: { line: 0, character: 1, - } + }, }; const workspaceHandler = lspservice.workspaceHandler; const wsSpy = sinon.spy(workspaceHandler, 'handleRequest'); const controller = lspservice.controller; const ctrlSpy = sinon.spy(controller, 'handleRequest'); - let method = 'textDocument/hover'; + const method = 'textDocument/hover'; const response = await lspservice.sendRequest(method, params); assert.ok(response); assert.ok(response.result.contents); - wsSpy.restore(); ctrlSpy.restore(); - const workspaceFolderExists = fs.existsSync(path.join(serverOptions.workspacePath, repoUri, revision)); + const workspaceFolderExists = fs.existsSync( + path.join(serverOptions.workspacePath, repoUri, revision) + ); // workspace is opened assert.ok(workspaceFolderExists); - const workspacePath = fs.realpathSync(path.resolve(serverOptions.workspacePath, repoUri, revision)); + const workspacePath = fs.realpathSync( + path.resolve(serverOptions.workspacePath, repoUri, revision) + ); // workspace handler is working, filled workspacePath - sinon.assert.calledWith(ctrlSpy, sinon.match.has("workspacePath", sinon.match((value) => comparePath(value, workspacePath)))); + sinon.assert.calledWith( + ctrlSpy, + sinon.match.has('workspacePath', sinon.match(value => comparePath(value, workspacePath))) + ); // uri is changed by workspace handler - sinon.assert.calledWith(ctrlSpy, sinon.match.hasNested("params.textDocument.uri", `file://${workspacePath}/${filename}`)); + sinon.assert.calledWith( + ctrlSpy, + sinon.match.hasNested('params.textDocument.uri', `file://${workspacePath}/${filename}`) + ); return; - } finally { - await lspservice.shutdown() + await lspservice.shutdown(); } // @ts-ignore }).timeout(10000); - it("unload a workspace", async () => { - let esClient = mockEsClient(); + it('unload a workspace', async () => { + const esClient = mockEsClient(); const revision = 'master'; - const lspservice = new LspService('127.0.0.1', serverOptions, esClient, installManager, new ConsoleLoggerFactory(), new RepositoryConfigController(esClient)); + const lspservice = new LspService( + '127.0.0.1', + serverOptions, + esClient, + installManager, + new ConsoleLoggerFactory(), + new RepositoryConfigController(esClient) + ); try { const params = { textDocument: { @@ -138,10 +162,10 @@ describe('lsp_service tests', () => { position: { line: 0, character: 1, - } + }, }; - let method = 'textDocument/hover'; + const method = 'textDocument/hover'; // send a dummy request to open a workspace; const response = await lspservice.sendRequest(method, params); assert.ok(response); @@ -151,7 +175,7 @@ describe('lsp_service tests', () => { assert.ok(workspaceFolderExists); const controller = lspservice.controller; // @ts-ignore - const languageServer = controller.languageServerMap['typescript']; + const languageServer = controller.languageServerMap.typescript; const realWorkspacePath = fs.realpathSync(workspacePath); // @ts-ignore @@ -172,9 +196,8 @@ describe('lsp_service tests', () => { assert.strictEqual(exists, false); return; } finally { - await lspservice.shutdown() + await lspservice.shutdown(); } // @ts-ignore }).timeout(10000); - }); diff --git a/x-pack/plugins/code/server/routes/lsp.ts b/x-pack/plugins/code/server/routes/lsp.ts index 04f7d0dbe0a3..76b1ad029eaa 100644 --- a/x-pack/plugins/code/server/routes/lsp.ts +++ b/x-pack/plugins/code/server/routes/lsp.ts @@ -6,7 +6,6 @@ import Boom from 'boom'; import hapi from 'hapi'; -// @ts-ignore import { groupBy, last } from 'lodash'; import { ResponseError } from 'vscode-jsonrpc'; import { ResponseMessage } from 'vscode-jsonrpc/lib/messages'; diff --git a/x-pack/plugins/code/server/routes/redirect.ts b/x-pack/plugins/code/server/routes/redirect.ts index a0f2e6726ec6..842e4ace0941 100644 --- a/x-pack/plugins/code/server/routes/redirect.ts +++ b/x-pack/plugins/code/server/routes/redirect.ts @@ -6,7 +6,6 @@ import hapi from 'hapi'; import url from 'url'; -// @ts-ignore import wreck from 'wreck'; import { Logger } from '../log'; diff --git a/x-pack/plugins/code/server/security.ts b/x-pack/plugins/code/server/security.ts index 4651a169b677..e301214a9f35 100644 --- a/x-pack/plugins/code/server/security.ts +++ b/x-pack/plugins/code/server/security.ts @@ -64,7 +64,6 @@ export class SecureRoute { } private isSecurityEnabledInEs() { - // @ts-ignore const xpackInfo = this.server.plugins.xpack_main.info; if ( xpackInfo.isAvailable() && diff --git a/x-pack/plugins/code/server/utils/esclient_with_request.ts b/x-pack/plugins/code/server/utils/esclient_with_request.ts index ff41167ddccc..d3ef3dda2b37 100644 --- a/x-pack/plugins/code/server/utils/esclient_with_request.ts +++ b/x-pack/plugins/code/server/utils/esclient_with_request.ts @@ -5,7 +5,6 @@ */ import { Request } from 'hapi'; -// @ts-ignore import { AnyObject, EsClient } from '../lib/esqueue'; import { EsIndexClient } from './es_index_client'; import { WithRequest } from './with_request'; diff --git a/x-pack/plugins/code/server/utils/timeout.ts b/x-pack/plugins/code/server/utils/timeout.ts index cef7a593b188..4892e082ee4b 100644 --- a/x-pack/plugins/code/server/utils/timeout.ts +++ b/x-pack/plugins/code/server/utils/timeout.ts @@ -20,7 +20,6 @@ export function promiseTimeout(ms: number, promise: Promise): Promise { }); // Returns a race between our timeout and the passed in promise - // @ts-ignore return Promise.race([promise, timeout]); } else { return Promise.reject(boom); diff --git a/yarn.lock b/yarn.lock index 5fac8f0338a3..83c074fd5cb5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2554,6 +2554,15 @@ resolved "https://registry.yarnpkg.com/@types/wrap-ansi/-/wrap-ansi-2.0.14.tgz#5afbdd8374de9ff8ad752cb03ab9f225f7c2ee24" integrity sha1-Wvvdg3Ten/itdSywOrnyJffC7iQ= +"@types/wreck@^14.0.0": + version "14.0.0" + resolved "https://registry.yarnpkg.com/@types/wreck/-/wreck-14.0.0.tgz#8bf39fd789d32af63176bee5eb5705108cd8be5e" + integrity sha512-cxA8o5fGbXg2e/UUoA7z8lMaEw4CwxvJW1Fv+E8xP/n2MOzRdeQUX+e7aUxgr1ganECiIQXUka0OwwKR2ixo1w== + dependencies: + "@types/boom" "*" + "@types/events" "*" + "@types/node" "*" + "@types/write-pkg@^3.1.0": version "3.1.0" resolved "https://registry.yarnpkg.com/@types/write-pkg/-/write-pkg-3.1.0.tgz#f58767f4fb9a6a3ad8e95d3e9cd1f2d026ceab26"