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

Fix: Support ENOTDIR error code in the folder existence checking utility #13973

Merged
merged 2 commits into from Feb 10, 2021

Conversation

constgen
Copy link
Contributor

@constgen constgen commented Jan 1, 2021

Prerequisites checklist

What is the purpose of this pull request? (put an "X" next to an item)

[ ] Documentation update
[x] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofixing to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:

What changes did you make? (Give an overview)

Add a condition to return false in directoryExists function if Node API returns ENOTDIR error

Is there anything you'd like reviewers to focus on?

Reproduced when special custom parsers were used: jsonc-eslint-parser together with eslint-plugin-markdown. Happened during linting of JSON code fragments in Markdown document when checking virtual file paths, e.g. directoryExists('C:\Projects\Projects_Compane\project_name\README.md\2_2.json')

More details can be found in this issue ota-meshi/eslint-plugin-jsonc#28

GitLab CI throws ENOTDIR instead of ENOENT. Add checking for this condition.
@eslint-deprecated eslint-deprecated bot added the triage An ESLint team member will look at this issue soon label Jan 1, 2021
@constgen
Copy link
Contributor Author

constgen commented Jan 2, 2021

I thought the issue can be reproduced only in GitLab CI. But recently found that it fails also in Travis CI. Here is a build log https://travis-ci.com/github/constgen/constgen-eslint

@mdjermanovic mdjermanovic added accepted There is consensus among the team that this change meets the criteria for inclusion bug ESLint is working incorrectly core Relates to ESLint's core APIs and features and removed triage An ESLint team member will look at this issue soon labels Jan 10, 2021
@mdjermanovic
Copy link
Member

Hi @constgen, thanks for the PR!

This is reproducible on our CI, too: https://github.com/eslint/eslint/pull/13997/checks?check_run_id=1675329847

Can be also manually reproduced when a virtual file path under an existing file is given to --print-config on Linux.

Can you add tests from #13997 to this PR?

@nzakas
Copy link
Member

nzakas commented Jan 28, 2021

@constgen are you still working on this?

@snitin315
Copy link
Contributor

I can help with the PR @constgen if you dont have bandwidth to work on it anymore. Just let me know 😀

@eslint-deprecated
Copy link

Hi @constgen!, thanks for the Pull Request

The pull request title isn't properly formatted. We ask that you update the message to match this format, as we use it to generate changelogs and automate releases.

  • The commit message tag must be one of the following:

    The Tag is one of the following:

    • Fix - for a bug fix.
    • Update - either for a backwards-compatible enhancement or for a rule change that adds reported problems.
    • New - implements a new feature.
    • Breaking - for a backwards-incompatible enhancement or feature.
    • Docs - changes to documentation only.
    • Build - changes to build process only.
    • Upgrade - for a dependency upgrade.
    • Chore - for anything that isn't user-facing (for example, refactoring, adding tests, etc.).

    You can use the labels of the issue you are working on to determine the best tag.

  • There should be a space following the initial tag and colon, for example 'New: Message'.

Read more about contributing to ESLint here

@constgen constgen changed the title Support ENOTDIR error code in checking folder existance utility function Fix: Support ENOTDIR error code in the utility folder existance checking function Jan 31, 2021
@eslint-deprecated
Copy link

Hi @constgen!, thanks for the Pull Request

The pull request title isn't properly formatted. We ask that you update the message to match this format, as we use it to generate changelogs and automate releases.

  • The length of the commit message must be less than or equal to 72

Read more about contributing to ESLint here

@constgen constgen changed the title Fix: Support ENOTDIR error code in the utility folder existance checking function Fix: Support ENOTDIR error code in the folder existance checking function Jan 31, 2021
@eslint-deprecated
Copy link

Hi @constgen!, thanks for the Pull Request

The pull request title isn't properly formatted. We ask that you update the message to match this format, as we use it to generate changelogs and automate releases.

  • The length of the commit message must be less than or equal to 72

Read more about contributing to ESLint here

@constgen constgen changed the title Fix: Support ENOTDIR error code in the folder existance checking function Fix: Support ENOTDIR error code in the folder existance checking utility Jan 31, 2021
@constgen
Copy link
Contributor Author

I have copy-pasted tests proposed by @mdjermanovic . Need a review.

Copy link
Contributor

@snitin315 snitin315 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@mdjermanovic mdjermanovic changed the title Fix: Support ENOTDIR error code in the folder existance checking utility Fix: Support ENOTDIR error code in the folder existence checking utility Feb 2, 2021
@mdjermanovic
Copy link
Member

Just fixed a typo existance -> existence in the PR title.

Copy link
Member

@mdjermanovic mdjermanovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

nzakas
nzakas approved these changes Feb 4, 2021
@mdjermanovic mdjermanovic merged commit 9b277a1 into eslint:master Feb 10, 2021
3 checks passed
@mdjermanovic
Copy link
Member

Thanks for contributing!

This was referenced Mar 17, 2021
@eslint-github-bot eslint-github-bot bot locked and limited conversation to collaborators Aug 10, 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 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants