2019-10-22 15:41:28 +02:00
|
|
|
/*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2018-04-20 21:13:37 +02:00
|
|
|
const { readdirSync } = require('fs');
|
2019-04-05 20:14:26 +02:00
|
|
|
const { resolve } = require('path');
|
2018-09-07 18:43:17 +02:00
|
|
|
|
2018-11-28 01:49:17 +01:00
|
|
|
const APACHE_2_0_LICENSE_HEADER = `
|
|
|
|
/*
|
|
|
|
* 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 ELASTIC_LICENSE_HEADER = `
|
|
|
|
/*
|
|
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
|
|
* or more contributor license agreements. Licensed under the Elastic License;
|
|
|
|
* you may not use this file except in compliance with the Elastic License.
|
|
|
|
*/
|
|
|
|
`;
|
|
|
|
|
2020-03-12 07:14:17 +01:00
|
|
|
const allMochaRulesOff = {};
|
2020-03-11 10:02:10 +01:00
|
|
|
Object.keys(require('eslint-plugin-mocha').rules).forEach(k => {
|
2020-03-12 07:14:17 +01:00
|
|
|
allMochaRulesOff['mocha/' + k] = 'off';
|
2020-03-11 10:02:10 +01:00
|
|
|
});
|
|
|
|
|
2018-02-05 18:18:43 +01:00
|
|
|
module.exports = {
|
2019-09-04 01:01:43 +02:00
|
|
|
root: true,
|
|
|
|
|
2019-08-16 23:23:57 +02:00
|
|
|
extends: ['@elastic/eslint-config-kibana', 'plugin:@elastic/eui/recommended'],
|
2018-09-07 18:43:17 +02:00
|
|
|
|
2018-02-05 18:18:43 +01:00
|
|
|
overrides: [
|
2019-10-29 15:45:29 +01:00
|
|
|
/**
|
|
|
|
* Temporarily disable some react rules for specific plugins, remove in separate PRs
|
|
|
|
*/
|
|
|
|
{
|
|
|
|
files: ['packages/kbn-ui-framework/**/*.{js,ts,tsx}'],
|
|
|
|
rules: {
|
|
|
|
'jsx-a11y/no-onchange': 'off',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
files: ['src/plugins/es_ui_shared/**/*.{js,ts,tsx}'],
|
|
|
|
rules: {
|
|
|
|
'react-hooks/exhaustive-deps': 'off',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
files: ['src/plugins/eui_utils/**/*.{js,ts,tsx}'],
|
|
|
|
rules: {
|
|
|
|
'react-hooks/exhaustive-deps': 'off',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
files: ['src/plugins/kibana_react/**/*.{js,ts,tsx}'],
|
|
|
|
rules: {
|
|
|
|
'react-hooks/rules-of-hooks': 'off',
|
|
|
|
'react-hooks/exhaustive-deps': 'off',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
files: ['src/plugins/kibana_utils/**/*.{js,ts,tsx}'],
|
|
|
|
rules: {
|
|
|
|
'react-hooks/exhaustive-deps': 'off',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
files: ['x-pack/legacy/plugins/canvas/**/*.{js,ts,tsx}'],
|
|
|
|
rules: {
|
|
|
|
'react-hooks/exhaustive-deps': 'off',
|
|
|
|
'jsx-a11y/click-events-have-key-events': 'off',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2020-04-22 18:35:00 +02:00
|
|
|
files: ['x-pack/plugins/cross_cluster_replication/**/*.{js,ts,tsx}'],
|
2019-10-29 15:45:29 +01:00
|
|
|
rules: {
|
|
|
|
'jsx-a11y/click-events-have-key-events': 'off',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
files: ['x-pack/legacy/plugins/index_management/**/*.{js,ts,tsx}'],
|
|
|
|
rules: {
|
|
|
|
'react-hooks/exhaustive-deps': 'off',
|
|
|
|
'react-hooks/rules-of-hooks': 'off',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2020-04-15 14:41:16 +02:00
|
|
|
files: ['x-pack/plugins/lens/**/*.{js,ts,tsx}'],
|
2019-10-29 15:45:29 +01:00
|
|
|
rules: {
|
|
|
|
'react-hooks/exhaustive-deps': 'off',
|
|
|
|
'react-hooks/rules-of-hooks': 'off',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2020-03-14 12:16:17 +01:00
|
|
|
files: ['x-pack/plugins/ml/**/*.{js,ts,tsx}'],
|
2019-10-29 15:45:29 +01:00
|
|
|
rules: {
|
|
|
|
'react-hooks/exhaustive-deps': 'off',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
files: ['x-pack/legacy/plugins/snapshot_restore/**/*.{js,ts,tsx}'],
|
|
|
|
rules: {
|
|
|
|
'react-hooks/exhaustive-deps': 'off',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2019-04-05 20:14:26 +02:00
|
|
|
/**
|
|
|
|
* Files that require Apache 2.0 headers, settings
|
|
|
|
* are overridden below for files that require Elastic
|
|
|
|
* Licence headers
|
|
|
|
*/
|
|
|
|
{
|
|
|
|
files: ['**/*.{js,ts,tsx}'],
|
|
|
|
rules: {
|
|
|
|
'@kbn/eslint/require-license-header': [
|
|
|
|
'error',
|
|
|
|
{
|
|
|
|
license: APACHE_2_0_LICENSE_HEADER,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
'@kbn/eslint/disallow-license-headers': [
|
|
|
|
'error',
|
|
|
|
{
|
|
|
|
licenses: [ELASTIC_LICENSE_HEADER],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Files that require Elastic license headers instead of Apache 2.0 header
|
|
|
|
*/
|
|
|
|
{
|
|
|
|
files: ['x-pack/**/*.{js,ts,tsx}'],
|
|
|
|
rules: {
|
|
|
|
'@kbn/eslint/require-license-header': [
|
|
|
|
'error',
|
|
|
|
{
|
|
|
|
license: ELASTIC_LICENSE_HEADER,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
'@kbn/eslint/disallow-license-headers': [
|
|
|
|
'error',
|
|
|
|
{
|
|
|
|
licenses: [APACHE_2_0_LICENSE_HEADER],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Restricted paths
|
|
|
|
*/
|
|
|
|
{
|
|
|
|
files: ['**/*.{js,ts,tsx}'],
|
|
|
|
rules: {
|
|
|
|
'@kbn/eslint/no-restricted-paths': [
|
|
|
|
'error',
|
|
|
|
{
|
|
|
|
basePath: __dirname,
|
|
|
|
zones: [
|
|
|
|
{
|
|
|
|
target: [
|
2020-04-24 19:51:58 +02:00
|
|
|
'(src|x-pack)/legacy/**/*',
|
2019-12-16 23:46:07 +01:00
|
|
|
'(src|x-pack)/plugins/**/(public|server)/**/*',
|
2020-01-09 12:37:08 +01:00
|
|
|
'examples/**/*',
|
2019-04-05 20:14:26 +02:00
|
|
|
],
|
|
|
|
from: [
|
|
|
|
'src/core/public/**/*',
|
2020-04-24 19:51:58 +02:00
|
|
|
'!src/core/public/index.ts', // relative import
|
|
|
|
'!src/core/public/mocks{,.ts}',
|
|
|
|
'!src/core/server/types{,.ts}',
|
2019-04-05 20:14:26 +02:00
|
|
|
'!src/core/public/utils/**/*',
|
2020-04-24 19:51:58 +02:00
|
|
|
'!src/core/public/*.test.mocks{,.ts}',
|
2019-04-05 20:14:26 +02:00
|
|
|
|
|
|
|
'src/core/server/**/*',
|
2020-04-24 19:51:58 +02:00
|
|
|
'!src/core/server/index.ts', // relative import
|
|
|
|
'!src/core/server/mocks{,.ts}',
|
|
|
|
'!src/core/server/types{,.ts}',
|
|
|
|
'!src/core/server/test_utils',
|
2019-10-16 15:48:34 +02:00
|
|
|
// for absolute imports until fixed in
|
|
|
|
// https://github.com/elastic/kibana/issues/36096
|
2020-04-24 19:51:58 +02:00
|
|
|
'!src/core/server/*.test.mocks{,.ts}',
|
|
|
|
],
|
|
|
|
allowSameFolder: true,
|
|
|
|
errorMessage:
|
|
|
|
'Plugins may only import from top-level public and server modules in core.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
target: [
|
|
|
|
'(src|x-pack)/legacy/**/*',
|
|
|
|
'(src|x-pack)/plugins/**/(public|server)/**/*',
|
|
|
|
'examples/**/*',
|
|
|
|
'!(src|x-pack)/**/*.test.*',
|
|
|
|
'!(x-pack/)?test/**/*',
|
2020-04-28 16:42:13 +02:00
|
|
|
// next folder contains legacy browser tests which can't be migrated to jest
|
|
|
|
// which import np files
|
|
|
|
'!src/legacy/core_plugins/kibana/public/__tests__/**/*',
|
2020-04-24 19:51:58 +02:00
|
|
|
],
|
|
|
|
from: [
|
2019-12-16 23:46:07 +01:00
|
|
|
'(src|x-pack)/plugins/**/(public|server)/**/*',
|
|
|
|
'!(src|x-pack)/plugins/**/(public|server)/(index|mocks).{js,ts,tsx}',
|
2019-04-05 20:14:26 +02:00
|
|
|
],
|
|
|
|
allowSameFolder: true,
|
2019-12-16 23:46:07 +01:00
|
|
|
errorMessage: 'Plugins may only import from top-level public and server modules.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
target: [
|
|
|
|
'(src|x-pack)/plugins/**/*',
|
2020-01-28 00:01:47 +01:00
|
|
|
'!(src|x-pack)/plugins/**/server/**/*',
|
2019-12-16 23:46:07 +01:00
|
|
|
|
|
|
|
'src/legacy/core_plugins/**/*',
|
2020-01-28 00:01:47 +01:00
|
|
|
'!src/legacy/core_plugins/**/server/**/*',
|
|
|
|
'!src/legacy/core_plugins/**/index.{js,ts,tsx}',
|
2019-12-16 23:46:07 +01:00
|
|
|
|
|
|
|
'x-pack/legacy/plugins/**/*',
|
2020-01-28 00:01:47 +01:00
|
|
|
'!x-pack/legacy/plugins/**/server/**/*',
|
|
|
|
'!x-pack/legacy/plugins/**/index.{js,ts,tsx}',
|
2020-01-09 12:37:08 +01:00
|
|
|
|
|
|
|
'examples/**/*',
|
|
|
|
'!examples/**/server/**/*',
|
2019-12-16 23:46:07 +01:00
|
|
|
],
|
|
|
|
from: [
|
|
|
|
'src/core/server',
|
|
|
|
'src/core/server/**/*',
|
|
|
|
'(src|x-pack)/plugins/*/server/**/*',
|
2020-01-09 12:37:08 +01:00
|
|
|
'examples/**/server/**/*',
|
2019-12-16 23:46:07 +01:00
|
|
|
],
|
|
|
|
errorMessage:
|
|
|
|
'Server modules cannot be imported into client modules or shared modules.',
|
2019-04-05 20:14:26 +02:00
|
|
|
},
|
2019-11-29 07:42:52 +01:00
|
|
|
{
|
2019-12-16 11:48:43 +01:00
|
|
|
target: ['src/**/*'],
|
2019-11-29 07:42:52 +01:00
|
|
|
from: ['x-pack/**/*'],
|
|
|
|
errorMessage: 'OSS cannot import x-pack files.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
target: ['src/core/**/*'],
|
|
|
|
from: [
|
|
|
|
'plugins/**/*',
|
|
|
|
'src/plugins/**/*',
|
|
|
|
'src/legacy/core_plugins/**/*',
|
|
|
|
'src/legacy/ui/**/*',
|
|
|
|
],
|
|
|
|
errorMessage: 'The core cannot depend on any plugins.',
|
|
|
|
},
|
2019-12-16 23:46:07 +01:00
|
|
|
{
|
|
|
|
target: ['(src|x-pack)/plugins/*/public/**/*'],
|
|
|
|
from: ['ui/**/*', 'uiExports/**/*'],
|
|
|
|
errorMessage: 'Plugins cannot import legacy UI code.',
|
|
|
|
},
|
2019-07-18 23:55:21 +02:00
|
|
|
{
|
|
|
|
from: ['src/legacy/ui/**/*', 'ui/**/*'],
|
|
|
|
target: [
|
2019-08-30 20:57:10 +02:00
|
|
|
'test/plugin_functional/plugins/**/public/np_ready/**/*',
|
|
|
|
'test/plugin_functional/plugins/**/server/np_ready/**/*',
|
2019-07-18 23:55:21 +02:00
|
|
|
'src/legacy/core_plugins/**/public/np_ready/**/*',
|
2020-02-10 17:28:05 +01:00
|
|
|
'src/legacy/core_plugins/vis_type_*/public/**/*',
|
|
|
|
'!src/legacy/core_plugins/vis_type_*/public/legacy*',
|
2019-07-18 23:55:21 +02:00
|
|
|
'src/legacy/core_plugins/**/server/np_ready/**/*',
|
|
|
|
'x-pack/legacy/plugins/**/public/np_ready/**/*',
|
|
|
|
'x-pack/legacy/plugins/**/server/np_ready/**/*',
|
|
|
|
],
|
|
|
|
allowSameFolder: true,
|
|
|
|
errorMessage:
|
|
|
|
'NP-ready code should not import from /src/legacy/ui/** folder. ' +
|
|
|
|
'Instead of importing from /src/legacy/ui/** deeply within a np_ready folder, ' +
|
|
|
|
'import those things once at the top level of your plugin and pass those down, just ' +
|
|
|
|
'like you pass down `core` and `plugins` objects.',
|
|
|
|
},
|
2019-04-05 20:14:26 +02:00
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2018-04-20 21:13:37 +02:00
|
|
|
/**
|
|
|
|
* Allow default exports
|
|
|
|
*/
|
2018-02-06 00:29:30 +01:00
|
|
|
{
|
2019-06-14 20:16:48 +02:00
|
|
|
files: [
|
|
|
|
'x-pack/test/functional/apps/**/*.js',
|
2019-06-19 00:13:00 +02:00
|
|
|
'x-pack/legacy/plugins/apm/**/*.js',
|
2019-06-14 20:16:48 +02:00
|
|
|
'test/*/config.ts',
|
2020-03-16 17:16:32 +01:00
|
|
|
'test/*/config_open.ts',
|
2019-11-20 21:34:47 +01:00
|
|
|
'test/*/{tests,test_suites,apis,apps}/**/*',
|
2019-06-14 20:16:48 +02:00
|
|
|
'test/visual_regression/tests/**/*',
|
2019-08-05 17:45:34 +02:00
|
|
|
'x-pack/test/*/{tests,test_suites,apis,apps}/**/*',
|
|
|
|
'x-pack/test/*/*config.*ts',
|
|
|
|
'x-pack/test/saved_object_api_integration/*/apis/**/*',
|
|
|
|
'x-pack/test/ui_capabilities/*/tests/**/*',
|
2019-06-14 20:16:48 +02:00
|
|
|
],
|
2018-02-06 00:29:30 +01:00
|
|
|
rules: {
|
2019-04-02 09:38:07 +02:00
|
|
|
'import/no-default-export': 'off',
|
2018-04-20 21:13:37 +02:00
|
|
|
'import/no-named-as-default': 'off',
|
2018-02-06 00:29:30 +01:00
|
|
|
},
|
|
|
|
},
|
2018-03-13 18:43:39 +01:00
|
|
|
|
2018-04-20 21:13:37 +02:00
|
|
|
/**
|
|
|
|
* Files that are allowed to import webpack-specific stuff
|
|
|
|
*/
|
2018-03-13 18:43:39 +01:00
|
|
|
{
|
2018-04-20 21:13:37 +02:00
|
|
|
files: [
|
2019-04-05 20:14:26 +02:00
|
|
|
'**/public/**/*.js',
|
|
|
|
'**/webpackShims/**/*.js',
|
|
|
|
'packages/kbn-ui-framework/doc_site/src/**/*.js',
|
|
|
|
'src/fixtures/**/*.js', // TODO: this directory needs to be more obviously "public" (or go away)
|
2018-03-13 18:43:39 +01:00
|
|
|
],
|
2018-04-20 21:13:37 +02:00
|
|
|
settings: {
|
2020-01-11 04:20:18 +01:00
|
|
|
// instructs import/no-extraneous-dependencies to treat certain modules
|
|
|
|
// as core modules, even if they aren't listed in package.json
|
2020-02-13 10:18:46 +01:00
|
|
|
'import/core-modules': ['plugins', 'legacy/ui', 'uiExports'],
|
2018-04-20 21:13:37 +02:00
|
|
|
|
|
|
|
'import/resolver': {
|
|
|
|
'@kbn/eslint-import-resolver-kibana': {
|
2018-05-16 19:45:41 +02:00
|
|
|
forceNode: false,
|
2018-04-20 21:13:37 +02:00
|
|
|
rootPackageName: 'kibana',
|
|
|
|
kibanaPath: '.',
|
2019-06-19 00:13:00 +02:00
|
|
|
pluginMap: readdirSync(resolve(__dirname, 'x-pack/legacy/plugins')).reduce(
|
|
|
|
(acc, name) => {
|
|
|
|
if (!name.startsWith('_')) {
|
|
|
|
acc[name] = `x-pack/legacy/plugins/${name}`;
|
|
|
|
}
|
|
|
|
return acc;
|
|
|
|
},
|
|
|
|
{}
|
|
|
|
),
|
2018-04-20 21:13:37 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
2018-05-25 19:43:01 +02:00
|
|
|
* Files that ARE NOT allowed to use devDependencies
|
2018-04-20 21:13:37 +02:00
|
|
|
*/
|
|
|
|
{
|
2019-04-05 20:14:26 +02:00
|
|
|
files: [
|
|
|
|
'packages/kbn-ui-framework/**/*.js',
|
|
|
|
'x-pack/**/*.js',
|
|
|
|
'packages/kbn-interpreter/**/*.js',
|
|
|
|
],
|
2018-03-13 18:43:39 +01:00
|
|
|
rules: {
|
|
|
|
'import/no-extraneous-dependencies': [
|
|
|
|
'error',
|
|
|
|
{
|
|
|
|
devDependencies: false,
|
|
|
|
peerDependencies: true,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2018-04-20 21:13:37 +02:00
|
|
|
/**
|
2018-05-25 19:43:01 +02:00
|
|
|
* Files that ARE allowed to use devDependencies
|
2018-04-20 21:13:37 +02:00
|
|
|
*/
|
2018-03-13 18:43:39 +01:00
|
|
|
{
|
|
|
|
files: [
|
|
|
|
'packages/kbn-ui-framework/**/*.test.js',
|
2019-04-05 20:14:26 +02:00
|
|
|
'packages/kbn-ui-framework/doc_site/**/*.js',
|
|
|
|
'packages/kbn-ui-framework/generator-kui/**/*.js',
|
2018-03-13 18:43:39 +01:00
|
|
|
'packages/kbn-ui-framework/Gruntfile.js',
|
2019-04-05 20:14:26 +02:00
|
|
|
'packages/kbn-es/src/**/*.js',
|
|
|
|
'packages/kbn-interpreter/tasks/**/*.js',
|
|
|
|
'packages/kbn-interpreter/src/plugin/**/*.js',
|
|
|
|
'x-pack/{dev-tools,tasks,scripts,test,build_chromium}/**/*.js',
|
|
|
|
'x-pack/**/{__tests__,__test__,__jest__,__fixtures__,__mocks__}/**/*.js',
|
2018-04-20 21:13:37 +02:00
|
|
|
'x-pack/**/*.test.js',
|
2019-03-19 16:16:49 +01:00
|
|
|
'x-pack/test_utils/**/*',
|
2018-04-20 21:13:37 +02:00
|
|
|
'x-pack/gulpfile.js',
|
2019-06-19 00:13:00 +02:00
|
|
|
'x-pack/legacy/plugins/apm/public/utils/testHelpers.js',
|
2018-03-13 18:43:39 +01:00
|
|
|
],
|
|
|
|
rules: {
|
|
|
|
'import/no-extraneous-dependencies': [
|
|
|
|
'error',
|
|
|
|
{
|
|
|
|
devDependencies: true,
|
|
|
|
peerDependencies: true,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2018-04-20 21:13:37 +02:00
|
|
|
|
|
|
|
/**
|
2018-05-25 19:43:01 +02:00
|
|
|
* Files that run BEFORE node version check
|
|
|
|
*/
|
|
|
|
{
|
2019-04-05 20:14:26 +02:00
|
|
|
files: ['scripts/**/*.js', 'src/setup_node_env/**/*.js'],
|
2018-05-25 19:43:01 +02:00
|
|
|
rules: {
|
|
|
|
'import/no-commonjs': 'off',
|
|
|
|
'prefer-object-spread/prefer-object-spread': 'off',
|
|
|
|
'no-var': 'off',
|
|
|
|
'prefer-const': 'off',
|
|
|
|
'prefer-destructuring': 'off',
|
|
|
|
'no-restricted-syntax': [
|
|
|
|
'error',
|
|
|
|
'ImportDeclaration',
|
|
|
|
'ExportNamedDeclaration',
|
|
|
|
'ExportDefaultDeclaration',
|
|
|
|
'ExportAllDeclaration',
|
|
|
|
'ArrowFunctionExpression',
|
|
|
|
'AwaitExpression',
|
|
|
|
'ClassDeclaration',
|
|
|
|
'RestElement',
|
|
|
|
'SpreadElement',
|
|
|
|
'YieldExpression',
|
|
|
|
'VariableDeclaration[kind="const"]',
|
|
|
|
'VariableDeclaration[kind="let"]',
|
|
|
|
'VariableDeclarator[id.type="ArrayPattern"]',
|
|
|
|
'VariableDeclarator[id.type="ObjectPattern"]',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2019-01-16 21:37:40 +01:00
|
|
|
/**
|
|
|
|
* Files that run in the browser with only node-level transpilation
|
|
|
|
*/
|
|
|
|
{
|
|
|
|
files: [
|
2019-03-06 16:37:19 +01:00
|
|
|
'test/functional/services/lib/web_element_wrapper/scroll_into_view_if_necessary.js',
|
2019-04-05 20:14:26 +02:00
|
|
|
'**/browser_exec_scripts/**/*.js',
|
2019-01-16 21:37:40 +01:00
|
|
|
],
|
|
|
|
rules: {
|
|
|
|
'prefer-object-spread/prefer-object-spread': 'off',
|
|
|
|
'no-var': 'off',
|
|
|
|
'prefer-const': 'off',
|
|
|
|
'prefer-destructuring': 'off',
|
|
|
|
'no-restricted-syntax': [
|
|
|
|
'error',
|
|
|
|
'ArrowFunctionExpression',
|
|
|
|
'AwaitExpression',
|
|
|
|
'ClassDeclaration',
|
2019-02-18 08:11:36 +01:00
|
|
|
'ImportDeclaration',
|
2019-01-16 21:37:40 +01:00
|
|
|
'RestElement',
|
|
|
|
'SpreadElement',
|
|
|
|
'YieldExpression',
|
|
|
|
'VariableDeclaration[kind="const"]',
|
|
|
|
'VariableDeclaration[kind="let"]',
|
|
|
|
'VariableDeclarator[id.type="ArrayPattern"]',
|
|
|
|
'VariableDeclarator[id.type="ObjectPattern"]',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2018-05-25 19:43:01 +02:00
|
|
|
/**
|
|
|
|
* Files that run AFTER node version check
|
|
|
|
* and are not also transpiled with babel
|
2018-04-20 21:13:37 +02:00
|
|
|
*/
|
|
|
|
{
|
|
|
|
files: [
|
|
|
|
'.eslintrc.js',
|
2019-04-05 20:14:26 +02:00
|
|
|
'**/webpackShims/**/*.js',
|
|
|
|
'packages/kbn-plugin-generator/**/*.js',
|
|
|
|
'packages/kbn-plugin-helpers/**/*.js',
|
|
|
|
'packages/kbn-eslint-import-resolver-kibana/**/*.js',
|
2019-03-23 02:53:45 +01:00
|
|
|
'packages/kbn-eslint-plugin-eslint/**/*',
|
2018-04-20 21:13:37 +02:00
|
|
|
'x-pack/gulpfile.js',
|
|
|
|
'x-pack/dev-tools/mocha/setup_mocha.js',
|
2019-04-05 20:14:26 +02:00
|
|
|
'x-pack/scripts/*.js',
|
2018-04-20 21:13:37 +02:00
|
|
|
],
|
2020-03-27 22:36:53 +01:00
|
|
|
excludedFiles: ['**/integration_tests/**/*'],
|
2018-04-20 21:13:37 +02:00
|
|
|
rules: {
|
|
|
|
'import/no-commonjs': 'off',
|
|
|
|
'prefer-object-spread/prefer-object-spread': 'off',
|
|
|
|
'no-restricted-syntax': [
|
|
|
|
'error',
|
|
|
|
'ImportDeclaration',
|
|
|
|
'ExportNamedDeclaration',
|
|
|
|
'ExportDefaultDeclaration',
|
|
|
|
'ExportAllDeclaration',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2019-07-19 00:25:50 +02:00
|
|
|
/**
|
|
|
|
* Jest specific rules
|
|
|
|
*/
|
|
|
|
{
|
|
|
|
files: ['**/*.test.{js,ts,tsx}'],
|
|
|
|
rules: {
|
|
|
|
'jest/valid-describe': 'error',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2020-03-10 22:05:30 +01:00
|
|
|
/**
|
|
|
|
* Harden specific rules
|
|
|
|
*/
|
|
|
|
{
|
|
|
|
files: ['test/harden/*.js'],
|
2020-03-12 07:14:17 +01:00
|
|
|
rules: allMochaRulesOff,
|
2020-03-10 22:05:30 +01:00
|
|
|
},
|
|
|
|
|
2018-04-20 21:13:37 +02:00
|
|
|
/**
|
|
|
|
* APM overrides
|
|
|
|
*/
|
|
|
|
{
|
2019-06-19 00:13:00 +02:00
|
|
|
files: ['x-pack/legacy/plugins/apm/**/*.js'],
|
2018-04-20 21:13:37 +02:00
|
|
|
rules: {
|
|
|
|
'no-unused-vars': ['error', { ignoreRestSiblings: true }],
|
|
|
|
'no-console': ['warn', { allow: ['error'] }],
|
|
|
|
},
|
|
|
|
},
|
2019-07-31 13:21:59 +02:00
|
|
|
{
|
|
|
|
plugins: ['react-hooks'],
|
|
|
|
files: ['x-pack/legacy/plugins/apm/**/*.{ts,tsx}'],
|
|
|
|
rules: {
|
|
|
|
'react-hooks/rules-of-hooks': 'error', // Checks rules of Hooks
|
|
|
|
'react-hooks/exhaustive-deps': ['error', { additionalHooks: '^useFetcher$' }],
|
|
|
|
},
|
|
|
|
},
|
2018-04-20 21:13:37 +02:00
|
|
|
|
2018-12-19 22:14:41 +01:00
|
|
|
/**
|
|
|
|
* GIS overrides
|
|
|
|
*/
|
|
|
|
{
|
2019-06-19 00:13:00 +02:00
|
|
|
files: ['x-pack/legacy/plugins/maps/**/*.js'],
|
2018-12-19 22:14:41 +01:00
|
|
|
rules: {
|
|
|
|
'react/prefer-stateless-function': [0, { ignorePureComponents: false }],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2018-04-20 21:13:37 +02:00
|
|
|
/**
|
|
|
|
* ML overrides
|
|
|
|
*/
|
|
|
|
{
|
2020-04-16 11:53:46 +02:00
|
|
|
files: ['x-pack/plugins/ml/**/*.js'],
|
2018-04-20 21:13:37 +02:00
|
|
|
rules: {
|
|
|
|
'no-shadow': 'error',
|
2020-04-16 11:53:46 +02:00
|
|
|
'import/no-extraneous-dependencies': [
|
|
|
|
'error',
|
|
|
|
{
|
|
|
|
packageDir: './x-pack',
|
|
|
|
},
|
|
|
|
],
|
2018-04-20 21:13:37 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2019-05-03 20:45:15 +02:00
|
|
|
/**
|
|
|
|
* SIEM overrides
|
|
|
|
*/
|
|
|
|
{
|
2019-05-28 20:33:11 +02:00
|
|
|
// front end typescript and javascript files only
|
[SIEM] Client NP Cutover (#64251) (#64603)
* Move SIEM public/ folder to NP plugin
This is solely renames; fixes come next.
* Update relative imports in our API tests
* Fix linter errors following move to NP folder
These paths got a little shorter, so some lines could be collapsed.
* Move client dependencies to NP package.json
I'm removing the @types/js-yaml for now because I'm not sure we need it;
I'll add it back later if we do.
* Fix relative imports to other plugins
* Fix errant uses of ui/chrome
* Remove legacy plugin shim
* Move feature registration into plugin
This previously had to be part of legacy bootstrapping due to an order
of operations issue.
* Disconnect legacy plugin
The index file should now be redundant with what's in the plugin:
* app registration
* feature registration
* Move public gitattributes
* Remove references to legacy embeddables
We can now use the NP API. Maps embeddable will not work here until
their work is merged, but this should prevent us from importing legacy
code and thus breaking the build.
* Add our frontend dependencies to kibana.json
These are all required for now, because that's how they're typed. If
they _should_ be optional (and I think several should), we need to
update the type and handle the null case within the app.
* Replace use of ui/new_platform mocks in embeddable utils
* Fix remaining jest tests
* Replace build-breaking ui/new_platform mocks with equivalents in core
proper
* Remove unnecessary mocks of ui/new_platform
* Remove references to legacy SIEM folder
* I left the reference in CODEOWNERS in case someone tries to sneak
something back
* I left the .gitignore reference for the same reason
* Fix mocks of relative paths
These were not caught by typescript and were causing test failures.
* Export our client plugin contracts
They're empty for now.
* Move from deprecated appmount API
The new one dropped a param we weren't using.
* Add missing mock causing test failures
* Don't re-export core types from our plugin
Import them from core where we need them, instead
* Move Actions UI registry outside of mount
This is already imported, there's no benefit (and potential timing
issues) with doing this inside the mount.
* Add security's setup contract to our StartServices
This doesn't change what's used, only how we're typing it. The types are now a
little more truthful as:
* our StartPlugins don't include setup contracts
* our StartServices includes everything we use at Start time, including
the one setup plugin.
* Add order and icon back to the sidebar link
* Replace plugin class properties with constants
These are shared, and should be consistent.
* Enable our UI on NP
* Add missed plugin dependencies
We're not using their contracts, but we are importing code from them.
* Revert use of constant in translation
Can't do that, whoops
* i18n our feature catalogue entry
* Remove unnecessary array from single element
* Remove unused keys
These were the legacy translations used... well, I don't know where they
were used.
* Ignore circular dependencies in external plugins
* Normalize exclusions
* Add undeclared dependencies to kibana.json
We import our maps embeddable from maps, and we pass inspector to the
embeddable. I just missed these in my audit. This was causing errors in
the map embeddable.
* Await our call to setLayerList
This is an async call that we need to complete before we can render.
* Reduce siem plugin size
When we load our initial plugin (before our app is loaded), were were
implicitly importing all of kibana_react with this import. While a
global module prevents this from affecting our bundle size currently,
that could change in the future. Since we only need a reference to our
class, we just import that instead.
2020-04-28 18:41:25 +02:00
|
|
|
files: ['x-pack/plugins/siem/public/**/*.{js,ts,tsx}'],
|
2019-05-03 20:45:15 +02:00
|
|
|
rules: {
|
2019-05-28 20:33:11 +02:00
|
|
|
'import/no-nodejs-modules': 'error',
|
|
|
|
'no-restricted-imports': [
|
|
|
|
'error',
|
|
|
|
{
|
|
|
|
// prevents UI code from importing server side code and then webpack including it when doing builds
|
|
|
|
patterns: ['**/server/*'],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
// typescript only for front and back end
|
[SIEM] Server cutover to New Platform (#63430) (#63912)
* Move server code into NP folder
* NP config is not yet used
* Relative imports are somewhat broken
* Move common folder into NP
* Move cypress folder into NP
* Move scripts folder into NP
* Move misc. config into NP folder
A few of these were moved into the cypress folder as they're
cypress-specific.
I tried to update all the relative paths but some are likely broken. I'm
not going to know until other stuff is fixed, though.
* Move value for siem index pattern into common/constants
The other default values live in there, this is no different.
* Update paths following file move
If this was referencing the full project, it now references both paths
(legacy for UI, and NP for server).
* Fix typescript errors related to module resolution
These are mostly updating imports to the common/ folder on the UI side
(since things changed relative to those files).
* Replace Legacy Config with NP Config
* Updates plugin to use NP config
* defines new config previously coming from savedObjects config
* cleans up legacy types
Conflicts:
x-pack/plugins/siem/server/lib/detection_engine/routes/rules/export_rules_route.ts
x-pack/plugins/siem/server/lib/detection_engine/routes/rules/import_rules_route.ts
x-pack/plugins/siem/server/lib/detection_engine/rules/types.ts
x-pack/plugins/siem/server/plugin.ts
x-pack/plugins/siem/server/routes/index.ts
x-pack/plugins/siem/server/types.ts
* Remove local SIEM tsconfig
This was originally added to address an issue with tsserver, but that
issue is no longer relevant. The presence of this file confuses
typescript into thinking that siem is a separate TS project.
* Update kibana.json to declare our dependencies
These are not necessarily correct in terms of what's required/optional,
but this is what's declared in our types.
* Remove legacy plugin instantiation
* Removes legacy instantiation of server plugin, which is now handled by
NP
* Loosens legacy config spec so we no longer have to duplicate config
types
* Update tests with NP config
These were written against the old Hapi config function; now, we just
have a POJO.
* Update es_archiver helpers' paths
I'm not quite sure if these are working yet, but they're no longer
throwing errors.
* Ignore restricted path on script
This was cribbed from infra, who has made a similar change.
* Ignore restricted path on temporary savedObject mappings import
This will be changed subsequently when we switch to the NP form of
savedObject type registration.
* Add symlink to lockfile
* Fix paths on circular deps script
* Add separate config for Rule and Timeline saved objects
We had previously used the savedObjects' config, but those are not
currently exposed to us on New Platform. For now, we're going to split
this into two sets of values for the SOs we deal with
importing/exporting within the SIEM app, with the same defaults as
savedObjects.
* Fixing relative paths within cypress
These are strings that wouldn't be caught by typescript.
2020-04-18 02:23:46 +02:00
|
|
|
files: ['x-pack/{,legacy/}plugins/siem/**/*.{ts,tsx}'],
|
2019-05-28 20:33:11 +02:00
|
|
|
rules: {
|
|
|
|
// This will be turned on after bug fixes are complete
|
|
|
|
// '@typescript-eslint/explicit-member-accessibility': 'warn',
|
|
|
|
'@typescript-eslint/no-this-alias': 'error',
|
2019-05-03 20:45:15 +02:00
|
|
|
'@typescript-eslint/no-explicit-any': 'error',
|
2019-05-28 20:33:11 +02:00
|
|
|
'@typescript-eslint/no-useless-constructor': 'error',
|
|
|
|
// This will be turned on after bug fixes are complete
|
|
|
|
// '@typescript-eslint/no-object-literal-type-assertion': 'warn',
|
|
|
|
'@typescript-eslint/unified-signatures': 'error',
|
|
|
|
|
|
|
|
// eventually we want this to be a warn and then an error since this is a recommended linter rule
|
|
|
|
// for now, keeping it commented out to avoid too much IDE noise until the other linter issues
|
|
|
|
// are fixed in the next release or two
|
|
|
|
// '@typescript-eslint/explicit-function-return-type': 'warn',
|
|
|
|
|
|
|
|
// these rules cannot be turned on and tested at the moment until this issue is resolved:
|
|
|
|
// https://github.com/prettier/prettier-eslint/issues/201
|
|
|
|
// '@typescript-eslint/await-thenable': 'error',
|
|
|
|
// '@typescript-eslint/no-non-null-assertion': 'error'
|
|
|
|
// '@typescript-eslint/no-unnecessary-type-assertion': 'error',
|
|
|
|
// '@typescript-eslint/no-unused-vars': 'error',
|
|
|
|
// '@typescript-eslint/prefer-includes': 'error',
|
|
|
|
// '@typescript-eslint/prefer-string-starts-ends-with': 'error',
|
|
|
|
// '@typescript-eslint/promise-function-async': 'error',
|
|
|
|
// '@typescript-eslint/prefer-regexp-exec': 'error',
|
|
|
|
// '@typescript-eslint/promise-function-async': 'error',
|
|
|
|
// '@typescript-eslint/require-array-sort-compare': 'error',
|
|
|
|
// '@typescript-eslint/restrict-plus-operands': 'error',
|
|
|
|
// '@typescript-eslint/unbound-method': 'error',
|
|
|
|
},
|
|
|
|
},
|
2020-02-04 13:00:50 +01:00
|
|
|
// {
|
|
|
|
// // will introduced after the other warns are fixed
|
|
|
|
// // typescript and javascript for front end react performance
|
[SIEM] Client NP Cutover (#64251) (#64603)
* Move SIEM public/ folder to NP plugin
This is solely renames; fixes come next.
* Update relative imports in our API tests
* Fix linter errors following move to NP folder
These paths got a little shorter, so some lines could be collapsed.
* Move client dependencies to NP package.json
I'm removing the @types/js-yaml for now because I'm not sure we need it;
I'll add it back later if we do.
* Fix relative imports to other plugins
* Fix errant uses of ui/chrome
* Remove legacy plugin shim
* Move feature registration into plugin
This previously had to be part of legacy bootstrapping due to an order
of operations issue.
* Disconnect legacy plugin
The index file should now be redundant with what's in the plugin:
* app registration
* feature registration
* Move public gitattributes
* Remove references to legacy embeddables
We can now use the NP API. Maps embeddable will not work here until
their work is merged, but this should prevent us from importing legacy
code and thus breaking the build.
* Add our frontend dependencies to kibana.json
These are all required for now, because that's how they're typed. If
they _should_ be optional (and I think several should), we need to
update the type and handle the null case within the app.
* Replace use of ui/new_platform mocks in embeddable utils
* Fix remaining jest tests
* Replace build-breaking ui/new_platform mocks with equivalents in core
proper
* Remove unnecessary mocks of ui/new_platform
* Remove references to legacy SIEM folder
* I left the reference in CODEOWNERS in case someone tries to sneak
something back
* I left the .gitignore reference for the same reason
* Fix mocks of relative paths
These were not caught by typescript and were causing test failures.
* Export our client plugin contracts
They're empty for now.
* Move from deprecated appmount API
The new one dropped a param we weren't using.
* Add missing mock causing test failures
* Don't re-export core types from our plugin
Import them from core where we need them, instead
* Move Actions UI registry outside of mount
This is already imported, there's no benefit (and potential timing
issues) with doing this inside the mount.
* Add security's setup contract to our StartServices
This doesn't change what's used, only how we're typing it. The types are now a
little more truthful as:
* our StartPlugins don't include setup contracts
* our StartServices includes everything we use at Start time, including
the one setup plugin.
* Add order and icon back to the sidebar link
* Replace plugin class properties with constants
These are shared, and should be consistent.
* Enable our UI on NP
* Add missed plugin dependencies
We're not using their contracts, but we are importing code from them.
* Revert use of constant in translation
Can't do that, whoops
* i18n our feature catalogue entry
* Remove unnecessary array from single element
* Remove unused keys
These were the legacy translations used... well, I don't know where they
were used.
* Ignore circular dependencies in external plugins
* Normalize exclusions
* Add undeclared dependencies to kibana.json
We import our maps embeddable from maps, and we pass inspector to the
embeddable. I just missed these in my audit. This was causing errors in
the map embeddable.
* Await our call to setLayerList
This is an async call that we need to complete before we can render.
* Reduce siem plugin size
When we load our initial plugin (before our app is loaded), were were
implicitly importing all of kibana_react with this import. While a
global module prevents this from affecting our bundle size currently,
that could change in the future. Since we only need a reference to our
class, we just import that instead.
2020-04-28 18:41:25 +02:00
|
|
|
// files: ['x-pack/plugins/siem/public/**/!(*.test).{js,ts,tsx}'],
|
2020-02-04 13:00:50 +01:00
|
|
|
// plugins: ['react-perf'],
|
|
|
|
// rules: {
|
|
|
|
// // 'react-perf/jsx-no-new-object-as-prop': 'error',
|
|
|
|
// // 'react-perf/jsx-no-new-array-as-prop': 'error',
|
|
|
|
// // 'react-perf/jsx-no-new-function-as-prop': 'error',
|
|
|
|
// // 'react/jsx-no-bind': 'error',
|
|
|
|
// },
|
|
|
|
// },
|
2019-05-28 20:33:11 +02:00
|
|
|
{
|
|
|
|
// typescript and javascript for front and back end
|
[SIEM] Server cutover to New Platform (#63430) (#63912)
* Move server code into NP folder
* NP config is not yet used
* Relative imports are somewhat broken
* Move common folder into NP
* Move cypress folder into NP
* Move scripts folder into NP
* Move misc. config into NP folder
A few of these were moved into the cypress folder as they're
cypress-specific.
I tried to update all the relative paths but some are likely broken. I'm
not going to know until other stuff is fixed, though.
* Move value for siem index pattern into common/constants
The other default values live in there, this is no different.
* Update paths following file move
If this was referencing the full project, it now references both paths
(legacy for UI, and NP for server).
* Fix typescript errors related to module resolution
These are mostly updating imports to the common/ folder on the UI side
(since things changed relative to those files).
* Replace Legacy Config with NP Config
* Updates plugin to use NP config
* defines new config previously coming from savedObjects config
* cleans up legacy types
Conflicts:
x-pack/plugins/siem/server/lib/detection_engine/routes/rules/export_rules_route.ts
x-pack/plugins/siem/server/lib/detection_engine/routes/rules/import_rules_route.ts
x-pack/plugins/siem/server/lib/detection_engine/rules/types.ts
x-pack/plugins/siem/server/plugin.ts
x-pack/plugins/siem/server/routes/index.ts
x-pack/plugins/siem/server/types.ts
* Remove local SIEM tsconfig
This was originally added to address an issue with tsserver, but that
issue is no longer relevant. The presence of this file confuses
typescript into thinking that siem is a separate TS project.
* Update kibana.json to declare our dependencies
These are not necessarily correct in terms of what's required/optional,
but this is what's declared in our types.
* Remove legacy plugin instantiation
* Removes legacy instantiation of server plugin, which is now handled by
NP
* Loosens legacy config spec so we no longer have to duplicate config
types
* Update tests with NP config
These were written against the old Hapi config function; now, we just
have a POJO.
* Update es_archiver helpers' paths
I'm not quite sure if these are working yet, but they're no longer
throwing errors.
* Ignore restricted path on script
This was cribbed from infra, who has made a similar change.
* Ignore restricted path on temporary savedObject mappings import
This will be changed subsequently when we switch to the NP form of
savedObject type registration.
* Add symlink to lockfile
* Fix paths on circular deps script
* Add separate config for Rule and Timeline saved objects
We had previously used the savedObjects' config, but those are not
currently exposed to us on New Platform. For now, we're going to split
this into two sets of values for the SOs we deal with
importing/exporting within the SIEM app, with the same defaults as
savedObjects.
* Fixing relative paths within cypress
These are strings that wouldn't be caught by typescript.
2020-04-18 02:23:46 +02:00
|
|
|
files: ['x-pack/{,legacy/}plugins/siem/**/*.{js,ts,tsx}'],
|
2019-06-11 19:41:38 +02:00
|
|
|
plugins: ['eslint-plugin-node', 'react'],
|
2019-09-30 22:24:50 +02:00
|
|
|
env: {
|
|
|
|
mocha: true,
|
|
|
|
jest: true,
|
|
|
|
},
|
2019-05-28 20:33:11 +02:00
|
|
|
rules: {
|
|
|
|
'accessor-pairs': 'error',
|
|
|
|
'array-callback-return': 'error',
|
|
|
|
'no-array-constructor': 'error',
|
|
|
|
complexity: 'warn',
|
|
|
|
// This will be turned on after bug fixes are mostly completed
|
|
|
|
// 'consistent-return': 'warn',
|
|
|
|
// This will be turned on after bug fixes are mostly completed
|
|
|
|
// 'func-style': ['warn', 'expression'],
|
|
|
|
// These will be turned on after bug fixes are mostly completed and we can
|
|
|
|
// run a fix-lint
|
|
|
|
/*
|
|
|
|
'import/order': [
|
|
|
|
'warn',
|
|
|
|
{
|
|
|
|
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
|
|
|
|
'newlines-between': 'always',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
*/
|
2019-06-11 19:41:38 +02:00
|
|
|
'node/no-deprecated-api': 'error',
|
2019-05-28 20:33:11 +02:00
|
|
|
'no-bitwise': 'error',
|
|
|
|
'no-continue': 'error',
|
|
|
|
'no-dupe-keys': 'error',
|
|
|
|
'no-duplicate-case': 'error',
|
2019-09-13 18:28:16 +02:00
|
|
|
'no-duplicate-imports': 'error',
|
2019-05-28 20:33:11 +02:00
|
|
|
'no-empty-character-class': 'error',
|
|
|
|
'no-empty-pattern': 'error',
|
|
|
|
'no-ex-assign': 'error',
|
|
|
|
'no-extend-native': 'error',
|
|
|
|
'no-extra-bind': 'error',
|
|
|
|
'no-extra-boolean-cast': 'error',
|
|
|
|
'no-extra-label': 'error',
|
|
|
|
'no-func-assign': 'error',
|
|
|
|
'no-implicit-globals': 'error',
|
|
|
|
'no-implied-eval': 'error',
|
|
|
|
'no-invalid-regexp': 'error',
|
|
|
|
'no-inner-declarations': 'error',
|
|
|
|
'no-lone-blocks': 'error',
|
|
|
|
'no-multi-assign': 'error',
|
|
|
|
'no-misleading-character-class': 'error',
|
|
|
|
'no-new-symbol': 'error',
|
|
|
|
'no-obj-calls': 'error',
|
2019-09-18 15:03:19 +02:00
|
|
|
'no-param-reassign': 'error',
|
2019-05-28 20:33:11 +02:00
|
|
|
'no-process-exit': 'error',
|
|
|
|
'no-prototype-builtins': 'error',
|
2019-09-19 17:11:11 +02:00
|
|
|
'no-return-await': 'error',
|
2019-05-28 20:33:11 +02:00
|
|
|
'no-self-compare': 'error',
|
|
|
|
'no-shadow-restricted-names': 'error',
|
|
|
|
'no-sparse-arrays': 'error',
|
|
|
|
'no-this-before-super': 'error',
|
2019-09-30 22:24:50 +02:00
|
|
|
'no-undef': 'error',
|
2019-05-28 20:33:11 +02:00
|
|
|
'no-unreachable': 'error',
|
|
|
|
'no-unsafe-finally': 'error',
|
|
|
|
'no-useless-call': 'error',
|
2020-01-08 05:49:44 +01:00
|
|
|
'no-useless-catch': 'error',
|
2019-05-28 20:33:11 +02:00
|
|
|
'no-useless-concat': 'error',
|
|
|
|
'no-useless-computed-key': 'error',
|
|
|
|
// This will be turned on after bug fixes are mostly complete
|
|
|
|
// 'no-useless-escape': 'warn',
|
|
|
|
'no-useless-rename': 'error',
|
2020-01-08 05:49:44 +01:00
|
|
|
'no-useless-return': 'error',
|
2019-05-28 20:33:11 +02:00
|
|
|
// This will be turned on after bug fixers are mostly complete
|
|
|
|
// 'no-void': 'warn',
|
|
|
|
'one-var-declaration-per-line': 'error',
|
|
|
|
'prefer-object-spread': 'error',
|
|
|
|
'prefer-promise-reject-errors': 'error',
|
|
|
|
'prefer-rest-params': 'error',
|
|
|
|
'prefer-spread': 'error',
|
2020-01-08 05:49:31 +01:00
|
|
|
'prefer-template': 'error',
|
2019-05-28 20:33:11 +02:00
|
|
|
'react/boolean-prop-naming': 'error',
|
|
|
|
'react/button-has-type': 'error',
|
2020-01-08 00:10:31 +01:00
|
|
|
'react/display-name': 'error',
|
2019-05-28 20:33:11 +02:00
|
|
|
'react/forbid-dom-props': 'error',
|
2019-05-28 22:41:38 +02:00
|
|
|
'react/no-access-state-in-setstate': 'error',
|
2020-01-08 05:49:44 +01:00
|
|
|
'react/no-children-prop': 'error',
|
2019-05-28 20:33:11 +02:00
|
|
|
'react/no-danger-with-children': 'error',
|
|
|
|
'react/no-deprecated': 'error',
|
|
|
|
'react/no-did-mount-set-state': 'error',
|
2019-05-28 22:41:38 +02:00
|
|
|
// Re-enable once we have better options per this issue:
|
|
|
|
// https://github.com/airbnb/javascript/issues/1875
|
|
|
|
// 'react/no-did-update-set-state': 'error',
|
2019-05-28 20:33:11 +02:00
|
|
|
'react/no-direct-mutation-state': 'error',
|
|
|
|
'react/no-find-dom-node': 'error',
|
|
|
|
'react/no-redundant-should-component-update': 'error',
|
|
|
|
'react/no-render-return-value': 'error',
|
|
|
|
'react/no-typos': 'error',
|
|
|
|
'react/no-string-refs': 'error',
|
|
|
|
'react/no-this-in-sfc': 'error',
|
2019-05-28 21:56:19 +02:00
|
|
|
'react/no-unescaped-entities': 'error',
|
2019-05-28 20:33:11 +02:00
|
|
|
'react/no-unsafe': 'error',
|
|
|
|
'react/no-unused-prop-types': 'error',
|
|
|
|
'react/no-unused-state': 'error',
|
|
|
|
// will introduced after the other warns are fixed
|
|
|
|
// 'react/sort-comp': 'error',
|
|
|
|
'react/void-dom-elements-no-children': 'error',
|
|
|
|
'react/jsx-no-comment-textnodes': 'error',
|
2019-05-31 01:06:04 +02:00
|
|
|
'react/jsx-no-literals': 'error',
|
2019-05-28 20:33:11 +02:00
|
|
|
'react/jsx-no-target-blank': 'error',
|
|
|
|
'react/jsx-fragments': 'error',
|
|
|
|
'react/jsx-sort-default-props': 'error',
|
|
|
|
// might be introduced after the other warns are fixed
|
|
|
|
// 'react/jsx-sort-props': 'error',
|
2019-11-28 15:49:43 +01:00
|
|
|
// might be introduced after the other warns are fixed
|
|
|
|
'react-hooks/exhaustive-deps': 'off',
|
2019-05-28 20:33:11 +02:00
|
|
|
'require-atomic-updates': 'error',
|
|
|
|
'symbol-description': 'error',
|
|
|
|
'vars-on-top': 'error',
|
2019-05-03 20:45:15 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2020-04-26 13:23:48 +02:00
|
|
|
/**
|
|
|
|
* Alerting Services overrides
|
|
|
|
*/
|
|
|
|
{
|
|
|
|
// typescript only for front and back end
|
|
|
|
files: [
|
|
|
|
'x-pack/{,legacy/}plugins/{alerting,alerting_builtins,actions,task_manager,event_log}/**/*.{ts,tsx}',
|
|
|
|
],
|
|
|
|
rules: {
|
|
|
|
'@typescript-eslint/no-explicit-any': 'error',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2019-09-17 22:59:06 +02:00
|
|
|
/**
|
|
|
|
* Lens overrides
|
|
|
|
*/
|
|
|
|
{
|
2020-04-15 14:41:16 +02:00
|
|
|
files: ['x-pack/plugins/lens/**/*.{ts,tsx}'],
|
2019-09-17 22:59:06 +02:00
|
|
|
rules: {
|
|
|
|
'@typescript-eslint/no-explicit-any': 'error',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2018-11-01 17:47:16 +01:00
|
|
|
/**
|
|
|
|
* disable jsx-a11y for kbn-ui-framework
|
|
|
|
*/
|
|
|
|
{
|
2019-04-05 20:14:26 +02:00
|
|
|
files: ['packages/kbn-ui-framework/**/*.js'],
|
2018-11-01 17:47:16 +01:00
|
|
|
rules: {
|
|
|
|
'jsx-a11y/click-events-have-key-events': 'off',
|
|
|
|
'jsx-a11y/anchor-has-content': 'off',
|
|
|
|
'jsx-a11y/tabindex-no-positive': 'off',
|
2018-12-12 16:04:15 +01:00
|
|
|
'jsx-a11y/label-has-associated-control': 'off',
|
2018-11-01 17:47:16 +01:00
|
|
|
'jsx-a11y/aria-role': 'off',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2018-09-04 22:14:47 +02:00
|
|
|
/**
|
|
|
|
* Canvas overrides
|
|
|
|
*/
|
|
|
|
{
|
2019-06-19 00:13:00 +02:00
|
|
|
files: ['x-pack/legacy/plugins/canvas/**/*.js'],
|
2018-09-04 22:14:47 +02:00
|
|
|
rules: {
|
2018-12-18 02:32:06 +01:00
|
|
|
radix: 'error',
|
2018-09-04 22:14:47 +02:00
|
|
|
|
|
|
|
// module importing
|
|
|
|
'import/order': [
|
2018-12-18 02:32:06 +01:00
|
|
|
'error',
|
|
|
|
{
|
|
|
|
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
|
|
|
|
},
|
2018-09-04 22:14:47 +02:00
|
|
|
],
|
2018-12-18 02:32:06 +01:00
|
|
|
'import/extensions': ['error', 'never', { json: 'always', less: 'always', svg: 'always' }],
|
2018-09-04 22:14:47 +02:00
|
|
|
|
|
|
|
// react
|
2018-12-18 02:32:06 +01:00
|
|
|
'react/no-did-mount-set-state': 'error',
|
|
|
|
'react/no-did-update-set-state': 'error',
|
|
|
|
'react/no-multi-comp': ['error', { ignoreStateless: true }],
|
|
|
|
'react/self-closing-comp': 'error',
|
|
|
|
'react/sort-comp': 'error',
|
|
|
|
'react/jsx-boolean-value': 'error',
|
|
|
|
'react/no-unescaped-entities': ['error', { forbid: ['>', '}'] }],
|
2018-09-04 22:14:47 +02:00
|
|
|
'react/forbid-elements': [
|
2018-12-18 02:32:06 +01:00
|
|
|
'error',
|
2018-09-04 22:14:47 +02:00
|
|
|
{
|
|
|
|
forbid: [
|
|
|
|
{
|
|
|
|
element: 'EuiConfirmModal',
|
|
|
|
message: 'Use <ConfirmModal> instead',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
element: 'EuiPopover',
|
|
|
|
message: 'Use <Popover> instead',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
element: 'EuiIconTip',
|
|
|
|
message: 'Use <TooltipIcon> instead',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
files: [
|
2019-06-19 00:13:00 +02:00
|
|
|
'x-pack/legacy/plugins/canvas/gulpfile.js',
|
|
|
|
'x-pack/legacy/plugins/canvas/scripts/*.js',
|
|
|
|
'x-pack/legacy/plugins/canvas/tasks/*.js',
|
|
|
|
'x-pack/legacy/plugins/canvas/tasks/**/*.js',
|
|
|
|
'x-pack/legacy/plugins/canvas/__tests__/**/*.js',
|
|
|
|
'x-pack/legacy/plugins/canvas/**/{__tests__,__test__,__jest__,__fixtures__,__mocks__}/**/*.js',
|
2018-09-04 22:14:47 +02:00
|
|
|
],
|
|
|
|
rules: {
|
|
|
|
'import/no-extraneous-dependencies': [
|
|
|
|
'error',
|
|
|
|
{
|
|
|
|
devDependencies: true,
|
|
|
|
peerDependencies: true,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2019-06-19 00:13:00 +02:00
|
|
|
files: ['x-pack/legacy/plugins/canvas/canvas_plugin_src/**/*.js'],
|
2018-09-04 22:14:47 +02:00
|
|
|
globals: { canvas: true, $: true },
|
|
|
|
rules: {
|
|
|
|
'import/no-unresolved': [
|
|
|
|
'error',
|
|
|
|
{
|
|
|
|
ignore: ['!!raw-loader.+.svg$'],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2018-11-07 17:33:39 +01:00
|
|
|
{
|
2019-06-19 00:13:00 +02:00
|
|
|
files: ['x-pack/legacy/plugins/canvas/public/**/*.js'],
|
2018-11-07 17:33:39 +01:00
|
|
|
env: {
|
|
|
|
browser: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2019-06-19 00:13:00 +02:00
|
|
|
files: ['x-pack/legacy/plugins/canvas/canvas_plugin_src/lib/flot-charts/**/*.js'],
|
2018-11-07 17:33:39 +01:00
|
|
|
env: {
|
|
|
|
jquery: true,
|
|
|
|
},
|
|
|
|
},
|
2019-05-27 10:01:08 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* TSVB overrides
|
|
|
|
*/
|
|
|
|
{
|
2020-04-07 11:08:21 +02:00
|
|
|
files: [
|
|
|
|
'src/plugins/vis_type_timeseries/**/*.{js,ts,tsx}',
|
|
|
|
'src/legacy/core_plugins/vis_type_timeseries/**/*.{js,ts,tsx}',
|
|
|
|
],
|
2019-05-27 10:01:08 +02:00
|
|
|
rules: {
|
|
|
|
'import/no-default-export': 'error',
|
|
|
|
},
|
|
|
|
},
|
2019-12-14 23:17:59 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Prettier disables all conflicting rules, listing as last override so it takes precedence
|
|
|
|
*/
|
|
|
|
{
|
|
|
|
files: ['**/*'],
|
|
|
|
rules: {
|
|
|
|
...require('eslint-config-prettier').rules,
|
|
|
|
...require('eslint-config-prettier/react').rules,
|
|
|
|
...require('eslint-config-prettier/@typescript-eslint').rules,
|
|
|
|
},
|
|
|
|
},
|
2018-02-06 00:29:30 +01:00
|
|
|
],
|
|
|
|
};
|