-
-
Notifications
You must be signed in to change notification settings - Fork 424
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
patch: support linting parent directories #425
Conversation
Codecov Report
@@ Coverage Diff @@
## master #425 +/- ##
==========================================
- Coverage 98.18% 98.15% -0.03%
==========================================
Files 11 11
Lines 220 217 -3
Branches 25 25
==========================================
- Hits 216 213 -3
Misses 4 4
Continue to review full report at Codecov.
|
@sudo-suhas can you remember why we added |
@masumsoft I'm wondering: did you use lint-staged to work on this PR ;) |
I'm okay with this change and it's looking good to me. Let's wait for @sudo-suhas to confirm we don't need this check. |
@okonet the changes were so simple, that I just used the github editor to update and commit the files and there was no lint staged complaints there you know :P |
To begin with, this would be a breaking change and I think that in most cases, users would want The other alternative is to introduce a config flag to optionally disable the |
// Make the paths relative to CWD for filtering | ||
.map(file => path.relative(cwd, file)), | ||
// Make the paths relative to gitDir for filtering | ||
.map(file => path.relative(gitDir, file)), |
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.
This will break existing user config. User would have configured the file patterns relative to current project root as we recommend in the readme.
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.
@okonet We should add a test for this as well.
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.
I can now see it can break existing configs, but it would be great if we could allow relative parents something like ../**.js
type paths.
Makes sense @sudo-suhas. I agree with that, installing and using from root makes more sense to me. Another question: can it be configured with relative paths like |
No, I do not think so. I'd caution against a project making assumptions about how it is organised outside it's own scope. Earlier with
I think this holds for the |
This use case is now supported via |
How can I run the same front end linter on files outside of the frontend directory. Example use case backend folder contains few js files and I want to run the same linter for both the backend and front end |
I have a setup where we have backend and frontend directories. The backend contains a python-django-rest-api project and frontend is javascript-react-redux project. We wanted to use lint-staged for checking python files in the backend directory too which is under the parent directory.
So we need to remove the pathIsInside check to make it work for both frontend and backend directories.