eslint-import-resolver-typescript
Advanced tools
Comparing version 2.3.0 to 2.4.0
@@ -5,2 +5,15 @@ # Changelog | ||
## [2.4.0](https://github.com/alexgorbatchev/eslint-import-resolver-typescript/compare/v2.3.0...v2.4.0) (2021-02-16) | ||
### Features | ||
* remove any querystring from imports ([#67](https://github.com/alexgorbatchev/eslint-import-resolver-typescript/issues/67)) ([82ef357](https://github.com/alexgorbatchev/eslint-import-resolver-typescript/commit/82ef3573fa1258e0de8d8181de57ae7109e35ec5)) | ||
### Bug Fixes | ||
* remove .tsbuildinfo and d.ts.map files from package ([#57](https://github.com/alexgorbatchev/eslint-import-resolver-typescript/issues/57)) ([15f2849](https://github.com/alexgorbatchev/eslint-import-resolver-typescript/commit/15f2849c49bf1b4eb7719f027c61ca48b6e1f2a2)) | ||
* remove redundant condition ([#69](https://github.com/alexgorbatchev/eslint-import-resolver-typescript/issues/69)) ([ba62e65](https://github.com/alexgorbatchev/eslint-import-resolver-typescript/commit/ba62e65e7cfe382ff976238de3f100cd41c73e8f)) | ||
## [2.3.0](https://github.com/alexgorbatchev/eslint-import-resolver-typescript/compare/v2.2.1...v2.3.0) (2020-09-01) | ||
@@ -7,0 +20,0 @@ |
@@ -51,2 +51,3 @@ 'use strict'; | ||
log('looking for:', source); | ||
source = removeQuerystring(source); | ||
// don't worry about core node modules | ||
@@ -61,3 +62,3 @@ if (resolve$1.isCore(source)) { | ||
initMappers(options); | ||
var mappedPath = getMappedPath(source, file); | ||
var mappedPath = getMappedPath(source); | ||
if (mappedPath) { | ||
@@ -123,2 +124,10 @@ log('matched ts path:', mappedPath); | ||
} | ||
/** Remove any trailing querystring from module id. */ | ||
function removeQuerystring(id) { | ||
var querystringIndex = id.lastIndexOf('?'); | ||
if (querystringIndex >= 0) { | ||
return id.slice(0, querystringIndex); | ||
} | ||
return id; | ||
} | ||
/** Remove .js or .jsx extension from module id. */ | ||
@@ -135,6 +144,4 @@ function removeJsExtension(id) { | ||
*/ | ||
function getMappedPath(source, file) { | ||
var paths = mappers | ||
.map(function (mapper) { return mapper(source, file); }) | ||
.filter(function (path) { return !!path; }); | ||
function getMappedPath(source) { | ||
var paths = mappers.map(function (mapper) { return mapper(source); }).filter(function (path) { return !!path; }); | ||
if (paths.length > 1) { | ||
@@ -193,7 +200,3 @@ log('found multiple matching ts paths:', paths); | ||
var matchPath = createExtendedMatchPath(configLoaderResult.absoluteBaseUrl, configLoaderResult.paths); | ||
return function (source, file) { | ||
// exclude files that are not part of the config base url | ||
if (!file.includes(configLoaderResult.absoluteBaseUrl)) { | ||
return; | ||
} | ||
return function (source) { | ||
// look for files based on setup tsconfig "paths" | ||
@@ -200,0 +203,0 @@ return matchPath(source, undefined, undefined, options.extensions || defaultExtensions); |
@@ -22,2 +22,3 @@ import path from 'path'; | ||
log('looking for:', source); | ||
source = removeQuerystring(source); | ||
// don't worry about core node modules | ||
@@ -32,3 +33,3 @@ if (isCore(source)) { | ||
initMappers(options); | ||
const mappedPath = getMappedPath(source, file); | ||
const mappedPath = getMappedPath(source); | ||
if (mappedPath) { | ||
@@ -94,2 +95,10 @@ log('matched ts path:', mappedPath); | ||
} | ||
/** Remove any trailing querystring from module id. */ | ||
function removeQuerystring(id) { | ||
const querystringIndex = id.lastIndexOf('?'); | ||
if (querystringIndex >= 0) { | ||
return id.slice(0, querystringIndex); | ||
} | ||
return id; | ||
} | ||
/** Remove .js or .jsx extension from module id. */ | ||
@@ -106,6 +115,4 @@ function removeJsExtension(id) { | ||
*/ | ||
function getMappedPath(source, file) { | ||
const paths = mappers | ||
.map(mapper => mapper(source, file)) | ||
.filter(path => !!path); | ||
function getMappedPath(source) { | ||
const paths = mappers.map(mapper => mapper(source)).filter(path => !!path); | ||
if (paths.length > 1) { | ||
@@ -156,7 +163,3 @@ log('found multiple matching ts paths:', paths); | ||
const matchPath = createExtendedMatchPath(configLoaderResult.absoluteBaseUrl, configLoaderResult.paths); | ||
return (source, file) => { | ||
// exclude files that are not part of the config base url | ||
if (!file.includes(configLoaderResult.absoluteBaseUrl)) { | ||
return; | ||
} | ||
return (source) => { | ||
// look for files based on setup tsconfig "paths" | ||
@@ -163,0 +166,0 @@ return matchPath(source, undefined, undefined, options.extensions || defaultExtensions); |
@@ -45,2 +45,3 @@ import path from 'path'; | ||
log('looking for:', source); | ||
source = removeQuerystring(source); | ||
// don't worry about core node modules | ||
@@ -55,3 +56,3 @@ if (isCore(source)) { | ||
initMappers(options); | ||
var mappedPath = getMappedPath(source, file); | ||
var mappedPath = getMappedPath(source); | ||
if (mappedPath) { | ||
@@ -117,2 +118,10 @@ log('matched ts path:', mappedPath); | ||
} | ||
/** Remove any trailing querystring from module id. */ | ||
function removeQuerystring(id) { | ||
var querystringIndex = id.lastIndexOf('?'); | ||
if (querystringIndex >= 0) { | ||
return id.slice(0, querystringIndex); | ||
} | ||
return id; | ||
} | ||
/** Remove .js or .jsx extension from module id. */ | ||
@@ -129,6 +138,4 @@ function removeJsExtension(id) { | ||
*/ | ||
function getMappedPath(source, file) { | ||
var paths = mappers | ||
.map(function (mapper) { return mapper(source, file); }) | ||
.filter(function (path) { return !!path; }); | ||
function getMappedPath(source) { | ||
var paths = mappers.map(function (mapper) { return mapper(source); }).filter(function (path) { return !!path; }); | ||
if (paths.length > 1) { | ||
@@ -187,7 +194,3 @@ log('found multiple matching ts paths:', paths); | ||
var matchPath = createExtendedMatchPath(configLoaderResult.absoluteBaseUrl, configLoaderResult.paths); | ||
return function (source, file) { | ||
// exclude files that are not part of the config base url | ||
if (!file.includes(configLoaderResult.absoluteBaseUrl)) { | ||
return; | ||
} | ||
return function (source) { | ||
// look for files based on setup tsconfig "paths" | ||
@@ -194,0 +197,0 @@ return matchPath(source, undefined, undefined, options.extensions || defaultExtensions); |
@@ -22,2 +22,3 @@ import { __spreadArrays } from "tslib"; | ||
log('looking for:', source); | ||
source = removeQuerystring(source); | ||
// don't worry about core node modules | ||
@@ -32,3 +33,3 @@ if (isCore(source)) { | ||
initMappers(options); | ||
var mappedPath = getMappedPath(source, file); | ||
var mappedPath = getMappedPath(source); | ||
if (mappedPath) { | ||
@@ -94,2 +95,10 @@ log('matched ts path:', mappedPath); | ||
} | ||
/** Remove any trailing querystring from module id. */ | ||
function removeQuerystring(id) { | ||
var querystringIndex = id.lastIndexOf('?'); | ||
if (querystringIndex >= 0) { | ||
return id.slice(0, querystringIndex); | ||
} | ||
return id; | ||
} | ||
/** Remove .js or .jsx extension from module id. */ | ||
@@ -106,6 +115,4 @@ function removeJsExtension(id) { | ||
*/ | ||
function getMappedPath(source, file) { | ||
var paths = mappers | ||
.map(function (mapper) { return mapper(source, file); }) | ||
.filter(function (path) { return !!path; }); | ||
function getMappedPath(source) { | ||
var paths = mappers.map(function (mapper) { return mapper(source); }).filter(function (path) { return !!path; }); | ||
if (paths.length > 1) { | ||
@@ -164,7 +171,3 @@ log('found multiple matching ts paths:', paths); | ||
var matchPath = createExtendedMatchPath(configLoaderResult.absoluteBaseUrl, configLoaderResult.paths); | ||
return function (source, file) { | ||
// exclude files that are not part of the config base url | ||
if (!file.includes(configLoaderResult.absoluteBaseUrl)) { | ||
return; | ||
} | ||
return function (source) { | ||
// look for files based on setup tsconfig "paths" | ||
@@ -171,0 +174,0 @@ return matchPath(source, undefined, undefined, options.extensions || defaultExtensions); |
{ | ||
"name": "eslint-import-resolver-typescript", | ||
"version": "2.3.0", | ||
"version": "2.4.0", | ||
"description": "TypeScript .ts .tsx module resolver for `eslint-plugin-import`.", | ||
@@ -20,3 +20,3 @@ "repository": "https://github.com/alexgorbatchev/eslint-import-resolver-typescript", | ||
"files": [ | ||
"lib" | ||
"lib/*.{js,js.map,d.ts}" | ||
], | ||
@@ -46,2 +46,4 @@ "keywords": [ | ||
"test:withPaths": "eslint --ext ts,tsx tests/withPaths", | ||
"test:withPathsAndNestedBaseUrl": "eslint --ext ts,tsx tests/withPathsAndNestedBaseUrl", | ||
"test:withQuerystring": "eslint --ext ts,tsx tests/withQuerystring", | ||
"test:withoutPaths": "eslint --ext ts,tsx tests/withoutPaths", | ||
@@ -48,0 +50,0 @@ "type-coverage": "type-coverage --cache --detail --ignore-catch --strict --update" |
@@ -65,29 +65,22 @@ # eslint-import-resolver-typescript | ||
"import/resolver": { | ||
// use <root>/tsconfig.json | ||
"typescript": { | ||
"alwaysTryTypes": true // always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/unist` | ||
}, | ||
"alwaysTryTypes": true, // always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/unist` | ||
// use <root>/path/to/folder/tsconfig.json | ||
"typescript": { | ||
"project": "path/to/folder" | ||
}, | ||
// Choose from one of the "project" configs below or omit to use <root>/tsconfig.json by default | ||
// Multiple tsconfigs (Useful for monorepos) | ||
// use <root>/path/to/folder/tsconfig.json | ||
"project": "path/to/folder", | ||
// use a glob pattern | ||
"typescript": { | ||
"project": "packages/*/tsconfig.json" | ||
}, | ||
// Multiple tsconfigs (Useful for monorepos) | ||
// use an array | ||
"typescript": { | ||
// use a glob pattern | ||
"project": "packages/*/tsconfig.json", | ||
// use an array | ||
"project": [ | ||
"packages/module-a/tsconfig.json", | ||
"packages/module-b/tsconfig.json" | ||
] | ||
}, | ||
], | ||
// use an array of glob patterns | ||
"typescript": { | ||
// use an array of glob patterns | ||
"project": [ | ||
@@ -94,0 +87,0 @@ "packages/*/tsconfig.json", |
Sorry, the diff of this file is not supported yet
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
830
48419
9
105