Grunt jshint:plugins: Ignore node_modules and common paths for built files. - #13207
Grunt jshint:plugins: Ignore node_modules and common paths for built files.#13207afercia wants to merge 1 commit into
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
| ignore: [ | ||
| '**/build/**', | ||
| '**/dist/**', | ||
| '**/gutenberg/**', |
There was a problem hiding this comment.
Wouldn't this technically be redundant since the relevant files in Gutenberg would themselves be ignored by the other globs?
There was a problem hiding this comment.
Gutenberg contains folders that contain .js files that aren't caught by the other globs, for example:
- storybook
- tools
There was a problem hiding this comment.
One way to double check is: run this command with and without the Gutenberg glob:
grunt jshint:plugins 2>&1 | grep -E "(\/.*\.js)"
without the Gutenberg glob there are a few more Gutenberg directories being scanned.
There was a problem hiding this comment.
Pull request overview
Updates the WordPress core Grunt configuration for the jshint:plugins target to avoid linting (and ideally avoid traversing) common dependency/build output directories inside wp-content/plugins.
Changes:
- Adds an
ignorelist to thejshint:pluginsfile expansion configuration intended to skip common build/dependency directories. - Documents the rationale as a performance optimization during glob expansion.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| // Prevent traversal into these directories during glob expansion. | ||
| // This is much faster than using negation patterns alone. | ||
| ignore: [ | ||
| '**/build/**', | ||
| '**/dist/**', |
There was a problem hiding this comment.
This doesn't seem to be true as the folders matching these globs are skipped.
| '**/build/**', | ||
| '**/dist/**', | ||
| '**/gutenberg/**', | ||
| '**/node_modules/**', | ||
| '**/packages/**', |
0be7b31 to
95192e6
Compare
…build output directories. The Grunt task `jshint:plugins` is meant to allow plugin developers easier access to JSHint and support good coding standards. Plugin developers can run it to lint their plugin JavaScript files. The script can't handle built files though and it hangs indefinitely when scanning large dependency directories like `node_modules` that many modern plugins use. Adds an ignore list to the `jshint:plugins` file expansion configuration intended to skip common build/dependency directories. Developed in #13207 Props afercia, westonruter. Fixes #65923. git-svn-id: https://develop.svn.wordpress.org/trunk@63364 602fd350-edb4-49c9-b593-d223f7449a82
…build output directories. The Grunt task `jshint:plugins` is meant to allow plugin developers easier access to JSHint and support good coding standards. Plugin developers can run it to lint their plugin JavaScript files. The script can't handle built files though and it hangs indefinitely when scanning large dependency directories like `node_modules` that many modern plugins use. Adds an ignore list to the `jshint:plugins` file expansion configuration intended to skip common build/dependency directories. Developed in WordPress/wordpress-develop#13207 Props afercia, westonruter. Fixes #65923. Built from https://develop.svn.wordpress.org/trunk@63364 git-svn-id: http://core.svn.wordpress.org/trunk@62557 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Trac ticket: https://core.trac.wordpress.org/ticket/65923
Adds an
ignoreproperty to the Gruntjshint:pluginsto exclude any directory where the name matches:Use of AI Tools
None
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.