mirror of
https://github.com/elastic/kibana.git
synced 2025-06-28 03:01:21 -04:00
[Lint] Officially deprecate Enzyme (#221779)
## Summary Please see for [context](https://docs.google.com/document/d/1J9mGfmGukgFS-6jqD1zopH8wIRvsqNhDhQbjQZ9hjEY/edit?tab=t.hzzf0a72f9gd) This PR tries to discourage usage of enzyme: - Mark shared test utils that use enzyme as `@deprecated` - Add eslint warning for imports of `enzyme` - Add ci stat counter of imports of `enzyme`
This commit is contained in:
parent
b4b49acb68
commit
0dbbf482a5
15 changed files with 175 additions and 11 deletions
|
@ -34,6 +34,7 @@ import { writeDeprecationDueByTeam } from './mdx/write_deprecations_due_by_team'
|
|||
import { trimDeletedDocsFromNav } from './trim_deleted_docs_from_nav';
|
||||
import { getAllDocFileIds } from './mdx/get_all_doc_file_ids';
|
||||
import { getPathsByPackage } from './get_paths_by_package';
|
||||
import { countEnzymeImports, EnzymeImportCounts } from './count_enzyme_imports';
|
||||
|
||||
function isStringArray(arr: unknown | string[]): arr is string[] {
|
||||
return Array.isArray(arr) && arr.every((p) => typeof p === 'string');
|
||||
|
@ -144,7 +145,9 @@ export function runBuildApiDocsCli() {
|
|||
|
||||
const reporter = CiStatsReporter.fromEnv(log);
|
||||
|
||||
const allPluginStats: { [key: string]: PluginMetaInfo & ApiStats & EslintDisableCounts } = {};
|
||||
const allPluginStats: {
|
||||
[key: string]: PluginMetaInfo & ApiStats & EslintDisableCounts & EnzymeImportCounts;
|
||||
} = {};
|
||||
for (const plugin of plugins) {
|
||||
const id = plugin.id;
|
||||
|
||||
|
@ -162,6 +165,7 @@ export function runBuildApiDocsCli() {
|
|||
|
||||
allPluginStats[id] = {
|
||||
...(await countEslintDisableLines(paths)),
|
||||
...(await countEnzymeImports(paths)),
|
||||
...collectApiStatsForPlugin(
|
||||
pluginApi,
|
||||
missingApiItems,
|
||||
|
@ -283,6 +287,12 @@ export function runBuildApiDocsCli() {
|
|||
group: 'Total ESLint disabled count',
|
||||
value: pluginStats.eslintDisableFileCount + pluginStats.eslintDisableLineCount,
|
||||
},
|
||||
{
|
||||
id,
|
||||
meta: { pluginTeam },
|
||||
group: 'Enzyme imports',
|
||||
value: pluginStats.enzymeImportCount,
|
||||
},
|
||||
]);
|
||||
|
||||
const getLink = (d: ApiDeclaration) =>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue