@dword-design/eslint-plugin-import-alias 8.1.1 → 8.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -25,7 +25,7 @@ const loadTsConfigPathsFromFile = (configPath, cwd, visitedConfigs = /* @__PURE_
|
|
|
25
25
|
paths = []
|
|
26
26
|
} = parsedConfig.options;
|
|
27
27
|
const projectReferences = parsedConfig.projectReferences ?? [];
|
|
28
|
-
const includePatterns = result.config.include ?? [
|
|
28
|
+
const includePatterns = result.config.include ?? [];
|
|
29
29
|
const configDir = pathLib.dirname(configPath);
|
|
30
30
|
const basePath = baseUrl ? pathLib.resolve(configDir, baseUrl) : configDir;
|
|
31
31
|
const aliases = Object.fromEntries(Object.entries(paths).map(([key, values]) => {
|
|
@@ -77,9 +77,9 @@ const findMatchingAlias = (sourcePath, currentFilename, options, {
|
|
|
77
77
|
cwd = "."
|
|
78
78
|
} = {}) => {
|
|
79
79
|
const absoluteSourcePath = pathLib.resolve(pathLib.dirname(currentFilename), sourcePath);
|
|
80
|
-
const matches = Object.entries(options.alias).flatMap(([aliasName, aliasInfos]) => aliasInfos.map(info => [aliasName, info])).filter(([, info]) => micromatch.isMatch(currentFilename, info.includePatterns, {
|
|
80
|
+
const matches = Object.entries(options.alias).flatMap(([aliasName, aliasInfos]) => aliasInfos.map(info => [aliasName, info])).filter(([, info]) => info.includePatterns.length > 0 ? micromatch.isMatch(pathLib.relative(info.configDir, currentFilename), info.includePatterns, {
|
|
81
81
|
cwd: info.configDir
|
|
82
|
-
})).map(([aliasName, info]) => {
|
|
82
|
+
}) : true).map(([aliasName, info]) => {
|
|
83
83
|
const path = pathLib.resolve(pathLib.dirname(currentFilename), options.resolvePath(`${aliasName}/`, currentFilename, {
|
|
84
84
|
alias: {
|
|
85
85
|
[aliasName]: info.path
|
|
@@ -104,7 +104,7 @@ const withNormalizedAliases = (options, {
|
|
|
104
104
|
...options,
|
|
105
105
|
alias: mapValues(options.alias, aliasPath => typeof aliasPath === "string" ? [{
|
|
106
106
|
configDir: cwd,
|
|
107
|
-
includePatterns: [
|
|
107
|
+
includePatterns: [],
|
|
108
108
|
path: aliasPath
|
|
109
109
|
}] : aliasPath)
|
|
110
110
|
});
|
|
@@ -166,9 +166,9 @@ export default createRule({
|
|
|
166
166
|
node
|
|
167
167
|
});
|
|
168
168
|
}
|
|
169
|
-
const filteredAliases = Object.fromEntries(Object.entries(options.alias).flatMap(([aliasName, aliasInfos]) => aliasInfos.map(info => [aliasName, info])).filter(([, info]) => micromatch.isMatch(context.filename, info.includePatterns, {
|
|
169
|
+
const filteredAliases = Object.fromEntries(Object.entries(options.alias).flatMap(([aliasName, aliasInfos]) => aliasInfos.map(info => [aliasName, info])).filter(([, info]) => info.includePatterns.length > 0 ? micromatch.isMatch(pathLib.relative(info.configDir, context.filename), info.includePatterns, {
|
|
170
170
|
cwd: info.configDir
|
|
171
|
-
})).map(([aliasName, info]) => [aliasName, info.path]));
|
|
171
|
+
}) : true).map(([aliasName, info]) => [aliasName, info.path]));
|
|
172
172
|
const importWithoutAlias = options.resolvePath(sourcePath, context.filename, {
|
|
173
173
|
alias: filteredAliases,
|
|
174
174
|
cwd: options.cwd
|