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
Task working directoy when multiple configs #1090
Comments
I'm not sure what the use-case has been for the current logic, but this would be a breaking change if |
More specifically, it breaks this test, because even if |
Further, it's possible to supply lint-staged with a path to a config, eg. |
Maybe a new setting like |
I figured it might not have to be a breaking change if it only applies when multiple config files are detected: #1091 |
Hi @iiroj , thanks for your quick reply! The idea i wanna show is the cwd property for each task is critical in monorepo use cases. I am open if other args should be passed like cwdFromConfig, or it is easier to use when it is a default behavior. |
Until #1091 is merged, this workaround can help (seems to work in my case):
module.exports = {
'**/*.{ts,tsx}': [`yarn --cwd "${__dirname}" eslint --max-warnings 0`],
}; |
Description
For now, the
cwd
for each task isprocess.cwd()
in most cases. but ideally the working directory should be the directory ofconfigFilePath
.Expecting behaviour
For example,
and
packageA/.lintstagedrc.json
Assuming
packageA/index.js
is stage file. In this case, what i really want is runeslint --fix packageA/index.js
underpackageA
instead of monorepo root folder. Because eslint need to loadpackageA/.eslintrc.json
Code detail
https://github.com/okonet/lint-staged/blob/36b9546dda5ca24174b519ce6d132f31077b093b/lib/runAll.js#L148-L151
may change to
Environment
lint-staged
: 12.2.1The text was updated successfully, but these errors were encountered: