This repository was archived by the owner on Sep 28, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +20
-6
lines changed Expand file tree Collapse file tree 1 file changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -160,21 +160,35 @@ module.exports = function(input, map) {
160160 loaderUtils . getOptions ( webpack )
161161 ) ;
162162
163- var userEslintPath = userOptions . eslintPath ;
164-
165163 var eslintPkgPath = "eslint/package.json" ;
166- if ( userEslintPath ) {
167- eslintPkgPath = userEslintPath + "/package.json" ;
164+ var userEslintPath = eslintPkgPath ;
165+
166+ if ( userOptions . eslintPath ) {
167+ userEslintPath = userOptions . eslintPath + "/package.json" ;
168+ }
169+
170+ var eslintVersion ;
171+
172+ try {
173+ eslintVersion = require ( require . resolve ( userEslintPath ) ) . version ;
174+ } catch ( _ ) {
175+ // ignored
168176 }
169177
170- var eslintVersion = require ( eslintPkgPath ) . version ;
178+ if ( ! eslintVersion ) {
179+ try {
180+ eslintVersion = require ( require . resolve ( eslintPkgPath ) ) . version ;
181+ } catch ( _ ) {
182+ // ignored
183+ }
184+ }
171185
172186 var config = assign (
173187 // loader defaults
174188 {
175189 cacheIdentifier : JSON . stringify ( {
176190 "eslint-loader" : pkg . version ,
177- eslint : eslintVersion
191+ eslint : eslintVersion || "unknown version"
178192 } ) ,
179193 eslintPath : "eslint"
180194 } ,
You can’t perform that action at this time.
0 commit comments