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

Commit 8715112

Browse files
authored
Fix eslint plugin installation in packing (#983)
1 parent ad89b18 commit 8715112

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

scripts/pack.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ if (options.help || Object.keys(options).length === 0) {
6161

6262
if (options.lint) {
6363
// Check lint deps
64-
const lintDeps = ['eslint'];
64+
const lintDeps = ['eslint', 'eslint-config-google'];
6565
console.log('Checking lint dependencies...');
66-
const npmRoot = execSync(`npm root -g`).toString().trim();
66+
const npmRoot = execSync(`npm root`).toString().trim();
6767
const missingLintDeps = lintDeps.filter((dep) => {
6868
return !fs.existsSync(path.join(npmRoot, dep));
6969
});
@@ -72,8 +72,9 @@ if (options.lint) {
7272
console.log('Lint dependencies OK.');
7373
} else {
7474
for (const dep of missingLintDeps) {
75-
console.log('Installing eslint');
76-
execSync(`npm install eslint --global --save-dev`);
75+
console.log('Installing missing eslint deps');
76+
chdir(rootDir);
77+
execSync(`npm install --save-dev ${dep}`);
7778
}
7879
}
7980
}
@@ -263,7 +264,7 @@ function packCommon(target) {
263264
const extname = path.extname(filePath);
264265
if (options.lint && extname === '.js') {
265266
try {
266-
execSync(`eslint -c ${rootDir}/source/.eslintrc.json ${filePath}`);
267+
execSync(`${rootDir}/node_modules/.bin/eslint -c ${rootDir}/source/.eslintrc.json ${filePath}`);
267268
} catch(error) {
268269
console.error(error.stdout.toString());
269270
}

0 commit comments

Comments
 (0)