mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[eslint] automatically determine dev packages (#127089)
* [eslint] automatically determine dev packages * remove old eslint overrides that are not needed anymore
This commit is contained in:
parent
0a06242647
commit
1f514d7c00
20 changed files with 29 additions and 34 deletions
30
.eslintrc.js
30
.eslintrc.js
|
@ -6,6 +6,11 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
const Path = require('path');
|
||||
const Fs = require('fs');
|
||||
|
||||
const globby = require('globby');
|
||||
|
||||
const APACHE_2_0_LICENSE_HEADER = `
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
|
@ -89,23 +94,16 @@ const SAFER_LODASH_SET_DEFINITELYTYPED_HEADER = `
|
|||
*/
|
||||
`;
|
||||
|
||||
const packagePkgJsons = globby.sync('*/package.json', {
|
||||
cwd: Path.resolve(__dirname, 'packages'),
|
||||
absolute: true,
|
||||
});
|
||||
|
||||
/** Packages which should not be included within production code. */
|
||||
const DEV_PACKAGES = [
|
||||
'kbn-babel-code-parser',
|
||||
'kbn-dev-utils',
|
||||
'kbn-cli-dev-mode',
|
||||
'kbn-docs-utils',
|
||||
'kbn-es*',
|
||||
'kbn-eslint*',
|
||||
'kbn-optimizer',
|
||||
'kbn-plugin-generator',
|
||||
'kbn-plugin-helpers',
|
||||
'kbn-pm',
|
||||
'kbn-storybook',
|
||||
'kbn-telemetry-tools',
|
||||
'kbn-test',
|
||||
'kbn-type-summarizer',
|
||||
];
|
||||
const DEV_PACKAGES = packagePkgJsons.flatMap((path) => {
|
||||
const pkg = JSON.parse(Fs.readFileSync(path, 'utf8'));
|
||||
return pkg.kibana && pkg.kibana.devOnly ? Path.dirname(Path.basename(path)) : [];
|
||||
});
|
||||
|
||||
/** Directories (at any depth) which include dev-only code. */
|
||||
const DEV_DIRECTORIES = [
|
||||
|
|
|
@ -8,5 +8,8 @@
|
|||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/elastic/kibana/tree/main/packages/kbn-babel-code-parser"
|
||||
},
|
||||
"kibana": {
|
||||
"devOnly": true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,5 +3,8 @@
|
|||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"license": "SSPL-1.0 OR Elastic License 2.0",
|
||||
"main": "./target_node/index.js"
|
||||
"main": "./target_node/index.js",
|
||||
"kibana": {
|
||||
"devOnly": true
|
||||
}
|
||||
}
|
|
@ -3,5 +3,8 @@
|
|||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"license": "SSPL-1.0 OR Elastic License 2.0",
|
||||
"main": "target_node/index.js"
|
||||
"main": "target_node/index.js",
|
||||
"kibana": {
|
||||
"devOnly": true
|
||||
}
|
||||
}
|
|
@ -14,7 +14,6 @@
|
|||
*/
|
||||
|
||||
import { I18nProvider, InjectedIntl, intlShape, __IntlProvider } from '@kbn/i18n-react';
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
import { mount, ReactWrapper, render, shallow } from 'enzyme';
|
||||
import React, { ReactElement, ValidationMap } from 'react';
|
||||
import { act as reactAct } from 'react-dom/test-utils';
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
import { ReactWrapper } from 'enzyme';
|
||||
|
||||
type Matcher = '=' | '~=' | '|=' | '^=' | '$=' | '*=';
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
import Chance from 'chance';
|
||||
|
||||
const chance = new Chance();
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
import React, { ComponentType } from 'react';
|
||||
import { Store } from 'redux';
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
import { ReactWrapper } from 'enzyme';
|
||||
import { act } from 'react-dom/test-utils';
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
*/
|
||||
|
||||
import { Component as ReactComponent } from 'react';
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
import { ComponentType, HTMLAttributes, ReactWrapper } from 'enzyme';
|
||||
|
||||
import { findTestSubject } from '../find_test_subject';
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
*/
|
||||
|
||||
import { Store } from 'redux';
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
import { ReactWrapper as GenericReactWrapper } from 'enzyme';
|
||||
import { LocationDescriptor } from 'history';
|
||||
|
||||
|
|
|
@ -3,5 +3,8 @@
|
|||
"version": "1.0.0",
|
||||
"license": "SSPL-1.0 OR Elastic License 2.0",
|
||||
"main": "./target_node/index.js",
|
||||
"private": true
|
||||
"private": true,
|
||||
"kibana": {
|
||||
"devOnly": true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
import { expectType } from 'tsd';
|
||||
import { MethodKeysOf } from '../..';
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
import { expectType } from 'tsd';
|
||||
import { PublicContract } from '../..';
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
import { expectType } from 'tsd';
|
||||
import { PublicKeys } from '../..';
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
import { expectAssignable, expectNotAssignable } from 'tsd';
|
||||
import { PublicMethodsOf } from '../..';
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
import { expectType } from 'tsd';
|
||||
import { ShallowPromise } from '../..';
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
import { expectAssignable } from 'tsd';
|
||||
import { UnionToIntersection } from '../..';
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
import { expectAssignable } from 'tsd';
|
||||
import { UnwrapObservable, ObservableLike } from '../..';
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
import { expectAssignable } from 'tsd';
|
||||
import { Values } from '../..';
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
import { expectAssignable } from 'tsd';
|
||||
import { Writable } from '../..';
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue