forked from exercism/javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlint
executable file
·45 lines (36 loc) · 1.12 KB
/
lint
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
#!/usr/bin/env node
/**
* Run this script (from root directory): npx babel-node scripts/lint
*
* This runs `eslint` on all sample solutions (and test) files
*/
const shell = require('shelljs');
const {
registerExitHandler,
prepareAndRun,
assignments: exercises,
shouldPrepare,
} = require('./helpers');
registerExitHandler();
const assignment = exercises.length === 0 ? exercises[0] : undefined;
// Prepare exercises and cleanup afterwards
shell.env['PREPARE'] =
shell.env['PREPARE'] === undefined || shell.env['PREPARE'];
shell.env['CLEANUP'] =
shell.env['CLEANUP'] === undefined || shell.env['CLEANUP'];
const count = shouldPrepare() ? exercises.length : 'all';
const infoStr = assignment
? `Running lint for ${assignment}...`
: `Running lint for ${count} exercises...`;
const failureStr = '[Failure] Lint check failed!';
// Run lint all at once
prepareAndRun(
'npx eslint tmp_exercises -c node_modules/@exercism/eslint-config-javascript/maintainers.js',
infoStr,
failureStr
);
shell.echo(
assignment
? `[Success] Lint passed for ${assignment}`
: `[Success] Lint passed for ${count} exercises`
);