chore(NA): eslint rule for disallowing naked eslint-disable (#136408)

* chore(NA): eslint rule for disallowing naked eslint-disable

* chore(NA): export new rule and update docs

* chore(NA): creation of rule in ts

* chore(NA): new corrected rule in ts

* refact(NA): remove old logic from older plugin

* docs(NA): update documentation

* docs(NA): update documentation

* docs(NA): update documentation

* refact(NA): include edge cases for better locating errors

* chore(NA): changed regex name

* docs(NA): correct name rule on docs

* refact(NA): use dedent in the template literals

* refact(NA): check for undefined

* fix(NA): introduces support for eslint-disable-line

* chore(NA): fix extra space

* test(NA): created more test cases

* chore(NA): rename plugin to eslint-plugin-disable

* docs(NA): update nav and operations landing page ids for eslint rule

* test(NA): use messageIds on test

* chore(NA): complete naked eslint disables with specific rules

* chore(NA): specific rules for a few naked eslint disable

* chore(NA): add focused eslint disable on big reindex_operation_with_large_error_message.ts file

* chore(NA): changes according PR feedback

* chore(NA): include specific eslint rules on latest naked eslint disable

* chore(NA): missing eslint disable specific rule

* fix(NA): remove comment for js annotator

* chore(NA): re add eslint focused disable rule to x-pack/plugins/osquery/cypress/support/coverage.ts

* chore(NA): re add eslint focused disable rule to x-pack/plugins/osquery/cypress/support/coverage.ts

* chore(NA): re add eslint focused disable rule to x-pack/plugins/osquery/cypress/support/coverage.ts

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Tiago Costa 2022-07-19 17:11:04 +01:00 committed by GitHub
parent 1aef76b7e2
commit 302bd423f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
101 changed files with 704 additions and 125 deletions

View file

@ -38,6 +38,8 @@ layout: landing
{ pageId: "kibDevDocsOpsEslintConfig" },
{ pageId: "kibDevDocsOpsEslintWithTypes" },
{ pageId: "kibDevDocsOpsEslintPluginImports" },
{ pageId: "kibDevDocsOpsEslintPluginDisable" },
{ pageId: "kibDevDocsOpsKbnYarnLockValidator"},
]}
/>

View file

@ -12,7 +12,7 @@ import { CountUntil } from '../../../../components/count_until';
import { Page } from '../../../../components/page';
import { useDeps } from '../../../../hooks/use_deps';
// eslint-disable-next-line
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface Props {}
export const PageCountUntil: React.FC<Props> = () => {

View file

@ -12,7 +12,7 @@ import { DoubleIntegers } from '../../../../components/double_integers';
import { Page } from '../../../../components/page';
import { useDeps } from '../../../../hooks/use_deps';
// eslint-disable-next-line
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface Props {}
export const PageDoubleIntegers: React.FC<Props> = () => {

View file

@ -11,7 +11,7 @@ import { EuiPageSideBar, EuiSideNav } from '@elastic/eui';
import { useHistory } from 'react-router-dom';
import { routes } from '../../../routes';
// eslint-disable-next-line
// eslint-disable-next-line @typescript-eslint/no-empty-interface
interface SidebarProps {}
export const Sidebar: React.FC<SidebarProps> = () => {

View file

@ -14,7 +14,7 @@ export interface ResponseStreamSetupPlugins {
developerExamples: DeveloperExamplesSetup;
}
// eslint-disable-next-line
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface ResponseStreamStartPlugins {}
export class ResponseStreamPlugin implements Plugin {

View file

@ -11,10 +11,10 @@ import type { DataRequestHandlerContext } from '@kbn/data-plugin/server';
import { defineReducerStreamRoute, defineSimpleStringStreamRoute } from './routes';
// eslint-disable-next-line
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface ResponseStreamSetupPlugins {}
// eslint-disable-next-line
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface ResponseStreamStartPlugins {}
export class ResponseStreamPlugin implements Plugin {

View file

@ -488,6 +488,9 @@
{
"id": "kibDevDocsOpsEslintPluginImports"
},
{
"id": "kibDevDocsOpsEslintPluginDisable"
},
{
"id": "kibDevDocsOpsKbnYarnLockValidator"
}

View file

@ -224,6 +224,7 @@
"@kbn/doc-links": "link:bazel-bin/packages/kbn-doc-links",
"@kbn/es-errors": "link:bazel-bin/packages/kbn-es-errors",
"@kbn/es-query": "link:bazel-bin/packages/kbn-es-query",
"@kbn/eslint-plugin-disable": "link:bazel-bin/packages/kbn-eslint-plugin-disable",
"@kbn/eslint-plugin-imports": "link:bazel-bin/packages/kbn-eslint-plugin-imports",
"@kbn/field-types": "link:bazel-bin/packages/kbn-field-types",
"@kbn/flot-charts": "link:bazel-bin/packages/kbn-flot-charts",
@ -820,6 +821,7 @@
"@types/kbn__es-archiver": "link:bazel-bin/packages/kbn-es-archiver/npm_module_types",
"@types/kbn__es-errors": "link:bazel-bin/packages/kbn-es-errors/npm_module_types",
"@types/kbn__es-query": "link:bazel-bin/packages/kbn-es-query/npm_module_types",
"@types/kbn__eslint-plugin-disable": "link:bazel-bin/packages/kbn-eslint-plugin-disable/npm_module_types",
"@types/kbn__eslint-plugin-imports": "link:bazel-bin/packages/kbn-eslint-plugin-imports/npm_module_types",
"@types/kbn__field-types": "link:bazel-bin/packages/kbn-field-types/npm_module_types",
"@types/kbn__find-used-node-modules": "link:bazel-bin/packages/kbn-find-used-node-modules/npm_module_types",

View file

@ -123,6 +123,7 @@ filegroup(
"//packages/kbn-es-query:build",
"//packages/kbn-es:build",
"//packages/kbn-eslint-config:build",
"//packages/kbn-eslint-plugin-disable:build",
"//packages/kbn-eslint-plugin-eslint:build",
"//packages/kbn-eslint-plugin-imports:build",
"//packages/kbn-expect:build",
@ -327,6 +328,7 @@ filegroup(
"//packages/kbn-es-archiver:build_types",
"//packages/kbn-es-errors:build_types",
"//packages/kbn-es-query:build_types",
"//packages/kbn-eslint-plugin-disable:build_types",
"//packages/kbn-eslint-plugin-imports:build_types",
"//packages/kbn-field-types:build_types",
"//packages/kbn-find-used-node-modules:build_types",

View file

@ -48,7 +48,7 @@ export function loadSnippet({
window._fs_org = fullStoryOrgId;
window._fs_namespace = namespace;
/* eslint-disable */
/* eslint-disable dot-notation,prettier/prettier,@typescript-eslint/no-shadow,prefer-rest-params,@typescript-eslint/no-unused-expressions */
(function(m,n,e,t,l,o,g,y){
if (e in m) {if(m.console && m.console.log) { m.console.log('FullStory namespace conflict. Please set window["_fs_namespace"].');} return;}
// @ts-expect-error

View file

@ -5,7 +5,7 @@
* See `packages/elastic-safer-lodash-set/LICENSE` for more information.
*/
/* eslint-disable */
/* eslint-disable one-var,prettier/prettier,no-var,eqeqeq,no-nested-ternary */
var assignValue = require('lodash/_assignValue'),
castPath = require('lodash/_castPath'),

View file

@ -5,7 +5,7 @@
* See `packages/elastic-safer-lodash-set/LICENSE` for more information.
*/
/* eslint-disable */
/* eslint-disable no-var */
var baseSet = require('./_baseSet');

View file

@ -5,7 +5,7 @@
* See `packages/elastic-safer-lodash-set/LICENSE` for more information.
*/
/* eslint-disable */
/* eslint-disable no-var,eqeqeq */
var baseSet = require('./_baseSet');

View file

@ -39,7 +39,9 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/* eslint-disable */
/* eslint-disable prettier/prettier,no-var,eqeqeq,no-use-before-define,block-scoped-var,no-undef,
guard-for-in,one-var,strict,no-redeclare,no-sequences,no-proto,new-cap,no-nested-ternary,no-unused-vars,
prefer-const,no-empty,no-extend-native,camelcase */
/*
This file is loaded up as a blob by Brace to hand to Ace to load as Jsonp
(hence the redefining of everything). It is based on the json

View file

@ -64,7 +64,7 @@ export class Reporter {
private log(message: unknown) {
if (this.debug) {
// eslint-disable-next-line
// eslint-disable-next-line no-console
console.debug(message);
}
}

View file

@ -49,7 +49,7 @@ export enum FilterStateStore {
GLOBAL_STATE = 'globalState',
}
// eslint-disable-next-line
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
export type FilterMeta = {
alias?: string | null;
disabled?: boolean;
@ -67,7 +67,7 @@ export type FilterMeta = {
value?: string;
};
// eslint-disable-next-line
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
export type Filter = {
$state?: {
store: FilterStateStore;
@ -76,7 +76,7 @@ export type Filter = {
query?: Record<string, any>;
};
// eslint-disable-next-line
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
export type Query = {
query: string | { [key: string]: any };
language: string;

View file

@ -9,7 +9,7 @@
// Generated by Peggy 1.2.0.
//
// https://peggyjs.org/
/* eslint-disable */
/* eslint-disable prettier/prettier,no-var,strict,no-use-before-define,one-var,no-undef,no-unused-vars,new-cap */
"use strict";

View file

@ -9,6 +9,7 @@ module.exports = {
],
plugins: [
'@kbn/eslint-plugin-disable',
'@kbn/eslint-plugin-eslint',
'@kbn/eslint-plugin-imports',
'prettier',
@ -232,6 +233,7 @@ module.exports = {
},
]],
'@kbn/disable/no_naked_eslint_disable': 'error',
'@kbn/eslint/no_async_promise_body': 'error',
'@kbn/eslint/no_async_foreach': 'error',
'@kbn/eslint/no_trailing_import_slash': 'error',

View file

@ -27,6 +27,7 @@ NPM_MODULE_EXTRA_FILES = [
RUNTIME_DEPS = [
"//packages/kbn-babel-preset",
"//packages/kbn-dev-utils",
"//packages/kbn-eslint-plugin-disable",
"//packages/kbn-eslint-plugin-imports",
"@npm//eslint-config-prettier",
"@npm//semver",

View file

@ -0,0 +1,117 @@
load("@npm//@bazel/typescript:index.bzl", "ts_config")
load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project")
PKG_DIRNAME = "kbn-eslint-plugin-disable"
PKG_REQUIRE_NAME = "@kbn/eslint-plugin-disable"
SOURCE_FILES = glob(
[
"src/**/*.ts",
],
exclude = [
"**/*.test.*",
],
)
SRCS = SOURCE_FILES
filegroup(
name = "srcs",
srcs = SRCS,
)
NPM_MODULE_EXTRA_FILES = [
"package.json",
]
# In this array place runtime dependencies, including other packages and NPM packages
# which must be available for this code to run.
#
# To reference other packages use:
# "//repo/relative/path/to/package"
# eg. "//packages/kbn-utils"
#
# To reference a NPM package use:
# "@npm//name-of-package"
# eg. "@npm//lodash"
RUNTIME_DEPS = [
"@npm//eslint",
]
# In this array place dependencies necessary to build the types, which will include the
# :npm_module_types target of other packages and packages from NPM, including @types/*
# packages.
#
# To reference the types for another package use:
# "//repo/relative/path/to/package:npm_module_types"
# eg. "//packages/kbn-utils:npm_module_types"
#
# References to NPM packages work the same as RUNTIME_DEPS
TYPES_DEPS = [
"@npm//@types/eslint",
"@npm//@types/jest",
"@npm//@types/node",
]
jsts_transpiler(
name = "target_node",
srcs = SRCS,
build_pkg_name = package_name(),
)
ts_config(
name = "tsconfig",
src = "tsconfig.json",
deps = [
"//:tsconfig.base.json",
"//:tsconfig.bazel.json",
],
)
ts_project(
name = "tsc_types",
args = ['--pretty'],
srcs = SRCS,
deps = TYPES_DEPS,
declaration = True,
declaration_map = True,
emit_declaration_only = True,
out_dir = "target_types",
root_dir = "src",
tsconfig = ":tsconfig",
)
js_library(
name = PKG_DIRNAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node"],
package_name = PKG_REQUIRE_NAME,
visibility = ["//visibility:public"],
)
pkg_npm(
name = "npm_module",
deps = [":" + PKG_DIRNAME],
)
filegroup(
name = "build",
srcs = [":npm_module"],
visibility = ["//visibility:public"],
)
pkg_npm_types(
name = "npm_module_types",
srcs = SRCS,
deps = [":tsc_types"],
package_name = PKG_REQUIRE_NAME,
tsconfig = ":tsconfig",
visibility = ["//visibility:public"],
)
filegroup(
name = "build_types",
srcs = [":npm_module_types"],
visibility = ["//visibility:public"],
)

View file

@ -0,0 +1,13 @@
---
id: kibDevDocsOpsEslintPluginDisable
slug: /kibana-dev-docs/ops/kbn-eslint-plugin-disable
title: "@kbn/eslint-plugin-disable"
description: Custom ESLint rules for managing eslint rules disable in the Kibana repository
tags: ['kibana', 'dev', 'contributor', 'operations', 'eslint', 'disable']
---
`@kbn/eslint-plugin-disable` is an ESLint plugin providing custom rules to allow us to enforce specific eslint rules behaviours around eslint disables that we need to implement Bazel packages across the monorepo as our main development unit.
## `@kbn/disable/no_naked_eslint_disable`
Disallows the usage of naked eslint-disable comments without being specific about each rule to disable.

View file

@ -0,0 +1,13 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
module.exports = {
preset: '@kbn/test/jest_node',
rootDir: '../..',
roots: ['<rootDir>/packages/kbn-eslint-plugin-disable'],
};

View file

@ -0,0 +1,7 @@
{
"name": "@kbn/eslint-plugin-disable",
"private": true,
"version": "1.0.0",
"main": "./target_node/index.js",
"license": "SSPL-1.0 OR Elastic License 2.0"
}

View file

@ -0,0 +1,17 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { NoNakedESLintDisableRule } from './rules/no_naked_eslint_disable';
/**
* Custom ESLint rules, add `'@kbn/eslint-plugin-disable'` to your eslint config to use them
* @internal
*/
export const rules = {
no_naked_eslint_disable: NoNakedESLintDisableRule,
};

View file

@ -0,0 +1,277 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import dedent from 'dedent';
import { RuleTester } from 'eslint';
import { NoNakedESLintDisableRule, NAKED_DISABLE_MSG_ID } from './no_naked_eslint_disable';
const tsTester = [
'@typescript-eslint/parser',
new RuleTester({
parser: require.resolve('@typescript-eslint/parser'),
parserOptions: {
sourceType: 'module',
ecmaVersion: 2018,
ecmaFeatures: {
jsx: true,
},
},
}),
] as const;
const babelTester = [
'@babel/eslint-parser',
new RuleTester({
parser: require.resolve('@babel/eslint-parser'),
parserOptions: {
sourceType: 'module',
ecmaVersion: 2018,
requireConfigFile: false,
babelOptions: {
presets: ['@kbn/babel-preset/node_preset'],
},
},
}),
] as const;
for (const [name, tester] of [tsTester, babelTester]) {
describe(name, () => {
tester.run('@kbn/disable/no_naked_eslint_disable', NoNakedESLintDisableRule, {
valid: [
{
filename: 'foo.ts',
code: dedent`
// eslint-disable no-var
`,
},
{
filename: 'foo.ts',
code: dedent`
// eslint-disable-next-line no-use-before-define
`,
},
{
filename: 'foo.ts',
code: dedent`
// eslint-disable-line no-use-before-define
`,
},
{
filename: 'foo.ts',
code: dedent`
/* eslint-disable no-var */
`,
},
{
filename: 'foo.ts',
code: dedent`
/* eslint-disable no-console, no-control-regex*/
`,
},
{
filename: 'foo.ts',
code: dedent`
alert('foo'); // eslint-disable-line no-alert
`,
},
{
filename: 'foo.ts',
code: dedent`
const foo = 'foo';
let bar = 'ba';
/* eslint-disable no-alert */
alert(foo);
/* eslint-enable no-alert */
bar += 'r';
`,
},
{
filename: 'foo.ts',
code: dedent`
const foo = 'foo';
let bar = 'ba';
/* eslint-disable-next-line no-alert */
alert(foo);
bar += 'r';
`,
},
{
filename: 'foo.ts',
code: dedent`
const foo = 'foo';
let bar = 'ba';
alert(foo);/* eslint-disable-line no-alert */
bar += 'r';
`,
},
],
invalid: [
{
filename: 'foo.ts',
code: dedent`
/* eslint-disable */
const a = 1;
`,
errors: [
{
line: 1,
messageId: NAKED_DISABLE_MSG_ID,
},
],
output: '\nconst a = 1;',
},
{
filename: 'foo.ts',
code: dedent`
// eslint-disable-next-line
const a = 1;
`,
errors: [
{
line: 1,
messageId: NAKED_DISABLE_MSG_ID,
},
],
output: `\nconst a = 1;`,
},
{
filename: 'foo.ts',
code: dedent`
/* eslint-disable */
`,
errors: [
{
line: 1,
messageId: NAKED_DISABLE_MSG_ID,
},
],
output: '',
},
{
filename: 'foo.ts',
code: dedent`
// eslint-disable-next-line
`,
errors: [
{
line: 1,
messageId: NAKED_DISABLE_MSG_ID,
},
],
output: '',
},
{
filename: 'foo.ts',
code: dedent`
alert('foo');// eslint-disable-line
`,
errors: [
{
line: 1,
messageId: NAKED_DISABLE_MSG_ID,
},
],
output: `alert('foo');`,
},
{
filename: 'foo.ts',
code: dedent`
const foo = 'foo';
let bar = 'ba';
/* eslint-disable */
alert(foo);
/* eslint-enable */
bar += 'r';
`,
errors: [
{
line: 3,
messageId: NAKED_DISABLE_MSG_ID,
},
],
output: dedent`
const foo = 'foo';
let bar = 'ba';
alert(foo);
/* eslint-enable */
bar += 'r';
`,
},
{
filename: 'foo.ts',
code: dedent`
const foo = 'foo';
let bar = 'ba';
/* eslint-disable */
alert(foo);
bar += 'r';
`,
errors: [
{
line: 3,
messageId: NAKED_DISABLE_MSG_ID,
},
],
output: dedent`
const foo = 'foo';
let bar = 'ba';
alert(foo);
bar += 'r';
`,
},
{
filename: 'foo.ts',
code: dedent`
const foo = 'foo';
let bar = 'ba';
/* eslint-disable-next-line */
alert(foo);
bar += 'r';
`,
errors: [
{
line: 3,
messageId: NAKED_DISABLE_MSG_ID,
},
],
output: dedent`
const foo = 'foo';
let bar = 'ba';
alert(foo);
bar += 'r';
`,
},
{
filename: 'foo.ts',
code: dedent`
const foo = 'foo';
let bar = 'ba';
alert(foo);/* eslint-disable-line */
bar += 'r';
`,
errors: [
{
line: 3,
messageId: NAKED_DISABLE_MSG_ID,
},
],
output: dedent`
const foo = 'foo';
let bar = 'ba';
alert(foo);
bar += 'r';
`,
},
],
});
});
}

View file

@ -0,0 +1,88 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import Eslint from 'eslint';
export const NAKED_DISABLE_MSG_ID = 'no-naked-eslint-disable';
const messages = {
[NAKED_DISABLE_MSG_ID]:
'Using a naked eslint disable is not allowed. Please specify the specific rules to disable.',
};
const meta: Eslint.Rule.RuleMetaData = {
type: 'problem',
fixable: 'code',
docs: {
description:
'Prevents declaring naked eslint-disable* comments who do not provide specific rules to disable',
},
messages,
};
const ESLINT_DISABLE_RE =
/^eslint-disable(?:-next-line|-line)?(?<ruleName>$|(?:\s+(?:@(?:[\w-]+\/){1,2})?[\w-]+)?)/;
const create = (context: Eslint.Rule.RuleContext): Eslint.Rule.RuleListener => {
return {
Program(node) {
const nodeComments = node.comments || [];
nodeComments.forEach((comment) => {
const commentVal = comment.value.trim();
const nakedESLintRegexResult = commentVal.match(ESLINT_DISABLE_RE);
const ruleName = nakedESLintRegexResult?.groups?.ruleName;
// no regex match, exit early
if (!nakedESLintRegexResult) {
return;
}
// we have a rule name, exit early
if (ruleName) {
return;
}
const cStart = comment?.loc?.start;
const cEnd = comment?.loc?.end;
const cStartLine = comment?.loc?.start?.line;
// start or end loc is undefined, exit early
if (cStart === undefined || cEnd === undefined || cStartLine === undefined) {
return;
}
const disableStartsOnNextLine = comment.value.includes('disable-next-line');
const disableStartsInline = comment.value.includes('disable-line');
const cStartColumn = comment?.loc?.start?.column ?? 0;
const reportLoc = disableStartsOnNextLine
? { start: cStart, end: cEnd }
: {
// At this point we could have eslint-disable block or an eslint-disable-line.
// If we have an inline disable we need to report the column as -1 in order to get the report
start: { line: cStartLine, column: disableStartsInline ? -1 : cStartColumn - 1 },
end: cEnd,
};
// At this point we have a regex match, no rule name and a valid loc so lets report here
context.report({
node,
loc: reportLoc,
messageId: NAKED_DISABLE_MSG_ID,
fix(fixer) {
return fixer.removeRange(comment.range as Eslint.AST.Range);
},
});
});
},
};
};
export const NoNakedESLintDisableRule: Eslint.Rule.RuleModule = {
meta,
create,
};

View file

@ -0,0 +1,18 @@
{
"extends": "../../tsconfig.bazel.json",
"compilerOptions": {
"declaration": true,
"declarationMap": true,
"emitDeclarationOnly": true,
"outDir": "target_types",
"rootDir": "src",
"stripInternal": false,
"types": [
"jest",
"node"
]
},
"include": [
"src/**/*"
]
}

View file

@ -1 +1 @@
/* eslint-disable */
/* eslint-disable @kbn/eslint/require-license-header */

View file

@ -1 +1 @@
/* eslint-disable */
/* eslint-disable @kbn/eslint/require-license-header */

View file

@ -1 +1 @@
/* eslint-disable */
/* eslint-disable @kbn/eslint/require-license-header */

View file

@ -1 +1 @@
/* eslint-disable */
/* eslint-disable @kbn/eslint/require-license-header */

View file

@ -1 +1 @@
/* eslint-disable */
/* eslint-disable @kbn/eslint/require-license-header */

View file

@ -1,4 +1,4 @@
/* eslint-disable */
/* eslint-disable @kbn/eslint/require-license-header,import/no-default-export,@typescript-eslint/adjacent-overload-signatures,@typescript-eslint/unified-signatures */
// Type definitions for expect.js 0.3.1
// Project: https://github.com/Automattic/expect.js

View file

@ -1,4 +1,4 @@
/* eslint-disable */
/* eslint-disable @kbn/eslint/require-license-header,no-var,prettier/prettier,eqeqeq,block-scoped-var,no-redeclare,one-var,no-loop-func,dot-notation,no-nested-ternary,camelcase,no-unused-vars,no-undef */
var exports = module.exports;

View file

@ -1,4 +1,4 @@
/* eslint-disable */
/* eslint-disable @kbn/eslint/require-license-header,prettier/prettier,eqeqeq,no-nested-ternary,one-var,no-var */
// Copied from https://github.com/yahoo/intl-relativeformat/tree/master/dist/locale-data

View file

@ -24,7 +24,7 @@ export interface ParseResult {
annotations: Annotation[];
}
/* eslint-disable */
/* eslint-disable prettier/prettier,no-var,prefer-const,no-throw-literal,@typescript-eslint/no-shadow,one-var,@typescript-eslint/no-unused-expressions,object-shorthand,eqeqeq */
export const createParser = () => {
'use strict';

View file

@ -48,7 +48,7 @@ export const loadTestFiles = ({
const testModule = require(path); // eslint-disable-line import/no-dynamic-require
const testProvider = testModule.__esModule ? testModule.default : testModule;
runTestProvider(testProvider, path); // eslint-disable-line
runTestProvider(testProvider, path); // eslint-disable-line no-use-before-define
});
};

View file

@ -32,7 +32,7 @@ import { map } from 'lodash';
// Patch node 16 types to be compatible with jest 26
// https://github.com/facebook/jest/issues/11640#issuecomment-893867514
/* eslint-disable */
/* eslint-disable @typescript-eslint/no-namespace,@typescript-eslint/no-empty-interface,no-console */
declare global {
namespace NodeJS {
interface Global {}

View file

@ -35,7 +35,7 @@ function evaluate(expression, scope = {}, injectedFunctions = {}) {
}
function interpret(node, scope, injectedFunctions) {
const functions = Object.assign({}, includedFunctions, injectedFunctions); // eslint-disable-line
const functions = Object.assign({}, includedFunctions, injectedFunctions); // eslint-disable-line prefer-object-spread/prefer-object-spread
return exec(node);
function exec(node) {

View file

@ -102,7 +102,7 @@ module.exports = {
new webpack.DllReferencePlugin({
context: REPO_ROOT,
manifest: require(UiSharedDepsNpm.dllManifestPath), // eslint-disable-line
manifest: require(UiSharedDepsNpm.dllManifestPath), // eslint-disable-line import/no-dynamic-require
}),
],
};

View file

@ -115,7 +115,7 @@ function onRootShutdown(reason?: any) {
// There is a chance that logger wasn't configured properly and error that
// that forced root to shut down could go unnoticed. To prevent this we always
// mirror such fatal errors in standard output with `console.error`.
// eslint-disable-next-line
// eslint-disable-next-line no-console
console.error(`\n${chalk.white.bgRed(' FATAL ')} ${reason}\n`);
process.exit(reason instanceof CriticalError ? reason.processExitCode : 1);

View file

@ -498,7 +498,7 @@ describe('#rawToSavedObject', () => {
_id: 'foo:bar',
_source: {
// @ts-expect-error expects a string
// eslint-disable-next-line
// eslint-disable-next-line no-new-wrappers
type: new String('foo'),
},
})
@ -527,7 +527,7 @@ describe('#rawToSavedObject', () => {
expect(() =>
singleNamespaceSerializer.rawToSavedObject({
// @ts-expect-error expects a string
// eslint-disable-next-line
// eslint-disable-next-line no-new-wrappers
_id: new String('foo:bar'),
_source: {
type: 'foo',

View file

@ -13,10 +13,10 @@ import { DISABLE_BFETCH_COMPRESSION, removeLeadingSlash } from '../common';
import { createStreamingBatchedFunction, StreamingBatchedFunctionParams } from './batching';
import { BatchedFunc } from './batching/types';
// eslint-disable-next-line
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface BfetchPublicSetupDependencies {}
// eslint-disable-next-line
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface BfetchPublicStartDependencies {}
export interface BfetchPublicContract {

View file

@ -28,10 +28,10 @@ import {
import { createStream } from './streaming';
import { getUiSettings } from './ui_settings';
// eslint-disable-next-line
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface BfetchServerSetupDependencies {}
// eslint-disable-next-line
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface BfetchServerStartDependencies {}
export interface BatchProcessingRouteParams<BatchItemData, BatchItemResult> {
@ -50,7 +50,7 @@ export interface BfetchServerSetup {
) => void;
}
// eslint-disable-next-line
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface BfetchServerStart {}
const streamingHeaders = {

View file

@ -102,7 +102,7 @@ export function ConsoleHistory({ close }: Props) {
return () => done();
}, [history]);
/* eslint-disable */
/* eslint-disable jsx-a11y/no-noninteractive-element-to-interactive-role,jsx-a11y/click-events-have-key-events */
return (
<>
<div className="conHistory">

View file

@ -39,7 +39,9 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/* eslint-disable */
/* eslint-disable prettier/prettier,prefer-const,eqeqeq,import/no-commonjs,no-undef,no-sequences,
block-scoped-var,no-use-before-define,no-var,one-var,guard-for-in,new-cap,no-nested-ternary,no-redeclare,
no-unused-vars,no-extend-native,no-empty,camelcase,no-proto,@kbn/imports/no_unresolvable_imports */
/*
This file is loaded up as a blob by Brace to hand to Ace to load as Jsonp
(hence the redefining of everything). It is based on the javascript

View file

@ -303,7 +303,7 @@ export function getCurrentMethodAndTokenPaths(
return ret;
}
// eslint-disable-next-line
// eslint-disable-next-line import/no-default-export
export default function ({
coreEditor: editor,
parser,

View file

@ -25,7 +25,7 @@ test('renders DashboardCloneModal', () => {
const component = shallowWithI18nProvider(
<DashboardCloneModal title="dash title" onClose={onClose} onClone={onClone} />
);
expect(component).toMatchSnapshot(); // eslint-disable-line
expect(component).toMatchSnapshot();
});
test('onClone', () => {

View file

@ -26,5 +26,5 @@ test('renders DashboardSaveModal', () => {
showCopyOnSave={true}
/>
);
expect(component).toMatchSnapshot(); // eslint-disable-line
expect(component).toMatchSnapshot();
});

View file

@ -7,5 +7,5 @@
*/
export * from '../common/stubs';
// eslint-disable-next-line
// eslint-disable-next-line @kbn/imports/uniform_imports,@kbn/eslint/no-restricted-paths
export { createStubDataView } from '../../data_views/public/data_views/data_view.stub';

View file

@ -6,7 +6,7 @@
* Side Public License, v 1.
*/
/* eslint-disable */
/* eslint-disable @kbn/imports/uniform_imports */
import { KbnError } from '../../../kibana_utils/common';
@ -17,8 +17,6 @@ export class DataViewMissingIndices extends KbnError {
constructor(message: string) {
const defaultMessage = "Data view's title does not match any indices";
super(
message && message.length ? `No matching indices found: ${message}` : defaultMessage
);
super(message && message.length ? `No matching indices found: ${message}` : defaultMessage);
}
}

View file

@ -8,7 +8,7 @@
import type { DataViewFieldBase } from '@kbn/es-query';
import { ToastInputFields, ErrorToastOptions } from '@kbn/core/public/notifications';
// eslint-disable-next-line
// eslint-disable-next-line @kbn/eslint/no-restricted-paths,@kbn/imports/uniform_imports
import type { SavedObject } from 'src/core/server';
import { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import type { SerializedFieldFormat } from '@kbn/field-formats-plugin/common';

View file

@ -20,7 +20,7 @@ import {
ExecutionContract,
} from '../common';
// eslint-disable-next-line
// eslint-disable-next-line @typescript-eslint/no-var-requires,import/no-commonjs
const { __getLastExecution, __getLastRenderMode } = require('./services');
const element = null as unknown as HTMLElement;

View file

@ -27,7 +27,7 @@ const createRecentlyAccessed = (length) => {
test('render', () => {
const component = shallow(<RecentlyAccessed recentlyAccessed={createRecentlyAccessed(2)} />);
expect(component).toMatchSnapshot(); // eslint-disable-line
expect(component).toMatchSnapshot();
});
describe('more popover', () => {

View file

@ -20,7 +20,7 @@ test('render', () => {
url="link_to_item"
/>
);
expect(component).toMatchSnapshot(); // eslint-disable-line
expect(component).toMatchSnapshot();
});
describe('props', () => {
@ -34,7 +34,7 @@ describe('props', () => {
iconType="logoApache"
/>
);
expect(component).toMatchSnapshot(); // eslint-disable-line
expect(component).toMatchSnapshot();
});
test('iconUrl', () => {
@ -47,7 +47,7 @@ describe('props', () => {
iconUrl="icon_url"
/>
);
expect(component).toMatchSnapshot(); // eslint-disable-line
expect(component).toMatchSnapshot();
});
test('isBeta', () => {
@ -60,6 +60,6 @@ describe('props', () => {
isBeta={true}
/>
);
expect(component).toMatchSnapshot(); // eslint-disable-line
expect(component).toMatchSnapshot();
});
});

View file

@ -17,5 +17,5 @@ test('should render content with markdown', () => {
text={'I am *some* [content](https://en.wikipedia.org/wiki/Content) with `markdown`'}
/>
);
expect(component).toMatchSnapshot(); // eslint-disable-line
expect(component).toMatchSnapshot();
});

View file

@ -46,7 +46,7 @@ test('render', () => {
isCloudEnabled={false}
/>
);
expect(component).toMatchSnapshot(); // eslint-disable-line
expect(component).toMatchSnapshot();
});
describe('statusCheckState', () => {
@ -72,7 +72,7 @@ describe('statusCheckState', () => {
isCloudEnabled={false}
/>
);
expect(component).toMatchSnapshot(); // eslint-disable-line
expect(component).toMatchSnapshot();
});
test('checking status', () => {
@ -89,7 +89,7 @@ describe('statusCheckState', () => {
isCloudEnabled={false}
/>
);
expect(component).toMatchSnapshot(); // eslint-disable-line
expect(component).toMatchSnapshot();
});
test('failed status check - error', () => {
@ -106,7 +106,7 @@ describe('statusCheckState', () => {
isCloudEnabled={false}
/>
);
expect(component).toMatchSnapshot(); // eslint-disable-line
expect(component).toMatchSnapshot();
});
test('failed status check - no data', () => {
@ -123,7 +123,7 @@ describe('statusCheckState', () => {
isCloudEnabled={false}
/>
);
expect(component).toMatchSnapshot(); // eslint-disable-line
expect(component).toMatchSnapshot();
});
test('successful status check', () => {
@ -140,6 +140,6 @@ describe('statusCheckState', () => {
isCloudEnabled={false}
/>
);
expect(component).toMatchSnapshot(); // eslint-disable-line
expect(component).toMatchSnapshot();
});
});

View file

@ -23,7 +23,7 @@ test('render', () => {
basePath={basePathMock}
/>
);
expect(component).toMatchSnapshot(); // eslint-disable-line
expect(component).toMatchSnapshot();
});
describe('props', () => {
@ -36,7 +36,7 @@ describe('props', () => {
iconType="logoElastic"
/>
);
expect(component).toMatchSnapshot(); // eslint-disable-line
expect(component).toMatchSnapshot();
});
test('exportedFieldsUrl', () => {
@ -48,7 +48,7 @@ describe('props', () => {
exportedFieldsUrl="exported_fields_url"
/>
);
expect(component).toMatchSnapshot(); // eslint-disable-line
expect(component).toMatchSnapshot();
});
test('previewUrl', () => {
@ -60,7 +60,7 @@ describe('props', () => {
previewUrl="preview_image_url"
/>
);
expect(component).toMatchSnapshot(); // eslint-disable-line
expect(component).toMatchSnapshot();
});
test('isBeta', () => {
@ -72,7 +72,7 @@ describe('props', () => {
isBeta={true}
/>
);
expect(component).toMatchSnapshot(); // eslint-disable-line
expect(component).toMatchSnapshot();
});
test('Beats badge should show', () => {

View file

@ -149,7 +149,7 @@ test('should render ELASTIC_CLOUD instructions when isCloudEnabled is true', asy
);
await loadTutorialPromise;
component.update();
expect(component).toMatchSnapshot(); // eslint-disable-line
expect(component).toMatchSnapshot();
});
describe('custom status check', () => {

View file

@ -20,7 +20,7 @@ test('render', () => {
url="link_to_item"
/>
);
expect(component).toMatchSnapshot(); // eslint-disable-line
expect(component).toMatchSnapshot();
});
describe('props', () => {
@ -34,7 +34,7 @@ describe('props', () => {
iconType="logoApache"
/>
);
expect(component).toMatchSnapshot(); // eslint-disable-line
expect(component).toMatchSnapshot();
});
test('iconUrl', () => {
@ -47,7 +47,7 @@ describe('props', () => {
iconUrl="icon_url"
/>
);
expect(component).toMatchSnapshot(); // eslint-disable-line
expect(component).toMatchSnapshot();
});
test('isBeta', () => {
@ -60,6 +60,6 @@ describe('props', () => {
isBeta={true}
/>
);
expect(component).toMatchSnapshot(); // eslint-disable-line
expect(component).toMatchSnapshot();
});
});

View file

@ -8,7 +8,6 @@
import * as React from 'react';
import { createNotifications } from './create_notifications';
// eslint-disable-next-lien
import { notificationServiceMock } from '@kbn/core/public/mocks';
test('throws if no overlays service provided', () => {

View file

@ -26,6 +26,6 @@ const container = createStateContainer(
container.transitions.increment(5);
container.transitions.double();
console.log(container.selectors.count()); // eslint-disable-line
console.log(container.selectors.count()); // eslint-disable-line no-console
export const result = container.selectors.count();

View file

@ -76,6 +76,6 @@ container.transitions.add({
container.transitions.complete(0);
container.transitions.complete(1);
console.log(container.selectors.todos()); // eslint-disable-line
console.log(container.selectors.todos()); // eslint-disable-line no-console
export const result = container.selectors.todos();

View file

@ -344,7 +344,7 @@ export class DrilldownManagerState {
title: toastDrilldownsCRUDError,
});
}
})().catch(console.error); // eslint-disable-line
})().catch(console.error); // eslint-disable-line no-console
};
/**

View file

@ -141,7 +141,7 @@ export class DynamicActionManager {
for (const event of events) this.reviveAction(event);
this.ui.transitions.finishFetching(events);
})().catch((error) => {
/* eslint-disable */
/* eslint-disable no-console */
console.log('Dynamic action manager storage reload failed.');
console.error(error);
/* eslint-enable */

View file

@ -21,11 +21,11 @@ jest.mock('./services', () => {
destroy() {}
}
// eslint-disable-next-line
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { BaseVisType } = require('./vis_types/base_vis_type');
// eslint-disable-next-line
// eslint-disable-next-line @typescript-eslint/no-var-requires,@kbn/imports/uniform_imports
const { SearchSource } = require('../../data/common/search/search_source');
// eslint-disable-next-line
// eslint-disable-next-line @typescript-eslint/no-var-requires,@kbn/imports/uniform_imports
const stubIndexPattern = require('../../data/common/stubs');
const visType = new BaseVisType({
name: 'pie',

View file

@ -233,7 +233,7 @@ export const getTopNavConfig = (
return { id };
} catch (error) {
// eslint-disable-next-line
// eslint-disable-next-line no-console
console.error(error);
toastNotifications.addDanger({
title: i18n.translate(

View file

@ -1,4 +1,4 @@
/* eslint-disable */
/* eslint-disable @kbn/eslint/require-license-header,@typescript-eslint/unified-signatures */
/**
* Type interfaces extracted from node_modules/@types/cheerio/index.d.ts

View file

@ -17,5 +17,5 @@ export type AiopsPluginSetup = ReturnType<AiopsPlugin['setup']>;
*/
export type AiopsPluginStart = ReturnType<AiopsPlugin['start']>;
// eslint-disable-next-line
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
export type AppPluginStartDependencies = {};

View file

@ -6,7 +6,8 @@
*/
import { getTemplateStrings } from './template_strings';
import { loadTemplates } from '../../server/templates'; // eslint-disable-line
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { loadTemplates } from '../../server/templates';
import { TagStrings } from '../tags';

View file

@ -251,7 +251,7 @@ export function summarizeWorkpads(workpadDocs: CanvasWorkpad[]): WorkpadTelemetr
try {
pages = { count: workpad.pages.length };
} catch (err) {
// eslint-disable-next-line
// eslint-disable-next-line no-console
console.warn(err, workpad);
}
const elementCounts = workpad.pages.reduce<number[]>(

View file

@ -7,6 +7,6 @@
declare module '*.module.scss' {
const styles: { [className: string]: string };
// eslint-disable-next-line
// eslint-disable-next-line import/no-default-export
export default styles;
}

View file

@ -9,7 +9,7 @@ require('../../../../src/setup_node_env');
const path = require('path');
const webpack = require('webpack');
const { stringifyRequest } = require('loader-utils'); // eslint-disable-line
const { stringifyRequest } = require('loader-utils');
const { CiStatsPlugin } = require('./webpack/ci_stats_plugin');
const {

File diff suppressed because one or more lines are too long

View file

@ -30,10 +30,10 @@ export interface StartDependencies {
dashboard: DashboardStart;
}
// eslint-disable-next-line
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface SetupContract {}
// eslint-disable-next-line
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface StartContract {}
export class DashboardEnhancedPlugin

View file

@ -20,10 +20,10 @@ export interface StartDependencies {
uiActionsEnhanced: AdvancedUiActionsStart;
}
// eslint-disable-next-line
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface SetupContract {}
// eslint-disable-next-line
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface StartContract {}
export class DashboardEnhancedPlugin

View file

@ -108,7 +108,7 @@ export function EmbeddedMapComponent({
setupEmbeddable();
// we want this effect to execute exactly once after the component mounts
// eslint-disable-next-line
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
useEffect(() => {

View file

@ -104,7 +104,7 @@ export function isTimestampFormatValid(timestampFormat) {
'xpack.dataVisualizer.file.editFlyout.overrides.timestampLetterSValidationErrorMessage',
{
defaultMessage:
'Letter { length, plural, one { {lg} } other { group {lg} } } in {format} is not supported because it is not preceded by ss and a separator from {sep}', // eslint-disable-line
'Letter { length, plural, one { {lg} } other { group {lg} } } in {format} is not supported because it is not preceded by ss and a separator from {sep}',
values: {
length,
lg: letterGroup,

View file

@ -25,10 +25,10 @@ export interface StartDependencies {
uiActionsEnhanced: AdvancedUiActionsStart;
}
// eslint-disable-next-line
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface SetupContract {}
// eslint-disable-next-line
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface StartContract {}
export class UrlDrilldownPlugin

View file

@ -41,10 +41,10 @@ export interface StartDependencies {
uiActionsEnhanced: AdvancedUiActionsStart;
}
// eslint-disable-next-line
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface SetupContract {}
// eslint-disable-next-line
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface StartContract {}
export class EmbeddableEnhancedPlugin
@ -126,7 +126,7 @@ export class EmbeddableEnhancedPlugin
});
dynamicActions.start().catch((error) => {
/* eslint-disable */
/* eslint-disable no-console */
console.log('Failed to start embeddable dynamic actions', embeddable);
console.error(error);
@ -135,7 +135,7 @@ export class EmbeddableEnhancedPlugin
const stop = () => {
dynamicActions.stop().catch((error) => {
/* eslint-disable */
/* eslint-disable no-console */
console.log('Failed to stop embeddable dynamic actions', embeddable);
console.error(error);

View file

@ -56,7 +56,7 @@ export const IndexCreatedCallout: React.FC<IndexCreatedCalloutProps> = ({ indexN
color="success"
onClick={() => {
// TODO bind it to AppSearch
// eslint-disable-next-line
// eslint-disable-next-line no-console
console.log(indexName);
}}
>

View file

@ -4,7 +4,8 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
// eslint-disable-next-line
// eslint-disable-next-line import/no-extraneous-dependencies
import { createEsClientForTesting } from '@kbn/test';
const plugin: Cypress.PluginConfig = (on, config) => {

View file

@ -43,8 +43,7 @@ export const startBasicLicense =
const first = i18n.translate(
'xpack.licenseMgmt.replacingCurrentLicenseWithBasicLicenseWarningMessage',
{
//eslint-disable-next-line
defaultMessage:
defaultMessage:
'Some functionality will be lost if you replace your {currentLicenseType} license with a BASIC license. Review the list of features below.',
values: {
currentLicenseType: currentLicenseType.toUpperCase(),

View file

@ -7,7 +7,6 @@
import { join } from 'path';
// eslint-disable-next-line
require('@kbn/storybook').runStorybookCli({
name: 'lists',
storyGlobs: [join(__dirname, '..', 'public', '**', '*.stories.tsx')],

View file

@ -71,17 +71,17 @@ export function CustomSelectionTable({
lastItemIndex: 1,
});
const [query, setQuery] = useState(EuiSearchBar.Query.MATCH_ALL);
const [error, setError] = useState(null); // eslint-disable-line
const [error, setError] = useState(null);
useEffect(() => {
setCurrentItems(items);
handleQueryChange({ query: query });
}, [items]); // eslint-disable-line
}, [items]);
// When changes to selected ids made via badge removal - update selection in the table accordingly
useEffect(() => {
setItemIdToSelectedMap(getCurrentlySelectedItemIdsMap());
}, [selectedIds]); // eslint-disable-line
}, [selectedIds]);
useEffect(() => {
const tablePager = new Pager(currentItems.length, itemsPerPage, currentPage);

View file

@ -171,7 +171,7 @@ export const JobSelectorFlyoutContent: FC<JobSelectorFlyoutProps> = ({
onJobsFetched({ groupsMap, jobsMap: resp.jobsMap });
}
} catch (e) {
console.error('Error fetching jobs with time range', e); // eslint-disable-line
console.error('Error fetching jobs with time range', e); // eslint-disable-line no-console
const { toasts } = notifications;
toasts.addDanger({
title: i18n.translate('xpack.ml.jobSelector.jobFetchErrorMessage', {

View file

@ -51,7 +51,7 @@ export const Page: FC<{
setJobsExist(count > 0);
} catch (e) {
// Swallow the error and just show the empty table in the analytics id selector
console.error('Error checking analytics jobs exist', e); // eslint-disable-line
console.error('Error checking analytics jobs exist', e); // eslint-disable-line no-console
}
};

View file

@ -112,7 +112,7 @@ export const EditActionFlyout: FC<Required<EditAction>> = ({ closeFlyout, item }
refresh();
closeFlyout();
} catch (e) {
// eslint-disable-next-line
// eslint-disable-next-line no-console
console.error(e);
toastNotificationService.displayErrorToast(

View file

@ -140,7 +140,7 @@ export function AnalyticsIdSelector({
await getDataFrameAnalytics();
setAnalyticsJobs(dataFrameAnalytics);
} catch (e) {
console.error('Error fetching analytics', e); // eslint-disable-line
console.error('Error fetching analytics', e); // eslint-disable-line no-console
displayErrorToast(
e,
i18n.translate('xpack.ml.analyticsSelector.analyticsFetchErrorMessage', {
@ -157,7 +157,7 @@ export function AnalyticsIdSelector({
const response = await trainedModelsApiService.getTrainedModels();
setTrainedModels(response);
} catch (e) {
console.error('Error fetching trained models', e); // eslint-disable-line
console.error('Error fetching trained models', e); // eslint-disable-line no-console
displayErrorToast(
e,
i18n.translate('xpack.ml.analyticsSelector.trainedModelsFetchErrorMessage', {

View file

@ -63,7 +63,7 @@ export const Page: FC = () => {
setJobsExist(count > 0);
} catch (e) {
// Swallow the error and just show the empty table in the analytics id selector
console.error('Error checking analytics jobs exist', e); // eslint-disable-line
console.error('Error checking analytics jobs exist', e); // eslint-disable-line no-console
}
};

View file

@ -37,7 +37,7 @@ export function setLicenseCache(
export async function checkFullLicense() {
if (mlLicense === null) {
// this should never happen
console.error('ML Licensing not initialized'); // eslint-disable-line
console.error('ML Licensing not initialized'); // eslint-disable-line no-console
return Promise.reject();
}
@ -54,7 +54,7 @@ export async function checkFullLicense() {
export async function checkBasicLicense() {
if (mlLicense === null) {
// this should never happen
console.error('ML Licensing not initialized'); // eslint-disable-line
console.error('ML Licensing not initialized'); // eslint-disable-line no-console
return Promise.reject();
}

View file

@ -7,7 +7,6 @@
import { join } from 'path';
// eslint-disable-next-line
require('@kbn/storybook').runStorybookCli({
name: 'observability',
storyGlobs: [

View file

@ -5,7 +5,7 @@
* 2.0.
*/
/* eslint-disable */
/* eslint-disable prettier/prettier,no-console,@typescript-eslint/ban-ts-comment,@typescript-eslint/no-var-requires,import/no-extraneous-dependencies,padding-line-between-statements */
// / <reference types="cypress" />
// @ts-check

View file

@ -24,7 +24,7 @@ const testBedConfig = {
export const setup = async (httpSetup, overrides) => {
const initTestBed = registerTestBed(
// ESlint cannot figure out that the hoc should start with a capital leter.
// eslint-disable-next-line
// eslint-disable-next-line new-cap
WithAppDependencies(RemoteClusterList, httpSetup, overrides),
testBedConfig
);

View file

@ -1,4 +1,10 @@
/*eslint-disable */
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
export const inputIndices = JSON.parse(
'{"test":{"shards":[{"id":["F-R7QxH4S42fMnPfmFUKMQ","test","0"],"searches":[{"query":null,"rewrite_time":2656,"collector":[{"name":"MultiCollector","reason":"search_multi","time":"0.1815780000ms","children":[{"name":"SimpleTopScoreDocCollector","reason":"search_top_hits","time":"0.02393700000ms"},{"name":"ProfilingAggregator: [org.elasticsearch.search.profile.aggregation.ProfilingAggregator@43c8a536]","reason":"aggregation","time":"0.1140000000ms"}]}],"flat":[{"id":"af697413-f76b-458e-b265-f4930dbdee2a","childrenIds":[],"lucene":"name:george","time":0.219343,"selfTime":0.219343,"timePercentage":"100.00","query_type":"TermQuery","absoluteColor":"#ffafaf","depth":0,"breakdown":[{"key":"create_weight","time":160673,"relative":"73.3","color":"#fcc2c2","tip":"The time taken to create the Weight object, which holds temporary information during scoring."},{"key":"build_scorer","time":50157,"relative":"22.9","color":"#f7e5e5","tip":"The time taken to create the Scoring object, which is later used to execute the actual scoring of each doc."},{"key":"score","time":5783,"relative":"2.6","color":"#f5f3f3","tip":"The time taken in actually scoring the document against the query."},{"key":"next_doc","time":2718,"relative":"1.2","color":"#f5f4f4","tip":"The time taken to advance the iterator to the next matching document."},{"key":"build_scorer_count","time":5,"relative":0,"color":"#f5f5f5","tip":""},{"key":"next_doc_count","time":4,"relative":0,"color":"#f5f5f5","tip":""},{"key":"score_count","time":2,"relative":0,"color":"#f5f5f5","tip":""},{"key":"create_weight_count","time":1,"relative":0,"color":"#f5f5f5","tip":""},{"key":"match","time":0,"relative":"0.0","color":"#f5f5f5","tip":"The time taken to execute a secondary, more precise scoring phase (used by phrase queries)."},{"key":"match_count","time":0,"relative":0,"color":"#f5f5f5","tip":""},{"key":"advance","time":0,"relative":"0.0","color":"#f5f5f5","tip":"The time taken to advance the iterator to the next document."},{"key":"advance_count","time":0,"relative":0,"color":"#f5f5f5","tip":""}]}]}],"aggregations":[{"type":"org.elasticsearch.search.aggregations.metrics.stats.StatsAggregator","description":"stats","time":"0.03053500000ms","breakdown":{"reduce":0,"build_aggregation":9447,"build_aggregation_count":1,"initialize":5589,"initialize_count":1,"reduce_count":0,"collect":15495,"collect_count":2}}],"time":0.219343,"color":0,"relative":0,"rewrite_time":2656}],"time":0.219343,"name":"test"}}'
);

View file

@ -8,7 +8,8 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { mount } from 'enzyme';
type WrapperOf<F extends (...args: any) => any> = (...args: Parameters<F>) => ReturnType<F>; // eslint-disable-line
// eslint-disable-next-line @typescript-eslint/no-explicit-any
type WrapperOf<F extends (...args: any) => any> = (...args: Parameters<F>) => ReturnType<F>;
export type MountAppended = WrapperOf<typeof mount>;
export const useMountAppended = () => {

View file

@ -7,7 +7,6 @@
import { join } from 'path';
// eslint-disable-next-line
require('@kbn/storybook').runStorybookCli({
name: 'siem',
storyGlobs: [join(__dirname, '..', 'public', '**', '*.stories.tsx')],

View file

@ -8,7 +8,8 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { mount } from 'enzyme';
type WrapperOf<F extends (...args: any) => any> = (...args: Parameters<F>) => ReturnType<F>; // eslint-disable-line
// eslint-disable-next-line @typescript-eslint/no-explicit-any
type WrapperOf<F extends (...args: any) => any> = (...args: Parameters<F>) => ReturnType<F>;
export type MountAppended = WrapperOf<typeof mount>;
export const useMountAppended = () => {

View file

@ -98,7 +98,7 @@ export default ({ getService }: FtrProviderContext) => {
ml.api.assertResponseStatusCode(200, status, body);
expect(body).to.have.property('field_selection');
// eslint-disable-next-line
// eslint-disable-next-line @typescript-eslint/naming-convention
const { memory_estimation, field_selection } = body;
const fieldObject = field_selection[0];
expect(memory_estimation).to.have.property('expected_memory_with_disk');

Some files were not shown because too many files have changed in this diff Show more