-
-
Notifications
You must be signed in to change notification settings - Fork 40
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: Get cwd on call #329
base: master
Are you sure you want to change the base?
fix: Get cwd on call #329
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally I would have done this the other way around, set the default in the constructor. That is often helpful for debugging so folks can log it out before use. In this setup if they did that it would log undefined
which would be confusing.
process.chdir('foo');
const engine = new StandardEngine();
process.chdir('bar');
const results = await engine.lintFiles(['baz.js']); The documentation explains that the default value for the With this pull request, the current working directory at the time of the |
Sure, but also what you describe is a footgun for TONS of things which rely on |
Do you have another solution to correct this problem? You talked about setting the default in the constructor or adding |
Made it as a suggestion comment. That is all I meant. |
/** @type {string} */ | ||
this.cwd = opts.cwd || process.cwd() | ||
/** @type {string|undefined} */ | ||
this.cwd = opts.cwd |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your suggestion is a rollback of my commit? If I apply your two suggestions, this pull request will no longer change the source code.
I probably should have not fired off those messages so quickly. Was split attention between a few things. Sorry about that! Looking again I am positive I just misread change as a change to the comment not the code below it. I probably need to go re-read the other issue where this came from again because clearly I didn't have all the context in my head when making this suggestion comment. |
Ok, yeah I see the original issue mentions What I meant in my original comment was to add it here but also since I did not notice you remove it from the constructor and had thought that was just a comment change (again sorry for my too quick responses). This will teach me to fire off a quick response like that in the future. So, to re-frame this now: it is my opinion that Again, really really sorry for the miss-direction here. That is totally my fault. |
Here's my use case: I'm developing Metalint, a tool that aggregates the results of several linters, including Standard. For my tests, I'll create a temporary directory and place test files in it. Then I change the current directory and call the wrapper of Standard. But this doesn't work, because Standard fetches the files from the current directory when the tests are launched. I tested my version of If you don't want to accept my PR, you'll have to change the documentation for which current directory is used:
|
Any way you can just create the |
Also I should add, I am not the final say here in any form. A few folks have been working on what governance of this project should look like, but I think ultimately the decision is up to Feross (not going to ping since I assume he is watching most activity and will get to it when he can). |
I think this would be a partial revert of #181 from 5 years ago, more specifically of d4c2916, which I'm 👍 on, this seems like a needless optimization As @wesleytodd says there are governance discussions in standard/standard#1948 / standard/standard#1957, before those are done its a bit unclear who would make a call to change (I mean: I could merge and release it, but I rather wait. Also, I think this issue may go away in a move to ESLint 9 and flat configs as the need for @regseb Any reason why you use |
@regseb So the user themselves install |
The user must install the |
Fix standard/standard#1956