[generate/package] run ESLint and auto-fix generated files (#130676)

This commit is contained in:
Spencer 2022-04-20 10:36:20 -05:00 committed by GitHub
parent 7df6a0dad5
commit 37bfb50663
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -11,6 +11,7 @@ import Path from 'path';
import normalizePath from 'normalize-path';
import globby from 'globby';
import { ESLint } from 'eslint';
import micromatch from 'micromatch';
import { REPO_ROOT } from '@kbn/utils';
@ -129,6 +130,15 @@ ${BAZEL_PACKAGE_DIRS.map((dir) => ` ./${dir}/*\n`).join
log.info('Wrote plugin files to', packageDir);
log.info('Linting files');
const eslint = new ESLint({
cache: false,
cwd: REPO_ROOT,
fix: true,
extensions: ['.js', '.mjs', '.ts', '.tsx'],
});
await ESLint.outputFixes(await eslint.lintFiles([packageDir]));
const packageJsonPath = Path.resolve(REPO_ROOT, 'package.json');
const packageJson = JSON.parse(await Fsp.readFile(packageJsonPath, 'utf8'));