Skip to content

Commit

Permalink
cleanup(linter): remove unused basePath parameter (#28549)
Browse files Browse the repository at this point in the history
<!-- 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
  • Loading branch information
MJez29 authored Nov 14, 2024
1 parent 08953af commit 1163eb5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
6 changes: 2 additions & 4 deletions packages/eslint-plugin/src/rules/enforce-module-boundaries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,7 @@ export default ESLintUtils.RuleCreator(
for (const importMember of imports) {
const importPath = getRelativeImportPath(
importMember,
join(workspaceRoot, entryPointPath.path),
sourceProject.data.sourceRoot
join(workspaceRoot, entryPointPath.path)
);
// we cannot remap, so leave it as is
if (importPath) {
Expand Down Expand Up @@ -444,8 +443,7 @@ export default ESLintUtils.RuleCreator(
for (const importMember of imports) {
const importPath = getRelativeImportPath(
importMember,
join(workspaceRoot, entryPointPath),
sourceProject.data.sourceRoot
join(workspaceRoot, entryPointPath)
);
if (importPath) {
// resolve the import path
Expand Down
5 changes: 2 additions & 3 deletions packages/eslint-plugin/src/utils/ast-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function hasMemberExport(exportedMember, filePath) {
);
}

export function getRelativeImportPath(exportedMember, filePath, basePath) {
export function getRelativeImportPath(exportedMember, filePath) {
const status = lstatSync(filePath, {
throwIfNoEntry: false,
});
Expand Down Expand Up @@ -273,8 +273,7 @@ export function getRelativeImportPath(exportedMember, filePath, basePath) {
if (hasMemberExport(exportedMember, moduleFilePath)) {
const foundFilePath = getRelativeImportPath(
exportedMember,
moduleFilePath,
basePath
moduleFilePath
);
if (foundFilePath) {
return foundFilePath;
Expand Down

0 comments on commit 1163eb5

Please sign in to comment.