-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
eslint-module-utils: Add tests for resolver versions
- Loading branch information
1 parent
17d2ee9
commit a0012f8
Showing
4 changed files
with
77 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
var path = require('path') | ||
|
||
exports.resolveImport = function (modulePath, sourceFile, config) { | ||
var fooPathSuffix = '/files/foo.js' | ||
var exceptionPathSuffix = '/files/exception.js' | ||
if (sourceFile.indexOf(fooPathSuffix) === sourceFile.length - fooPathSuffix.length) { | ||
return path.join(__dirname, 'bar.jsx') | ||
} | ||
else if (sourceFile.indexOf(exceptionPathSuffix) === sourceFile.length - exceptionPathSuffix.length) { | ||
throw new Error('foo-bar-resolver-v1 resolveImport test exception') | ||
} | ||
else { | ||
return undefined | ||
} | ||
} | ||
|
||
exports.interfaceVersion = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
var path = require('path') | ||
|
||
exports.resolve = function (modulePath, sourceFile, config) { | ||
var fooPathSuffix = '/files/foo.js' | ||
var exceptionPathSuffix = '/files/exception.js' | ||
if (sourceFile.indexOf(fooPathSuffix) === sourceFile.length - fooPathSuffix.length) { | ||
return { found: true, path: path.join(__dirname, 'bar.jsx') } | ||
} | ||
else if (sourceFile.indexOf(exceptionPathSuffix) === sourceFile.length - exceptionPathSuffix.length) { | ||
throw new Error('foo-bar-resolver-v2 resolve test exception') | ||
} | ||
else { | ||
return { found: false } | ||
} | ||
} | ||
|
||
exports.interfaceVersion = 2 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters