-
Notifications
You must be signed in to change notification settings - Fork 1
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
Use WordPress ESLint Config #136
Draft
g-elwell
wants to merge
16
commits into
release/2.0.0
Choose a base branch
from
feat/wp-scripts-lint-config
base: release/2.0.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains 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
…d-tools into feat/wp-scripts-lint-config
g-elwell
commented
Feb 17, 2025
plugins, | ||
overrides, | ||
env, | ||
presets: ['@wordpress/babel-preset-default'], |
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.
Babel processing within build-tools is now handled by wp-scripts, but this config file is needed since projects may import it directly to extend from.
9dadee2
to
eb0455b
Compare
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
One of the reasons we wanted to migrate to wp-scripts was to make use of the linting config(s) it provides, including additional accessibility and internationalisation rules that we don't yet implement.
This PR updates our eslint config to extend from the WordPress one as a base, and amends any rules to our liking.
Related #117
Due to the fact we're extending the WordPress config, there are several other pieces we can remove from our eslint config:
extends
- not neededbabel
- handled by wp-scriptsWordpress provide both
@wordpress/eslint-plugin/recommended
and@wordpress/eslint-plugin/recommended-with-formatting
- the former includes prettier config which is difficult to override, so we use the latter and also extend prettier to apply our own prettier config in eslint.This PR also removes unused code that duplicates processing and config provided by wp-scripts.
How to test
"@bigbite/build-tools": "github:bigbite/build-tools#feat/wp-scripts-lint-config",
Script enqueuing changes
Given the following project structure:
You'll need to change style/script enqueuing so that it uses the new asset files (located in
dist
) instead of the oldasset-settings.php
and constants defined therein.For example, from:
To: