Scripts: Ignore linting files located in build folders by default#15977
Merged
Conversation
4 tasks
66fc004 to
f62daad
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Closes #15407.
It should give very good defaults with the related proposal #15890 which provides defaults for file pattern matching.
This PR ensures that by default all files located in
buildandnode_modulesfolders are ignored when usingwp-scriptsfor all 3 types of linter:lint-jslint-pkg-jsonlint-styleHow has this been tested?
This is quite difficult to test without publishing to npm. I personally tested it with Gutenberg repository by playing with configuration files. This is how you can run commands:
npx wp-scripts lint-js .npx wp-scripts lint-pkg-json .npx wp-scripts lint-style '**/*.scss'I deleted
.eslintignorefrom the root folder of Gutenberg and played with defaults:packages/scripts/config/.eslintignorepackages/scripts/config/.npmpackagejsonlintignorepackages/scripts/config/.stylelintignoreI had to add some linting errors in random files to ensure it all works.
Then I reverted changes in those config files and copied them to the root folder. I tried again to modify those config files in the root folder running all commands again.
I also ensured that when I add violations to files inside
buildornode_modulesnested subfolder, those errors are ignored.