Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update eslint related packages #48513

Merged
merged 25 commits into from
Oct 21, 2019
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
442d507
Update eslint related packages
renovate-bot Oct 17, 2019
54fe71d
Merge branch 'master' of github.com:elastic/kibana into renovate/eslint
Oct 18, 2019
3e85116
add errorMessage to no-restricted-paths validation
Oct 18, 2019
09daa49
add license to eslintrc file
Oct 21, 2019
48d1367
ignore broken plugin fixture
Oct 21, 2019
b9d26ce
upgrade tangled peer deps
Oct 21, 2019
e164733
Merge branch 'master' of github.com:elastic/kibana into renovate/eslint
Oct 21, 2019
5b27afc
give name to unnamed func to avoid typescript-eslint/typescript-eslin…
Oct 21, 2019
2773db7
migrate away from removed prefer-interface
Oct 21, 2019
63139d9
migrate away from removed no-angle-bracket-type-assertions rule
Oct 21, 2019
3efb7d2
migrate away from removed no-triple-slash-reference rule
Oct 21, 2019
a4b073d
old config was invalid and made this rule a noop
Oct 21, 2019
45487aa
fix array-type rule config
Oct 21, 2019
28ced93
fix readonly paramProperties that weren't being checked
Oct 21, 2019
c1a80f9
fix propType ordering
Oct 21, 2019
b5aea33
remove references to non-existent rules
Oct 21, 2019
542b119
remove unnecessary disable that is improperly formatted
Oct 21, 2019
ae229bd
fix comment-related spacing
Oct 21, 2019
2f8dca5
fix typo/invalid namespace overrides
Oct 21, 2019
ee749c6
rename fn to avoid hook-alike behavior
Oct 21, 2019
6a4e0fd
remove reference to old removed rule
Oct 21, 2019
94bfc76
Merge branch 'master' of github.com:elastic/kibana into renovate/eslint
Oct 21, 2019
a382d63
use caret version for prettier
Oct 21, 2019
cf04a8c
Merge branch 'master' of github.com:elastic/kibana into renovate/eslint
Oct 21, 2019
24f72fb
reference babel-eslint with absolute path
Oct 21, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ bower_components
/x-pack/legacy/plugins/infra/public/graphql/types.ts
/x-pack/legacy/plugins/infra/server/graphql/types.ts
/x-pack/legacy/plugins/apm/cypress/**/snapshots.js
/src/legacy/plugin_discovery/plugin_pack/__tests__/fixtures/plugins/broken
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The globbing has been improved a little so the code in this directory was being tested now.

**/graphql/types.ts
**/*.js.snap
!/.eslintrc.js
20 changes: 19 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

const { readdirSync } = require('fs');
const { resolve } = require('path');

Expand Down Expand Up @@ -622,7 +641,6 @@ module.exports = {
// will introduced after the other warns are fixed
// 'react/sort-comp': 'error',
'react/void-dom-elements-no-children': 'error',
'react/jsx-boolean-value': ['error', 'warn'],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This configuration is invalid, which caused this to be a noop, so I removed it.

// will introduced after the other warns are fixed
// 'react/jsx-no-bind': 'error',
'react/jsx-no-comment-textnodes': 'error',
Expand Down
2 changes: 1 addition & 1 deletion kibana.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import * as LegacyKibanaServer from './src/legacy/server/kbn_server';
/**
* Re-export legacy types under a namespace.
*/
// eslint-disable-next-line @typescript/eslint-no-namespace
// eslint-disable-next-line @typescript-eslint/no-namespace
export namespace Legacy {
export type IndexPatternsService = LegacyKibanaServer.IndexPatternsService;
export type KibanaConfig = LegacyKibanaServer.KibanaConfig;
Expand Down
34 changes: 17 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@
"@types/delete-empty": "^2.0.0",
"@types/elasticsearch": "^5.0.33",
"@types/enzyme": "^3.9.0",
"@types/eslint": "^4.16.8",
"@types/eslint": "^6.1.2",
"@types/execa": "^0.9.0",
"@types/fetch-mock": "^7.3.1",
"@types/getopts": "^2.0.1",
Expand Down Expand Up @@ -352,8 +352,8 @@
"@types/uuid": "^3.4.4",
"@types/vinyl-fs": "^2.4.11",
"@types/zen-observable": "^0.8.0",
"@typescript-eslint/eslint-plugin": "1.13.0",
"@typescript-eslint/parser": "1.13.0",
"@typescript-eslint/eslint-plugin": "^2.5.0",
"@typescript-eslint/parser": "^2.5.0",
"angular-mocks": "^1.7.8",
"archiver": "^3.1.1",
"babel-eslint": "^10.0.3",
Expand All @@ -373,21 +373,21 @@
"enzyme-adapter-react-16": "^1.14.0",
"enzyme-adapter-utils": "^1.12.0",
"enzyme-to-json": "^3.3.4",
"eslint": "5.16.0",
"eslint-config-prettier": "6.3.0",
"eslint": "^6.5.1",
"eslint-config-prettier": "^6.4.0",
"eslint-plugin-babel": "^5.3.0",
"eslint-plugin-ban": "1.3.0",
"eslint-plugin-cypress": "^2.6.1",
"eslint-plugin-import": "2.18.2",
"eslint-plugin-jest": "22.17.0",
"eslint-plugin-jsx-a11y": "6.2.3",
"eslint-plugin-mocha": "6.1.1",
"eslint-plugin-no-unsanitized": "3.0.2",
"eslint-plugin-node": "9.2.0",
"eslint-plugin-prefer-object-spread": "1.2.1",
"eslint-plugin-prettier": "3.1.1",
"eslint-plugin-react": "7.13.0",
"eslint-plugin-react-hooks": "1.6.0",
"eslint-plugin-ban": "^1.3.0",
"eslint-plugin-cypress": "^2.7.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jest": "^22.19.0",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-mocha": "^6.2.0",
"eslint-plugin-no-unsanitized": "^3.0.2",
"eslint-plugin-node": "^10.0.0",
"eslint-plugin-prefer-object-spread": "^1.2.1",
"eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-react": "^7.16.0",
"eslint-plugin-react-hooks": "^2.1.2",
"exit-hook": "^2.2.0",
"faker": "1.1.0",
"fetch-mock": "^7.3.9",
Expand Down
24 changes: 12 additions & 12 deletions packages/eslint-config-kibana/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@
},
"homepage": "https://github.com/elastic/eslint-config-kibana#readme",
"peerDependencies": {
"@typescript-eslint/eslint-plugin": "1.13.0",
"@typescript-eslint/parser": "1.13.0",
"@typescript-eslint/eslint-plugin": "^2.5.0",
"@typescript-eslint/parser": "^2.5.0",
"babel-eslint": "^10.0.3",
"eslint": "5.16.0",
"eslint": "^6.5.1",
"eslint-plugin-babel": "^5.3.0",
"eslint-plugin-ban": "1.3.0",
"eslint-plugin-jsx-a11y": "6.2.3",
"eslint-plugin-import": "2.18.2",
"eslint-plugin-jest": "^22.17.0",
"eslint-plugin-mocha": "^6.1.1",
"eslint-plugin-no-unsanitized": "3.0.2",
"eslint-plugin-prefer-object-spread": "1.2.1",
"eslint-plugin-react": "7.13.0",
"eslint-plugin-react-hooks": "1.6.0"
"eslint-plugin-ban": "^1.3.0",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jest": "^22.19.0",
"eslint-plugin-mocha": "^6.2.0",
"eslint-plugin-no-unsanitized": "^3.0.2",
"eslint-plugin-prefer-object-spread": "^1.2.1",
"eslint-plugin-react": "^7.16.0",
"eslint-plugin-react-hooks": "^2.1.2"
}
}
12 changes: 8 additions & 4 deletions packages/eslint-config-kibana/typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ module.exports = {
//
// Old recommended tslint rules
'@typescript-eslint/adjacent-overload-signatures': 'error',
'@typescript-eslint/array-type': ['error', 'array-simple'],
'@typescript-eslint/array-type': ['error', { default: 'array-simple', readonly: 'array-simple' }],
'@typescript-eslint/ban-types': 'error',
'camelcase': 'off',
'@typescript-eslint/camelcase': ['error', {
Expand All @@ -92,15 +92,19 @@ module.exports = {
'indent': 'off',
'@typescript-eslint/indent': [ 'error', 2, { SwitchCase: 1 } ],
'@typescript-eslint/prefer-function-type': 'error',
'@typescript-eslint/prefer-interface': 'error',
'@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
'@typescript-eslint/member-ordering': ['error', {
'default': ['public-static-field', 'static-field', 'instance-field']
}],
'@typescript-eslint/no-angle-bracket-type-assertion': 'error',
'@typescript-eslint/consistent-type-assertions': 'error',
'@typescript-eslint/no-empty-interface': 'error',
'@typescript-eslint/no-misused-new': 'error',
'@typescript-eslint/no-namespace': 'error',
'@typescript-eslint/no-triple-slash-reference': 'error',
'@typescript-eslint/triple-slash-reference': ['error', {
path: 'never',
types: 'never',
lib: 'never'
}],
'@typescript-eslint/no-var-requires': 'error',
'@typescript-eslint/type-annotation-spacing': 'error',
'@typescript-eslint/unified-signatures': 'error',
Expand Down
8 changes: 4 additions & 4 deletions packages/kbn-es/src/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@
const os = require('os');
const path = require('path');

function useBat(bin) {
function maybeUseBat(bin) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This triggers React hooks checks

return os.platform().startsWith('win') ? `${bin}.bat` : bin;
}

const tempDir = os.tmpdir();

exports.BASE_PATH = path.resolve(tempDir, 'kbn-es');

exports.GRADLE_BIN = useBat('./gradlew');
exports.ES_BIN = useBat('bin/elasticsearch');
exports.GRADLE_BIN = maybeUseBat('./gradlew');
exports.ES_BIN = maybeUseBat('bin/elasticsearch');
exports.ES_CONFIG = 'config/elasticsearch.yml';

exports.ES_KEYSTORE_BIN = useBat('./bin/elasticsearch-keystore');
exports.ES_KEYSTORE_BIN = maybeUseBat('./bin/elasticsearch-keystore');
2 changes: 1 addition & 1 deletion packages/kbn-eslint-plugin-eslint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"license": "Apache-2.0",
"peerDependencies": {
"eslint": "5.16.0",
"eslint": "6.5.1",
"babel-eslint": "^10.0.3"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ module.exports = {
anyOf: [{ type: 'string' }, { type: 'array', items: { type: 'string' } }],
},
allowSameFolder: { type: 'boolean' },
errorMessage: { type: 'string' },
},
additionalProperties: false,
},
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-test-subj-selector/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
*/

// eslint-disable-next-line import/no-default-export
export default function(selector: string): string;
export default function kbnTestSubjSelector(selector: string): string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 changes: 1 addition & 1 deletion src/core/public/plugins/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export class PluginWrapper<
private instance?: Plugin<TSetup, TStart, TPluginsSetup, TPluginsStart>;

constructor(
readonly discoveredPlugin: DiscoveredPlugin,
public readonly discoveredPlugin: DiscoveredPlugin,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and other instances of adding public modifiers are necessary because of typescript-eslint/typescript-eslint#857, which prevented property parameters created using the readonly keyword from being validated like normal.

public readonly opaqueId: PluginOpaqueId,
private readonly initializerContext: PluginInitializerContext
) {
Expand Down
1 change: 0 additions & 1 deletion src/core/public/saved_objects/simple_saved_object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import { SavedObjectsClient } from './saved_objects_client';
export class SimpleSavedObject<T extends SavedObjectAttributes> {
public attributes: T;
// We want to use the same interface this class had in JS
// eslint-disable-next-line variable-name
public _version?: SavedObjectType<T>['version'];
public id: SavedObjectType<T>['id'];
public type: SavedObjectType<T>['type'];
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/config/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export class Env {
/**
* @internal
*/
constructor(readonly homeDir: string, options: EnvOptions) {
constructor(public readonly homeDir: string, options: EnvOptions) {
this.configDir = resolve(this.homeDir, 'config');
this.binDir = resolve(this.homeDir, 'bin');
this.logDir = resolve(this.homeDir, 'log');
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/config/raw_config_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class RawConfigService {
private readonly config$: Observable<Config>;

constructor(
readonly configFiles: readonly string[],
public readonly configFiles: readonly string[],
configAdapter: (rawConfig: Record<string, any>) => Config = rawConfig =>
new ObjectToConfigAdapter(rawConfig)
) {
Expand Down
6 changes: 3 additions & 3 deletions src/core/server/http/router/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ export class KibanaRequest<Params = unknown, Query = unknown, Body = unknown> {

constructor(
request: Request,
readonly params: Params,
readonly query: Query,
readonly body: Body,
public readonly params: Params,
public readonly query: Query,
public readonly body: Body,
// @ts-ignore we will use this flag as soon as http request proxy is supported in the core
// until that time we have to expose all the headers
private readonly withoutSecretHeaders: boolean
Expand Down
6 changes: 3 additions & 3 deletions src/core/server/http/router/response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ export function isKibanaResponse(response: Record<string, any>): response is IKi
export class KibanaResponse<T extends HttpResponsePayload | ResponseError = any>
implements IKibanaResponse<T> {
constructor(
readonly status: number,
readonly payload?: T,
readonly options: HttpResponseOptions = {}
public readonly status: number,
public readonly payload?: T,
public readonly options: HttpResponseOptions = {}
) {}
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/server/http/router/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export class Router implements IRouter {
public put: IRouter['put'];

constructor(
readonly routerPath: string,
public readonly routerPath: string,
private readonly log: Logger,
private readonly enhanceWithContext: ContextEnhancer<any, any, any>
) {
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/logging/log_level.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class LogLevel {
}
}

private constructor(readonly id: LogLevelId, readonly value: number) {}
private constructor(public readonly id: LogLevelId, public readonly value: number) {}

/**
* Indicates whether current log level covers the one that is passed as an argument.
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/plugins/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class PluginWrapper<
private instance?: Plugin<TSetup, TStart, TPluginsSetup, TPluginsStart>;

constructor(
readonly params: {
public readonly params: {
readonly path: string;
readonly manifest: PluginManifest;
readonly opaqueId: PluginOpaqueId;
Expand Down
4 changes: 2 additions & 2 deletions src/core/server/saved_objects/service/lib/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ import { validateConvertFilterToKueryNode } from './filter_utils';
// BEWARE: The SavedObjectClient depends on the implementation details of the SavedObjectsRepository
// so any breaking changes to this repository are considered breaking changes to the SavedObjectsClient.

// eslint-disable-next-line @typescript-eslint/prefer-interface
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
type Left<T> = {
tag: 'Left';
error: T;
};
// eslint-disable-next-line @typescript-eslint/prefer-interface
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
type Right<T> = {
tag: 'Right';
value: T;
Expand Down
4 changes: 2 additions & 2 deletions src/core/server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ export class Server {
private readonly uiSettings: UiSettingsService;

constructor(
readonly config$: Observable<Config>,
readonly env: Env,
public readonly config$: Observable<Config>,
public readonly env: Env,
private readonly logger: LoggerFactory
) {
this.log = this.logger.get('server');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export interface FilterableContainerInput extends ContainerInput {
* https://github.com/microsoft/TypeScript/issues/15300 is fixed so we use a type
* here instead
*/
// eslint-disable-next-line @typescript-eslint/prefer-interface
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
export type InheritedChildrenInput = {
filters: Filter[];
id?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const HELLO_WORLD_CONTAINER = 'HELLO_WORLD_CONTAINER';
* https://github.com/microsoft/TypeScript/issues/15300 is fixed so we use a type
* here instead
*/
// eslint-disable-next-line @typescript-eslint/prefer-interface
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
type InheritedInput = {
id: string;
viewMode: ViewMode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

class FormattedData {
constructor(readonly raw: any, readonly formatted: any) {}
constructor(public readonly raw: any, public readonly formatted: any) {}
}

export { FormattedData };
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
// Which is basically the Haskel equivalent of Rust/ML/Scala's Result
// I'll reach out to other's in Kibana to see if we can merge these into one type

// eslint-disable-next-line @typescript-eslint/prefer-interface
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
export type Ok<T> = {
tag: 'ok';
value: T;
};
// eslint-disable-next-line @typescript-eslint/prefer-interface
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
export type Err<E> = {
tag: 'err';
error: E;
Expand Down
3 changes: 0 additions & 3 deletions x-pack/legacy/plugins/apm/cypress/cypress.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
* you may not use this file except in compliance with the Elastic License.
*/

// eslint-disable-next-line spaced-comment
/// <reference types="cypress" />

declare namespace Cypress {
interface Chainable<Subject> {
snapshot: () => {};
Expand Down
3 changes: 0 additions & 3 deletions x-pack/legacy/plugins/apm/cypress/integration/apm.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
* you may not use this file except in compliance with the Elastic License.
*/

// eslint-disable-next-line spaced-comment
/// <reference types="cypress" />

import { loginAndWaitForPage } from './helpers';

describe('When clicking opbeans-go service', () => {
Expand Down
Loading