2021-07-30 19:38:02 +02:00
|
|
|
const { USES_STYLED_COMPONENTS } = require('@kbn/babel-preset/styled_components_files');
|
2021-07-09 20:42:50 +02:00
|
|
|
|
2017-07-25 10:02:14 +02:00
|
|
|
module.exports = {
|
2019-04-05 18:45:23 +02:00
|
|
|
extends: [
|
|
|
|
'./javascript.js',
|
|
|
|
'./typescript.js',
|
|
|
|
'./jest.js',
|
2019-10-29 14:15:33 +01:00
|
|
|
'./react.js',
|
2017-07-25 10:02:14 +02:00
|
|
|
],
|
2019-12-12 17:16:24 +01:00
|
|
|
|
|
|
|
plugins: [
|
|
|
|
'@kbn/eslint-plugin-eslint',
|
|
|
|
'prettier',
|
|
|
|
],
|
2018-11-16 00:40:01 +01:00
|
|
|
|
2019-04-05 18:45:23 +02:00
|
|
|
parserOptions: {
|
2019-06-03 19:52:38 +02:00
|
|
|
ecmaVersion: 2018
|
2018-11-16 00:40:01 +01:00
|
|
|
},
|
|
|
|
|
2017-07-25 10:02:14 +02:00
|
|
|
env: {
|
2019-06-03 19:52:38 +02:00
|
|
|
es6: true,
|
2017-07-25 10:02:14 +02:00
|
|
|
},
|
|
|
|
|
2019-12-14 23:17:59 +01:00
|
|
|
rules: {
|
|
|
|
'prettier/prettier': [
|
|
|
|
'error',
|
|
|
|
{
|
|
|
|
endOfLine: 'auto',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
|
|
|
|
'@kbn/eslint/module_migration': [
|
|
|
|
'error',
|
|
|
|
[
|
2019-12-09 23:59:07 +01:00
|
|
|
{
|
2019-12-14 23:17:59 +01:00
|
|
|
from: 'expect.js',
|
|
|
|
to: '@kbn/expect',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
from: 'mkdirp',
|
|
|
|
to: false,
|
|
|
|
disallowedMessage: `Don't use 'mkdirp', use the new { recursive: true } option of Fs.mkdir instead`
|
|
|
|
},
|
2020-06-03 19:07:11 +02:00
|
|
|
{
|
|
|
|
from: 'numeral',
|
|
|
|
to: '@elastic/numeral',
|
|
|
|
},
|
2019-12-14 23:17:59 +01:00
|
|
|
{
|
|
|
|
from: '@kbn/elastic-idx',
|
|
|
|
to: false,
|
|
|
|
disallowedMessage: `Don't use idx(), use optional chaining syntax instead https://ela.st/optchain`
|
|
|
|
},
|
|
|
|
{
|
|
|
|
from: 'x-pack',
|
|
|
|
toRelative: 'x-pack',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
from: 'react-router',
|
|
|
|
to: 'react-router-dom',
|
2019-11-12 15:33:54 +01:00
|
|
|
},
|
2020-06-04 13:43:21 +02:00
|
|
|
{
|
|
|
|
from: '@kbn/ui-shared-deps/monaco',
|
|
|
|
to: '@kbn/monaco',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
from: 'monaco-editor',
|
|
|
|
to: false,
|
|
|
|
disallowedMessage: `Don't import monaco directly, use or add exports to @kbn/monaco`
|
|
|
|
},
|
2021-01-28 19:58:37 +01:00
|
|
|
{
|
|
|
|
from: 'tinymath',
|
|
|
|
to: '@kbn/tinymath',
|
|
|
|
disallowedMessage: `Don't use 'tinymath', use '@kbn/tinymath'`
|
|
|
|
},
|
2021-05-17 18:51:53 +02:00
|
|
|
{
|
|
|
|
from: '@kbn/test/types/ftr',
|
|
|
|
to: '@kbn/test',
|
|
|
|
disallowedMessage: `import from the root of @kbn/test instead`
|
|
|
|
},
|
2021-06-24 16:52:55 +02:00
|
|
|
{
|
|
|
|
from: 'react-intl',
|
|
|
|
to: '@kbn/i18n/react',
|
|
|
|
disallowedMessage: `import from @kbn/i18n/react instead`
|
2021-07-09 20:42:50 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
from: 'styled-components',
|
|
|
|
to: false,
|
|
|
|
exclude: USES_STYLED_COMPONENTS,
|
|
|
|
disallowedMessage: `Prefer using @emotion/react instead. To use styled-components, ensure you plugin is enabled in @kbn/dev-utils/src/babel.ts.`
|
|
|
|
},
|
2019-04-05 18:45:23 +02:00
|
|
|
],
|
2019-12-14 23:17:59 +01:00
|
|
|
],
|
2021-08-31 23:54:13 +02:00
|
|
|
|
|
|
|
'@kbn/eslint/no_async_promise_body': 'error',
|
2021-09-14 22:20:53 +02:00
|
|
|
'@kbn/eslint/no_async_foreach': 'error',
|
2021-09-30 19:02:56 +02:00
|
|
|
'@kbn/eslint/no_trailing_import_slash': 'error',
|
2019-12-14 23:17:59 +01:00
|
|
|
},
|
2019-04-05 18:45:23 +02:00
|
|
|
};
|