eslint-loader
Advanced tools
Comparing version 1.6.2 to 1.6.3
@@ -0,1 +1,6 @@ | ||
# 1.6.3 - 2017-02-22 | ||
- Fixed: ignore cache when eslint rules have changed | ||
([#151](https://github.com/MoOx/eslint-loader/pull/151) - @wrakky) | ||
# 1.6.2 - 2017-02-22 | ||
@@ -2,0 +7,0 @@ |
21
index.js
@@ -11,2 +11,3 @@ var eslint = require("eslint") | ||
var engines = {} | ||
var rules = {} | ||
var cache = null | ||
@@ -33,2 +34,7 @@ var cachePath = null | ||
// get engine | ||
var configHash = objectHash(config) | ||
var engine = engines[configHash] | ||
var rulesHash = rules[configHash] | ||
var res | ||
@@ -38,4 +44,13 @@ // If cache is enable and the data are the same as in the cache, just | ||
if (config.cache) { | ||
// just get rules hash once per engine for performance reasons | ||
if (!rulesHash) { | ||
rulesHash = objectHash(engine.getConfigForFile(resourcePath)) | ||
rules[configHash] = rulesHash | ||
} | ||
var inputMD5 = crypto.createHash("md5").update(input).digest("hex") | ||
if (cache[resourcePath] && cache[resourcePath].hash === inputMD5) { | ||
if ( | ||
cache[resourcePath] && | ||
cache[resourcePath].hash === inputMD5 && | ||
cache[resourcePath].rules === rulesHash | ||
) { | ||
res = cache[resourcePath].res | ||
@@ -47,4 +62,3 @@ } | ||
if (!res) { | ||
var configHash = objectHash(config) | ||
res = engines[configHash].executeOnText(input, resourcePath, true) | ||
res = engine.executeOnText(input, resourcePath, true) | ||
@@ -55,2 +69,3 @@ // Save new results in the cache | ||
hash: inputMD5, | ||
rules: rulesHash, | ||
res: res, | ||
@@ -57,0 +72,0 @@ } |
{ | ||
"name": "eslint-loader", | ||
"version": "1.6.2", | ||
"version": "1.6.3", | ||
"description": "eslint loader (for webpack)", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18451
180