forked from elastic/elastic-charts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.ts
More file actions
52 lines (45 loc) · 1.67 KB
/
eslint.ts
File metadata and controls
52 lines (45 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { exec, yarnInstall } from '../../utils';
import { bkEnv, startGroup } from '../../utils/buildkite';
import { ChangeContext } from '../../utils/github';
void (async () => {
return;
const changes = new ChangeContext();
await changes.init();
const hasLintConfigChanges = changes.files.has([
'**/.eslintrc.js',
'**/.eslintignore',
'.prettierignore',
'.prettierrc.json',
'tsconfig.lint.json',
'tsconfig.json',
'package.json',
'yarn.lock',
]);
await yarnInstall();
// TODO: fix this to where we can install only the necessary packages in one script
await yarnInstall('e2e');
await yarnInstall('.buildkite');
// TODO: fix this to avoid requiring build to run linting
// currently the storybook and others are loosely coupled to @elastic/charts/src
// such that types point to the local source and not a packaged release
await exec('yarn build:ts');
if (bkEnv.isPullRequest && !hasLintConfigChanges) {
const filesToLint = changes.files.byType('DELETED', true).filter('**/*.ts?(x)');
if (filesToLint.length > 0) {
startGroup(`Running eslint checks - ${filesToLint.length} files`);
await exec('yarn lint:it', {
args: filesToLint.join(' '),
});
}
} else {
startGroup('Running eslint checks - all files');
await exec('yarn lint');
}
})();