Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eslint ignores symbolic links to files when traversing directories #13615

Assignees
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly core Relates to ESLint's core APIs and features
Projects

Comments

@rtpg
Copy link

rtpg commented Aug 25, 2020

In the following code we have an .isFile check on a Dirent object

if (entry.isFile()) {

However the node documentation says the isFile check is for if the file is a regular file, and returns false on symbolic links.

This makes it hard to run eslint against sandboxed bazel files, for example (since the sandboxing happens through symlinks)

Not 100% sure what's best here but "not a directory" feels like a nicer check here than "is a regular file". Might be a bit impossible to resolve.

@eslint-deprecated eslint-deprecated bot added the triage An ESLint team member will look at this issue soon label Aug 25, 2020
@mdjermanovic mdjermanovic added bug ESLint is working incorrectly core Relates to ESLint's core APIs and features evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion and removed triage An ESLint team member will look at this issue soon labels Aug 25, 2020
@mdjermanovic
Copy link
Member

Hi @rtpg, thanks for the issue!

I think this is similar to #13551, but for files. Looks like a bug to me.

Until we verify and possibly fix this, a workaround (though an inconvenient one if you have multiple symlinked files) is to explicitly list those files as command-line arguments. For example:

 eslint src src/file1.js 

That way, the src/file1.js path will be checked here. statSafeSync(absolutePath).isFile() follows links and returns true if it is a file.

@eslint-deprecated eslint-deprecated bot added the auto closed The bot closed this issue label Sep 25, 2020
@eslint-deprecated
Copy link

Unfortunately, it looks like there wasn't enough interest from the team
or community to implement this change. While we wish we'd be able to
accommodate everyone's requests, we do need to prioritize. We've found
that issues failing to reach accepted status after 21 days tend to
never be accepted, and as such, we close those issues.
This doesn't mean the idea isn't interesting or useful, just that it's
not something the team can commit to.

Thanks for contributing to ESLint and we appreciate your understanding.

@mdjermanovic mdjermanovic removed the auto closed The bot closed this issue label Sep 25, 2020
@mdjermanovic mdjermanovic self-assigned this Sep 25, 2020
@mdjermanovic
Copy link
Member

Reopening as this is most likely a bug.

@mdjermanovic mdjermanovic reopened this Sep 25, 2020
@mdjermanovic mdjermanovic added accepted There is consensus among the team that this change meets the criteria for inclusion and removed evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels Dec 15, 2020
@blindspeed90
Copy link

I'm not a Linux expert but glob expansion didn't recurse and work for extensions (like "/myrootsrc/**/*.js"). Instead I used "find" for "js" files only, in case anyone else wants a workaround (and yes it can create a long cmdline, and I don't have spaces in paths):

ROOT_DIR=/myrootsrc

TODO: Hack 7.x ignoring symbolic links by finding the files ourselves and passing them in

ROOT_DIR=$(find $ROOT_DIR -name "*.js")
auditjs $AUDIT_OPTS $ROOT_DIR

@mrl5
Copy link

mrl5 commented Jan 28, 2021

I'm interested if there are any plans to fix this

@mdjermanovic mdjermanovic added this to Needs Triage in Triage via automation Feb 21, 2021
@mdjermanovic mdjermanovic moved this from Needs Triage to Pull Request Opened in Triage Feb 21, 2021
@mdjermanovic
Copy link
Member

Hi @mrl5! This will be fixed by #14126.

Triage automation moved this from Pull Request Opened to Complete Feb 26, 2021
mdjermanovic pushed a commit that referenced this issue Feb 26, 2021
…4126)

* Fix: do not ignore symbolic links (fixes #13551, fixes #13615)

* Fix: ignore broken symbolic links
@bidoubiwa
Copy link

Hey! This introduced a breaking change for me.

Oops! Something went wrong! :(

ESLint: 7.21.0

Error: ELOOP: too many symbolic links encountered,

This was referenced Mar 17, 2021
@eslint-github-bot eslint-github-bot bot locked and limited conversation to collaborators Aug 26, 2021
@eslint-github-bot eslint-github-bot bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Aug 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.