Scripts: Add default file patterns for linting scripts#15890
Conversation
d6c9cee to
2b26699
Compare
There was a problem hiding this comment.
Should we use ./src instead of . to align with wp-scripts build?
There was a problem hiding this comment.
In #15977, I propose we ignore build and node_modules folders by default, so this should be less important than at the moment.
There was a problem hiding this comment.
**/*.{css,scss} - I'm not convinced about this proposal so I'm happy to revisit based on the feedback.
I also consider myself: src/**/*.{css,scss} to be ready for integration with wp-scripts build. We can always revisit later once we have #14801 implemented.
There was a problem hiding this comment.
In #15977, I propose we ignore build and node_modules folders by default, so this should be less important than at the moment.
2b26699 to
9493897
Compare
| "scripts": { | ||
| "lint:js": "wp-scripts lint-js ." | ||
| "lint:js": "wp-scripts lint-js", | ||
| "lint:js:src": "wp-scripts lint-js ./src" |
There was a problem hiding this comment.
I like this, it ties in with what you mentioned here: #15890 (comment)
9493897 to
b96a34a
Compare
b96a34a to
16b1936
Compare
|
This seems to have broken the See build: https://travis-ci.com/WordPress/gutenberg/jobs/205608992 |
| const result = spawn( | ||
| resolveBin( 'npm-package-json-lint', { executable: 'npmPkgJsonLint' } ), | ||
| [ ...config, ...defaultIgnoreArgs, ...args ], | ||
| [ ...defaultConfigArgs, ...defaultIgnoreArgs, ...args, defaultFilesArgs ], |
There was a problem hiding this comment.
Guessing this is meant to be spread ...defaultFileArgs
| "scripts": { | ||
| "build": "wp-scripts build", | ||
| "check-engines": "wp-scripts check-engines", | ||
| "check-licenses": "wp-scripts check-licenses --production", |
There was a problem hiding this comment.
It validates all dependencies installed in the project, not only those used for production. We check regular and dev dependencies in Gutenberg, so I thought we should recommend both for other projects as well.
Description
This PR adds default patterns to match files for linting scripts in
@wordpress/scriptspackage. See updated docs for more details:The rationale behind those changes is that everything should work out of the box and plugin developer shouldn't be concerned about file patterns when using those commands. It's still possible to override them but for the majority of cases, it should work seamlessly.
How has this been tested?
I ensured all commands work as expected with Gutenberg:
npm run lint-jsnpm run lint-js:fixnpx wp-scripts lint-js packages/e2e-tests/specs/plugins/- you should see less warnings than when runningnpm run lint-jsnpm run lint-cssnpm run lint-css:fixnpx wp-scripts lint-style "vendor/"- you should see tons of errors :)npm run lint-pkg-jsonnpx wp-scripts lint-pkg-json ./packages- you should see errrors in the rootpackage.jsonfileYou can also introduce errors yourself and check if they are detected.
Checklist: