Skip to content

Commit a9c60ee

Browse files
committed
fix(eslint): 修复找不到全局eslint报错
1 parent 9f62a88 commit a9c60ee

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/models/Project.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ var Project = function () {
239239
var CLIEngine = require('eslint').CLIEngine;
240240

241241
// 如果有本地eslint优先使用本地eslint
242-
if (requireg(sysPath.join(this.cwd, 'node_modules/', 'eslint'))) {
242+
if (requireg.resolve(sysPath.join(this.cwd, 'node_modules/', 'eslint'))) {
243243
CLIEngine = requireg(sysPath.join(this.cwd, 'node_modules/', 'eslint')).CLIEngine;
244244
}
245245

src/models/Project.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ class Project {
212212
let CLIEngine = require('eslint').CLIEngine;
213213

214214
// 如果有本地eslint优先使用本地eslint
215-
if(requireg(sysPath.join(this.cwd, 'node_modules/', 'eslint'))){
215+
if(requireg.resolve(sysPath.join(this.cwd, 'node_modules/', 'eslint'))){
216216
CLIEngine = requireg(sysPath.join(this.cwd, 'node_modules/', 'eslint')).CLIEngine
217217
}
218218

0 commit comments

Comments
 (0)