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

no such file or directory #5

Closed
FDiskas opened this issue Feb 13, 2018 · 10 comments
Closed

no such file or directory #5

FDiskas opened this issue Feb 13, 2018 · 10 comments

Comments

@FDiskas
Copy link

FDiskas commented Feb 13, 2018

"notice/notice": [
      "error",
      {
        "mustMatch":
          "[0-9]{0,4} All rights reserved.",
        "templateFile": "config/copyright.js",
        "nonMatchingTolerance": ".70"
      }
    ]

Error while loading rule 'notice/notice'/mnt/SSD/Projects/.../src/modules/searchModule.js:: ENOENT/mnt/SSD/Projects/.../src/modules/searchModule.js:: no such file or directory, open 'config/copyright.js'
And yes - the file is under the root folder in config directory

eslint-plugin-notice@0.5.6
@FDiskas FDiskas mentioned this issue Feb 13, 2018
@FDiskas
Copy link
Author

FDiskas commented Feb 13, 2018

As a workaround i used inline template with new line symbols

"notice/notice": [
      "error",
      {
        "mustMatch":
          "[0-9]{0,4} All rights reserved.",
        "template":
          "/**\n * Copyright (C) <%= YEAR %> All rights reserved.\n */\n",
        "nonMatchingTolerance": ".70"
      }
    ]

🚃

@nickdeis
Copy link
Owner

nickdeis commented Feb 14, 2018

Hey Vytenis,
Thank you for filing an issue.
Could you give me an idea about how your directories are structured?
How are you calling eslint?
Where in the directory structure are you calling eslint?
Sorry about the hassle,
Nick

@FDiskas
Copy link
Author

FDiskas commented Feb 14, 2018

Other plugins are using strange solutions for this problem
https://github.com/benmosher/eslint-plugin-import/blob/a69b77181c423043d39f1c8752b296aaa95facfc/resolvers/webpack/index.js
My folder structure is structure
and in that "config" directory was that file. Eslint is integrated in VSCode, same as in PHPStorm all of them are showing errors like can't find. 🎉

@nickdeis
Copy link
Owner

Ahhh I see the issue now. Thank you for all your input/help.
So I don't think eslint-plugin-import is that strange of an approach, it's basically the approach I would take. However, I think the file path should point to the root of the eslint file, not package.json.
In practice, this will almost always be the same root.
I'm going to look into if the eslint API has some sort of reference to the root eslint file or the location of eslint config (probably not) but if not I'll probably make some sort of find-root kind algorithm.
You seem keen on implementing this, and I typically ask the reporter of the issue if they would like to implement the fix, but if not, I'll get to this sometime tommorrow.
Cheers,
Nick

@FDiskas
Copy link
Author

FDiskas commented Feb 15, 2018

@nickdeis - yes do it, I tried with no success. Did't know allot stuff about eslint API. And to write tests for this would be imposible for me :)

@nickdeis
Copy link
Owner

I think I have to use package.json, eslint has too many config formats, and they are expanding them in the future.
Also, I'm hoping that vscode sends the content via the file itself and not stdin.

nickdeis added a commit that referenced this issue Feb 16, 2018
Summary: Will try to use the filename of the source to search for the root, will print a more useful error message on failure
@nickdeis
Copy link
Owner

nickdeis commented Feb 16, 2018

Alright, I hopefully fixed the issue in version 0.6.6, but if not, the error messages should be more useful.
Thanks,
Nick

@FDiskas
Copy link
Author

FDiskas commented Feb 17, 2018

Thanks. I will test it

@FDiskas
Copy link
Author

FDiskas commented Feb 18, 2018

works

@FDiskas FDiskas closed this as completed Feb 18, 2018
@nickdeis
Copy link
Owner

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants