Skip to content

Commit

Permalink
perf: avoid duplicate linting when used with eslint-loader
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed May 19, 2018
1 parent aec11fc commit 3d07f81
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/loaders/pitcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,15 @@ module.exports = code => code
// and transform it into appropriate requests.
module.exports.pitch = function (remainingRequest) {
const query = qs.parse(this.resourceQuery.slice(1))
const loaders = this.loaders.slice(1) // remove self

// if this is a language block request, remove eslint-loader to avoid
// duplicate linting.
const loaders = query.type
? this.loaders.filter(l => !/(\/|\\|@)eslint-loader/.test(l.path))
: this.loaders

// remove self
loaders.shift()

// do not inject if user uses null-loader to void the type (#1239)
if (loaders.some(l => /(\/|\\|@)null-loader/.test(l.path))) {
Expand Down

0 comments on commit 3d07f81

Please sign in to comment.