Skip to content
This repository was archived by the owner on Oct 23, 2024. It is now read-only.

Commit 41d1a47

Browse files
committed
Add eslint in packing process
1 parent 58c2a81 commit 41d1a47

File tree

1 file changed

+5
-18
lines changed

1 file changed

+5
-18
lines changed

scripts/pack.js

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -258,29 +258,16 @@ function packCommon(target) {
258258
}
259259
}
260260
if (common.files) {
261-
let eslint;
262-
if (options.lint) {
263-
const { ESLint } = require('eslint');
264-
eslint = new ESLint({ overrideConfigFile: `${rootDir}/source/.eslintrc.json` });
265-
}
266261
// Copy common files
267262
for (const file of common.files) {
268263
const filePath = path.join(packSrc, file);
269264
const extname = path.extname(filePath);
270265
if (options.lint && extname === '.js') {
271-
eslint.lintFiles(filePath)
272-
.then((results) => {
273-
eslint.loadFormatter('stylish')
274-
.then((formatter) => {
275-
console.log(formatter.format(results));
276-
})
277-
.catch((err) => {
278-
console.log(err);
279-
})
280-
})
281-
.catch((err) => {
282-
console.log(err);
283-
})
266+
try {
267+
execSync(`eslint -c ${rootDir}/source/.eslintrc.json ${filePath}`);
268+
} catch(error) {
269+
console.error(error.stdout.toString());
270+
}
284271
}
285272
execSync(`cp -a ${filePath} ${packDist}`);
286273
}

0 commit comments

Comments
 (0)