-
Notifications
You must be signed in to change notification settings - Fork 25
/
.eslint.js
37 lines (33 loc) · 925 Bytes
/
.eslint.js
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
// Vars
/**
* Application specific files to be tested via ESLint
* (use the glob pattern)
*/
const filesToTest = [
"*.js",
"'_other/**/*.js'",
"'js/**/*.js'"
];
const eslintBinPath = `./node_modules/.bin/eslint`;
const platformBinExtension = process.platform === 'win32' ? '.cmd' : '';
// RUN
function runExec(cmd, args) {
require('child_process').exec(
`${cmd}${platformBinExtension} ${args} --quiet`,
(err, stdout) => {
if (stdout) {
console.error(stdout);
process.exit(1);// failure error code
}
});
}
// Behavior depends on how the module is loaded
if (!module.parent) {
// RUN- if module is not required by an another one (e.g. called by node.js)
runExec(eslintBinPath, filesToTest.join(' '));
} else {
// EXPORT- if module is required by an another one
module.exports = {
filesToTest
};
}