This repository was archived by the owner on Jul 9, 2026. It is now read-only.
Repository navigation
Bump ESLint and Prettier packages to match versions in Gutenberg - #6219
Merged
Merged
Conversation
geriux
approved these changes
Sep 25, 2023
geriux
left a comment
Contributor
There was a problem hiding this comment.
LGTM! Thanks for addressing this 🚀
FYI I've restarted some CI jobs since they failed due to a network error, hopefully, they'll pass this time.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This PR updates ESLint, some ESLint plugins, and Prettier packages following the changes recently made in Gutenberg (WordPress/gutenberg#54539).
These updates are needed to avoid failures when running the command
npm run lint, as it was identified when trying to merge the release1.104.0intotrunk(#6204). Here is the sequence of errors found when trying to address the failures:Error 1
eslint-plugin-prettierpackage was recently introduced (reference) with the version5.0.0. This version uses a newer version of ESLint than the one currently installed in GBM (version installed in GBM6.8.0vs. version referenced in the ESLint plugin8.0.0). This explains the error of not loading the rulecontext.getPhysicalFilename, as it was introduced in ESLint version7.28.0(reference).This problem was solved by upgrading the ESLint version in GBM to match the one used in Gutenberg (
^8.3.0).NOTE 1: In Gutenberg, the ESLint version installed is the one set by the
@wordpress/scriptspackage. Since we don't use it in GBM, we have to set our own ESLint version.NOTE 2: Alternatively, we could add the
scriptspackage as a dev dependency in GBM. However, if we reference it via a local path, ESLint won't be automatically installed. This is mentioned in NPM documentation:Error 2
The
@typescript-eslint/eslint-pluginplugin can't be loaded due to the following error:This was solved by upgrading to
6.4.1, as referenced in@wordpress/eslint-pluginpackage.Alternatively, we could point to the npm version. However, this seems to not work because peer dependencies are not installed at the root level and ESLint plugins are only imported from that location.
Error 3
The
eslint-plugin-importplugin can't be loaded:Similar to the above solutions, we need to upgrade it to
2.25.2as referenced in the Gutenberg package.Error 4
The
eslint-plugin-prettierplugin fails when using Prettier:This was solved by upgrading Prettier to version
3.0.3-beta-3as applied in the PR.After solving the above errors, several files were formatted after running
npm run lint:fix.To test:
PR submission checklist: