2019-10-22 01:32:31 +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 18:45:23 +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.
|
|
|
|
*/
|
|
|
|
`;
|
|
|
|
|
2018-02-05 18:18:43 +01:00
|
|
|
module.exports = {
|
2019-09-03 22:57:09 +02:00
|
|
|
root: true,
|
|
|
|
|
2019-08-16 17:29:46 +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 14:15:33 +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/legacy/core_plugins/data/**/*.{js,ts,tsx}'],
|
|
|
|
rules: {
|
|
|
|
'react-hooks/exhaustive-deps': 'off',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
files: ['src/legacy/core_plugins/expressions/**/*.{js,ts,tsx}'],
|
|
|
|
rules: {
|
|
|
|
'react-hooks/exhaustive-deps': 'off',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2020-01-15 22:48:19 +01:00
|
|
|
files: ['src/legacy/core_plugins/vis_type_vislib/**/*.{js,ts,tsx}'],
|
2019-10-29 14:15:33 +01:00
|
|
|
rules: {
|
|
|
|
'react-hooks/exhaustive-deps': 'off',
|
|
|
|
},
|
|
|
|
},
|
2020-01-29 15:41:18 +01:00
|
|
|
{
|
|
|
|
files: [
|
|
|
|
'src/legacy/core_plugins/vis_default_editor/public/components/controls/**/*.{ts,tsx}',
|
|
|
|
],
|
|
|
|
rules: {
|
|
|
|
'react-hooks/exhaustive-deps': 'off',
|
|
|
|
},
|
|
|
|
},
|
2019-10-29 14:15:33 +01:00
|
|
|
{
|
|
|
|
files: ['src/legacy/ui/public/vis/**/*.{js,ts,tsx}'],
|
|
|
|
rules: {
|
|
|
|
'react-hooks/exhaustive-deps': 'off',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
files: ['src/plugins/es_ui_shared/**/*.{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',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
files: ['x-pack/legacy/plugins/cross_cluster_replication/**/*.{js,ts,tsx}'],
|
|
|
|
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',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
files: ['x-pack/legacy/plugins/lens/**/*.{js,ts,tsx}'],
|
|
|
|
rules: {
|
|
|
|
'react-hooks/exhaustive-deps': 'off',
|
|
|
|
'react-hooks/rules-of-hooks': 'off',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
files: ['x-pack/legacy/plugins/ml/**/*.{js,ts,tsx}'],
|
|
|
|
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 18:45:23 +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: [
|
|
|
|
'src/legacy/**/*',
|
|
|
|
'x-pack/**/*',
|
|
|
|
'!x-pack/**/*.test.*',
|
2019-12-13 19:26:04 +01:00
|
|
|
'!x-pack/test/**/*',
|
|
|
|
'(src|x-pack)/plugins/**/(public|server)/**/*',
|
2019-04-05 18:45:23 +02:00
|
|
|
'src/core/(public|server)/**/*',
|
2020-01-08 17:20:07 +01:00
|
|
|
'examples/**/*',
|
2019-04-05 18:45:23 +02:00
|
|
|
],
|
|
|
|
from: [
|
|
|
|
'src/core/public/**/*',
|
2019-04-10 14:56:09 +02:00
|
|
|
'!src/core/public/index.ts',
|
|
|
|
'!src/core/public/mocks.ts',
|
2019-06-28 13:34:41 +02:00
|
|
|
'!src/core/public/*.test.mocks.ts',
|
2019-04-05 18:45:23 +02:00
|
|
|
'!src/core/public/utils/**/*',
|
|
|
|
|
|
|
|
'src/core/server/**/*',
|
2019-04-10 14:56:09 +02:00
|
|
|
'!src/core/server/index.ts',
|
|
|
|
'!src/core/server/mocks.ts',
|
2019-10-15 14:19:11 +02:00
|
|
|
'!src/core/server/types.ts',
|
2019-12-03 09:34:49 +01:00
|
|
|
'!src/core/server/test_utils.ts',
|
2019-10-16 14:18:34 +02:00
|
|
|
// for absolute imports until fixed in
|
|
|
|
// https://github.com/elastic/kibana/issues/36096
|
|
|
|
'!src/core/server/types',
|
2019-06-28 13:34:41 +02:00
|
|
|
'!src/core/server/*.test.mocks.ts',
|
2019-04-05 18:45:23 +02:00
|
|
|
|
2019-12-13 19:26:04 +01:00
|
|
|
'(src|x-pack)/plugins/**/(public|server)/**/*',
|
|
|
|
'!(src|x-pack)/plugins/**/(public|server)/(index|mocks).{js,ts,tsx}',
|
2019-04-05 18:45:23 +02:00
|
|
|
],
|
|
|
|
allowSameFolder: true,
|
2019-12-13 19:26:04 +01:00
|
|
|
errorMessage: 'Plugins may only import from top-level public and server modules.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
target: [
|
|
|
|
'(src|x-pack)/plugins/**/*',
|
2020-01-27 20:25:39 +01:00
|
|
|
'!(src|x-pack)/plugins/**/server/**/*',
|
2019-12-13 19:26:04 +01:00
|
|
|
|
|
|
|
'src/legacy/core_plugins/**/*',
|
2020-01-27 20:25:39 +01:00
|
|
|
'!src/legacy/core_plugins/**/server/**/*',
|
|
|
|
'!src/legacy/core_plugins/**/index.{js,ts,tsx}',
|
2019-12-13 19:26:04 +01:00
|
|
|
|
|
|
|
'x-pack/legacy/plugins/**/*',
|
2020-01-27 20:25:39 +01:00
|
|
|
'!x-pack/legacy/plugins/**/server/**/*',
|
|
|
|
'!x-pack/legacy/plugins/**/index.{js,ts,tsx}',
|
2020-01-08 17:20:07 +01:00
|
|
|
|
|
|
|
'examples/**/*',
|
|
|
|
'!examples/**/server/**/*',
|
2019-12-13 19:26:04 +01:00
|
|
|
],
|
|
|
|
from: [
|
|
|
|
'src/core/server',
|
|
|
|
'src/core/server/**/*',
|
|
|
|
'(src|x-pack)/plugins/*/server/**/*',
|
2020-01-08 17:20:07 +01:00
|
|
|
'examples/**/server/**/*',
|
2020-01-24 15:38:44 +01:00
|
|
|
// TODO: Remove the 'joi' eslint rule once IE11 support is dropped
|
|
|
|
'joi',
|
2019-12-13 19:26:04 +01:00
|
|
|
],
|
|
|
|
errorMessage:
|
|
|
|
'Server modules cannot be imported into client modules or shared modules.',
|
2019-04-05 18:45:23 +02:00
|
|
|
},
|
2019-11-28 22:54:21 +01:00
|
|
|
{
|
2019-12-13 21:24:14 +01:00
|
|
|
target: ['src/**/*'],
|
2019-11-28 22:54:21 +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-13 19:26:04 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
target: ['(src|x-pack)/plugins/*/public/**/*'],
|
|
|
|
from: ['ui/**/*', 'uiExports/**/*'],
|
|
|
|
errorMessage: 'Plugins cannot import legacy UI code.',
|
2019-11-28 22:54:21 +01:00
|
|
|
},
|
2019-07-18 22:52:13 +02:00
|
|
|
{
|
|
|
|
from: ['src/legacy/ui/**/*', 'ui/**/*'],
|
|
|
|
target: [
|
2019-08-30 18:04:32 +02:00
|
|
|
'test/plugin_functional/plugins/**/public/np_ready/**/*',
|
|
|
|
'test/plugin_functional/plugins/**/server/np_ready/**/*',
|
2019-07-18 22:52:13 +02:00
|
|
|
'src/legacy/core_plugins/**/public/np_ready/**/*',
|
2020-02-10 12:48:18 +01:00
|
|
|
'src/legacy/core_plugins/vis_type_*/public/**/*',
|
|
|
|
'!src/legacy/core_plugins/vis_type_*/public/legacy*',
|
2019-07-18 22:52:13 +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 18:45:23 +02:00
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2018-04-20 21:13:37 +02:00
|
|
|
/**
|
|
|
|
* Allow default exports
|
|
|
|
*/
|
2018-02-06 00:29:30 +01:00
|
|
|
{
|
2019-06-14 18:35:23 +02:00
|
|
|
files: [
|
|
|
|
'x-pack/test/functional/apps/**/*.js',
|
2019-06-18 20:45:53 +02:00
|
|
|
'x-pack/legacy/plugins/apm/**/*.js',
|
2019-06-14 18:35:23 +02:00
|
|
|
'test/*/config.ts',
|
2019-11-07 16:07:40 +01:00
|
|
|
'test/*/{tests,test_suites,apis,apps}/**/*',
|
2019-06-14 18:35:23 +02:00
|
|
|
'test/visual_regression/tests/**/*',
|
2019-08-03 00:43:05 +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 18:35:23 +02:00
|
|
|
],
|
2018-02-06 00:29:30 +01:00
|
|
|
rules: {
|
2019-04-02 08:37:01 +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 18:45:23 +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-10 23:22: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-12 17:51:03 +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-18 20:45:53 +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 18:45:23 +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 18:45:23 +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 18:45:23 +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 08:12:19 +01:00
|
|
|
'x-pack/test_utils/**/*',
|
2018-04-20 21:13:37 +02:00
|
|
|
'x-pack/gulpfile.js',
|
2019-06-18 20:45:53 +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 18:45:23 +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
|
|
|
|
*/
|
|
|
|
{
|
2019-02-17 13:47:36 +01:00
|
|
|
files: [
|
2019-03-02 02:53:05 +01:00
|
|
|
'test/functional/services/lib/web_element_wrapper/scroll_into_view_if_necessary.js',
|
2019-04-05 18:45:23 +02:00
|
|
|
'**/browser_exec_scripts/**/*.js',
|
2019-02-17 13:47:36 +01:00
|
|
|
],
|
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-17 13:47: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 18:45:23 +02:00
|
|
|
'**/webpackShims/**/*.js',
|
|
|
|
'packages/kbn-plugin-generator/**/*.js',
|
|
|
|
'packages/kbn-plugin-helpers/**/*.js',
|
|
|
|
'packages/kbn-eslint-import-resolver-kibana/**/*.js',
|
2019-03-23 01:12:14 +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 18:45:23 +02:00
|
|
|
'x-pack/scripts/*.js',
|
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-18 19:11:33 +02:00
|
|
|
/**
|
|
|
|
* Jest specific rules
|
|
|
|
*/
|
|
|
|
{
|
|
|
|
files: ['**/*.test.{js,ts,tsx}'],
|
|
|
|
rules: {
|
|
|
|
'jest/valid-describe': 'error',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2018-04-20 21:13:37 +02:00
|
|
|
/**
|
|
|
|
* APM overrides
|
|
|
|
*/
|
|
|
|
{
|
2019-06-18 20:45:53 +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-29 20:36:24 +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-18 20:45:53 +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
|
|
|
/**
|
|
|
|
* Graph overrides
|
|
|
|
*/
|
|
|
|
{
|
2019-06-18 20:45:53 +02:00
|
|
|
files: ['x-pack/legacy/plugins/graph/**/*.js'],
|
2018-04-20 21:13:37 +02:00
|
|
|
globals: {
|
|
|
|
angular: true,
|
|
|
|
$: true,
|
|
|
|
},
|
|
|
|
rules: {
|
|
|
|
'block-scoped-var': 'off',
|
|
|
|
camelcase: 'off',
|
|
|
|
eqeqeq: 'off',
|
|
|
|
'guard-for-in': 'off',
|
|
|
|
'new-cap': 'off',
|
|
|
|
'no-loop-func': 'off',
|
|
|
|
'no-redeclare': 'off',
|
|
|
|
'no-shadow': 'off',
|
|
|
|
'no-unused-vars': 'off',
|
|
|
|
'one-var': 'off',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ML overrides
|
|
|
|
*/
|
|
|
|
{
|
2019-06-18 20:45:53 +02:00
|
|
|
files: ['x-pack/legacy/plugins/ml/**/*.js'],
|
2018-04-20 21:13:37 +02:00
|
|
|
rules: {
|
|
|
|
'no-shadow': 'error',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2019-04-19 02:37:46 +02:00
|
|
|
/**
|
|
|
|
* SIEM overrides
|
|
|
|
*/
|
|
|
|
{
|
2019-05-28 19:14:17 +02:00
|
|
|
// front end typescript and javascript files only
|
2019-06-18 20:45:53 +02:00
|
|
|
files: ['x-pack/legacy/plugins/siem/public/**/*.{js,ts,tsx}'],
|
2019-04-19 02:37:46 +02:00
|
|
|
rules: {
|
2019-05-28 19:14:17 +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
|
2019-06-18 20:45:53 +02:00
|
|
|
files: ['x-pack/legacy/plugins/siem/**/*.{ts,tsx}'],
|
2019-05-28 19:14:17 +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-04-19 02:37:46 +02:00
|
|
|
'@typescript-eslint/no-explicit-any': 'error',
|
2019-05-28 19:14:17 +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 11:22:40 +01:00
|
|
|
// {
|
|
|
|
// // will introduced after the other warns are fixed
|
|
|
|
// // typescript and javascript for front end react performance
|
|
|
|
// files: ['x-pack/legacy/plugins/siem/public/**/!(*.test).{js,ts,tsx}'],
|
|
|
|
// 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 19:14:17 +02:00
|
|
|
{
|
|
|
|
// typescript and javascript for front and back end
|
2019-06-18 20:45:53 +02:00
|
|
|
files: ['x-pack/legacy/plugins/siem/**/*.{js,ts,tsx}'],
|
2019-06-11 06:15:11 +02:00
|
|
|
plugins: ['eslint-plugin-node', 'react'],
|
2019-09-30 20:25:06 +02:00
|
|
|
env: {
|
|
|
|
mocha: true,
|
|
|
|
jest: true,
|
|
|
|
},
|
2019-05-28 19:14:17 +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 06:15:11 +02:00
|
|
|
'node/no-deprecated-api': 'error',
|
2019-05-28 19:14:17 +02:00
|
|
|
'no-bitwise': 'error',
|
|
|
|
'no-continue': 'error',
|
|
|
|
'no-dupe-keys': 'error',
|
|
|
|
'no-duplicate-case': 'error',
|
2019-09-13 15:15:42 +02:00
|
|
|
'no-duplicate-imports': 'error',
|
2019-05-28 19:14:17 +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 01:18:50 +02:00
|
|
|
'no-param-reassign': 'error',
|
2019-05-28 19:14:17 +02:00
|
|
|
'no-process-exit': 'error',
|
|
|
|
'no-prototype-builtins': 'error',
|
2019-09-18 23:09:52 +02:00
|
|
|
'no-return-await': 'error',
|
2019-05-28 19:14:17 +02:00
|
|
|
'no-self-compare': 'error',
|
|
|
|
'no-shadow-restricted-names': 'error',
|
|
|
|
'no-sparse-arrays': 'error',
|
|
|
|
'no-this-before-super': 'error',
|
2019-09-30 20:25:06 +02:00
|
|
|
'no-undef': 'error',
|
2019-05-28 19:14:17 +02:00
|
|
|
'no-unreachable': 'error',
|
|
|
|
'no-unsafe-finally': 'error',
|
|
|
|
'no-useless-call': 'error',
|
2020-01-07 17:46:56 +01:00
|
|
|
'no-useless-catch': 'error',
|
2019-05-28 19:14:17 +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-07 17:46:56 +01:00
|
|
|
'no-useless-return': 'error',
|
2019-05-28 19:14:17 +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-07 18:02:32 +01:00
|
|
|
'prefer-template': 'error',
|
2019-05-28 19:14:17 +02:00
|
|
|
'react/boolean-prop-naming': 'error',
|
|
|
|
'react/button-has-type': 'error',
|
2020-01-07 18:05:04 +01:00
|
|
|
'react/display-name': 'error',
|
2019-05-28 19:14:17 +02:00
|
|
|
'react/forbid-dom-props': 'error',
|
2019-05-28 21:10:53 +02:00
|
|
|
'react/no-access-state-in-setstate': 'error',
|
2020-01-07 17:46:56 +01:00
|
|
|
'react/no-children-prop': 'error',
|
2019-05-28 19:14:17 +02:00
|
|
|
'react/no-danger-with-children': 'error',
|
|
|
|
'react/no-deprecated': 'error',
|
|
|
|
'react/no-did-mount-set-state': 'error',
|
2019-05-28 21:10:53 +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 19:14:17 +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 20:33:51 +02:00
|
|
|
'react/no-unescaped-entities': 'error',
|
2019-05-28 19:14:17 +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-30 22:17:29 +02:00
|
|
|
'react/jsx-no-literals': 'error',
|
2019-05-28 19:14:17 +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-16 18:24:27 +01:00
|
|
|
// might be introduced after the other warns are fixed
|
|
|
|
'react-hooks/exhaustive-deps': 'off',
|
2019-05-28 19:14:17 +02:00
|
|
|
'require-atomic-updates': 'error',
|
|
|
|
'symbol-description': 'error',
|
|
|
|
'vars-on-top': 'error',
|
2019-04-19 02:37:46 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2019-09-17 20:57:53 +02:00
|
|
|
/**
|
|
|
|
* Lens overrides
|
|
|
|
*/
|
|
|
|
{
|
|
|
|
files: ['x-pack/legacy/plugins/lens/**/*.ts', 'x-pack/legacy/plugins/lens/**/*.tsx'],
|
|
|
|
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 18:45:23 +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-18 20:45:53 +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-18 20:45:53 +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-18 20:45:53 +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-18 20:45:53 +02:00
|
|
|
files: ['x-pack/legacy/plugins/canvas/public/**/*.js'],
|
2018-11-07 17:33:39 +01:00
|
|
|
env: {
|
|
|
|
browser: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2019-06-18 20:45:53 +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-24 15:16:54 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* TSVB overrides
|
|
|
|
*/
|
|
|
|
{
|
|
|
|
files: ['src/legacy/core_plugins/metrics/**/*.js'],
|
|
|
|
excludedFiles: 'src/legacy/core_plugins/metrics/index.js',
|
|
|
|
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
|
|
|
],
|
|
|
|
};
|