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: ensure config files are files #42

Merged
merged 1 commit into from
Jul 6, 2021

Conversation

tjenkinson
Copy link
Contributor

@tjenkinson tjenkinson commented Jul 3, 2021

Currently if a directory name matches a config file it will be treated as a file and then fail later when we try and read it.

This is causing an error for us in a fixture where we have a directory called "package.json".

Refs rollup/plugins#927

@eslint-github-bot
Copy link

Hi @tjenkinson!, thanks for the Pull Request

The first commit message 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'.

  • The first letter of the tag should be in uppercase

Read more about contributing to ESLint here

@tjenkinson
Copy link
Contributor Author

@nzakas @mdjermanovic please could someone click the button to run the workflow?

@tjenkinson
Copy link
Contributor Author

tjenkinson commented Jul 3, 2021

Locally I'm getting

1) ConfigArrayFactory
       loading config files should work properly.
         Plugins
           should load information from a YML file and load plugins:
     YAMLException: Cannot read config file: /private/var/folders/c1/5j985n355jgdqhvpwwvvhpc00000gn/T/eslintrc/config-array-factory/plugins/.eslintrc.yml
Error: bad indentation of a mapping entry at line 3, column 29:
                                rules:
                                ^
      at generateError (node_modules/js-yaml/lib/js-yaml/loader.js:167:10)

even on 'main' when trying to run the tests

@eslint-github-bot
Copy link

Hi @tjenkinson!, 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'.

  • The first letter of the tag should be in uppercase

Read more about contributing to ESLint here

@tjenkinson tjenkinson force-pushed the ensure-config-files-are-files branch from 299adf7 to 20ebd85 Compare July 3, 2021 15:25
@@ -495,7 +495,7 @@ class ConfigArrayFactory {
basePath
);

if (fs.existsSync(ctx.filePath)) {
if (fs.existsSync(ctx.filePath) && fs.statSync(ctx.filePath).isFile()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tjenkinson tjenkinson marked this pull request as ready for review July 3, 2021 15:27
@tjenkinson
Copy link
Contributor Author

#44 should fix the test failure

@eslint-github-bot
Copy link

Hi @tjenkinson!, 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'.

  • The first letter of the tag should be in uppercase

Read more about contributing to ESLint here

Currently if a directory name matches a config file it will be treated as a file and then fail later when we try and read it.
@tjenkinson tjenkinson force-pushed the ensure-config-files-are-files branch from 19ae64b to 4c77284 Compare July 3, 2021 17:08
@mdjermanovic mdjermanovic changed the title ensure config files are files Fix: ensure config files are files Jul 3, 2021
@mdjermanovic mdjermanovic added accepted bug Something isn't working and removed triage labels Jul 3, 2021
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.

Thanks for the PR, I can reproduce this bug with directories named package.json, .eslintrc etc.

The change LGTM, thanks!

@nzakas nzakas merged commit ce78027 into eslint:main Jul 6, 2021
tjenkinson added a commit to rollup/plugins that referenced this pull request Aug 21, 2021
tjenkinson added a commit to rollup/plugins that referenced this pull request Aug 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants