Skip to content

Commit ce1fa37

Browse files
committed
fix(lint): 修复jsx没有被lint
1 parent 040b519 commit ce1fa37

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/models/Config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class Config {
4646
},
4747
entryExtNames: {
4848
css: ['.css'],
49-
js: []
49+
js: ['.js']
5050
},
5151
requireRules: [
5252
'node_modules|package.json:main|index.js'

src/models/Project.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,14 @@ class Project {
145145
warn('Lint JS Files ......');
146146
this.eslintConfig.useEslintrc = false;
147147

148-
const jsPath = sysPath.join(this.config._config.context, '/**/*.js'),
149-
cli = new CLIEngine(this.eslintConfig),
148+
const jsExtNames = this.config._config.entryExtNames.js,
149+
jsLintPath = jsExtNames.map((jsExt) => {
150+
return sysPath.join(this.config._config.context, '/**/*' + jsExt)
151+
});
152+
153+
const cli = new CLIEngine(this.eslintConfig),
150154
report = cli.executeOnFiles(
151-
globby.sync(jsPath, {
155+
globby.sync(jsLintPath, {
152156
cwd: this.cwd
153157
})
154158
.filter(

0 commit comments

Comments
 (0)