mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[Code]: clean uneccessary ts-ignores (#34203)
This commit is contained in:
parent
0f157b653d
commit
817f43e6ec
18 changed files with 85 additions and 92 deletions
|
@ -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",
|
||||
|
|
|
@ -85,8 +85,8 @@ class CodeImportProject extends React.PureComponent<
|
|||
</EuiFormRow>
|
||||
</EuiFlexItem>
|
||||
<EuiFlexItem grow={false}>
|
||||
{/*
|
||||
// @ts-ignore */}
|
||||
{/*
|
||||
// @ts-ignore */}
|
||||
<ImportButton
|
||||
onClick={this.submitImportProject}
|
||||
data-test-subj="importRepositoryButton"
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
// @ts-ignore
|
||||
import {
|
||||
EuiButton,
|
||||
EuiFieldText,
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { editor } from 'monaco-editor';
|
||||
import React from 'react';
|
||||
import { MonacoDiffEditor } from '../../monaco/monaco_diff_editor';
|
||||
|
||||
|
@ -34,8 +35,7 @@ export class DiffEditor extends React.Component<Props> {
|
|||
}
|
||||
|
||||
public updateLayout(renderSideBySide: boolean) {
|
||||
// @ts-ignore
|
||||
this.diffEditor!.diffEditor!.updateOptions({ renderSideBySide });
|
||||
this.diffEditor!.diffEditor!.updateOptions({ renderSideBySide } as editor.IDiffEditorOptions);
|
||||
}
|
||||
|
||||
public render() {
|
||||
|
|
|
@ -96,8 +96,6 @@ export class HoverWidget extends React.PureComponent<HoverWidgetProps> {
|
|||
private renderInitialting() {
|
||||
return (
|
||||
<div className="hover-row">
|
||||
{/*
|
||||
// @ts-ignore */}
|
||||
<Text textAlign="center">
|
||||
<h4>Language Server is initializing…</h4>
|
||||
<p>Depending on the size of your repo, this could take a few minutes.</p>
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -20,24 +20,16 @@ export const ErrorPanel = (props: { title: ReactNode; content: string }) => {
|
|||
<Root>
|
||||
<EuiPanel>
|
||||
<EuiSpacer />
|
||||
{/*
|
||||
// @ts-ignore */}
|
||||
<EuiText textAlign="center">
|
||||
<ErrorIcon />
|
||||
</EuiText>
|
||||
{/*
|
||||
// @ts-ignore */}
|
||||
<EuiText textAlign="center">{props.title}</EuiText>
|
||||
<EuiSpacer />
|
||||
{/*
|
||||
// @ts-ignore */}
|
||||
<EuiText textAlign="center">
|
||||
<EuiTextColor>{props.content}</EuiTextColor>
|
||||
</EuiText>
|
||||
<EuiSpacer />
|
||||
<EuiSpacer />
|
||||
{/*
|
||||
// @ts-ignore */}
|
||||
<EuiText textAlign="center">
|
||||
<EuiButton fill={true} onClick={history.goBack}>
|
||||
Go Back
|
||||
|
|
|
@ -61,7 +61,6 @@ export const SuggestionComponent: SFC<Props> = props => {
|
|||
onClick={click}
|
||||
// active={props.selected}
|
||||
onMouseEnter={props.onMouseEnter}
|
||||
// @ts-ignore
|
||||
ref={props.innerRef}
|
||||
id={props.ariaId}
|
||||
aria-selected={props.selected}
|
||||
|
|
|
@ -5,9 +5,7 @@
|
|||
*/
|
||||
|
||||
import {
|
||||
// @ts-ignore
|
||||
EuiFacetButton,
|
||||
// @ts-ignore
|
||||
EuiFacetGroup,
|
||||
EuiFlexGroup,
|
||||
EuiFlexItem,
|
||||
|
|
|
@ -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<Props, { activePath?: st
|
|||
onClick={this.getClickHandler(path)}
|
||||
>
|
||||
<EuiFlexGroup gutterSize="none" alignItems="center" className="code-structure-node">
|
||||
{/*
|
||||
// @ts-ignore */}
|
||||
<Token iconType={tokenType} />
|
||||
<Token iconType={tokenType as IconType} />
|
||||
<EuiText data-test-subj={`codeStructureTreeNode-${name}`} size="s">
|
||||
{name}
|
||||
</EuiText>
|
||||
|
|
|
@ -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 = {
|
||||
|
|
|
@ -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);
|
||||
|
||||
});
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
import hapi from 'hapi';
|
||||
import url from 'url';
|
||||
// @ts-ignore
|
||||
import wreck from 'wreck';
|
||||
import { Logger } from '../log';
|
||||
|
||||
|
|
|
@ -64,7 +64,6 @@ export class SecureRoute {
|
|||
}
|
||||
|
||||
private isSecurityEnabledInEs() {
|
||||
// @ts-ignore
|
||||
const xpackInfo = this.server.plugins.xpack_main.info;
|
||||
if (
|
||||
xpackInfo.isAvailable() &&
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -20,7 +20,6 @@ export function promiseTimeout<T>(ms: number, promise: Promise<T>): Promise<T> {
|
|||
});
|
||||
|
||||
// Returns a race between our timeout and the passed in promise
|
||||
// @ts-ignore
|
||||
return Promise.race([promise, timeout]);
|
||||
} else {
|
||||
return Promise.reject(boom);
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue