Skip to content

Commit b25a03e

Browse files
MJez29FrozenPandaz
authored andcommitted
cleanup(linter): remove unused basePath parameter (#28549)
<!-- Please make sure you have read the submission guidelines before posting an PR --> <!-- https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr --> <!-- Please make sure that your commit message follows our format --> <!-- Example: `fix(nx): must begin with lowercase` --> <!-- If this is a particularly complex change or feature addition, you can request a dedicated Nx release for this pull request branch. Mention someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they will confirm if the PR warrants its own release for testing purposes, and generate it for you if appropriate. --> I was looking at the source to understand how `sourceRoot` is used and saw it was referenced in the eslint-plugin but it turns out it isn't actually used ## Current Behavior This parameter isn't used ## Expected Behavior The parameter should be removed (cherry picked from commit 1163eb5)
1 parent 9ef43f6 commit b25a03e

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

packages/eslint-plugin/src/rules/enforce-module-boundaries.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,7 @@ export default ESLintUtils.RuleCreator(
337337
for (const importMember of imports) {
338338
const importPath = getRelativeImportPath(
339339
importMember,
340-
join(workspaceRoot, entryPointPath.path),
341-
sourceProject.data.sourceRoot
340+
join(workspaceRoot, entryPointPath.path)
342341
);
343342
// we cannot remap, so leave it as is
344343
if (importPath) {
@@ -444,8 +443,7 @@ export default ESLintUtils.RuleCreator(
444443
for (const importMember of imports) {
445444
const importPath = getRelativeImportPath(
446445
importMember,
447-
join(workspaceRoot, entryPointPath),
448-
sourceProject.data.sourceRoot
446+
join(workspaceRoot, entryPointPath)
449447
);
450448
if (importPath) {
451449
// resolve the import path

packages/eslint-plugin/src/utils/ast-utils.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ function hasMemberExport(exportedMember, filePath) {
108108
);
109109
}
110110

111-
export function getRelativeImportPath(exportedMember, filePath, basePath) {
111+
export function getRelativeImportPath(exportedMember, filePath) {
112112
const status = lstatSync(filePath, {
113113
throwIfNoEntry: false,
114114
});
@@ -273,8 +273,7 @@ export function getRelativeImportPath(exportedMember, filePath, basePath) {
273273
if (hasMemberExport(exportedMember, moduleFilePath)) {
274274
const foundFilePath = getRelativeImportPath(
275275
exportedMember,
276-
moduleFilePath,
277-
basePath
276+
moduleFilePath
278277
);
279278
if (foundFilePath) {
280279
return foundFilePath;

0 commit comments

Comments
 (0)