Skip to content

Use ESLint's default parser in the ESLint config - #3123

Merged
dmaicher merged 1 commit into
sonata-project:masterfrom
dmaicher:eslint-default-parser
Nov 23, 2026
Merged

dmaicher merged 1 commit into
sonata-project:masterfrom
dmaicher:eslint-default-parser

Conversation

@dmaicher

Copy link
Copy Markdown
Contributor

The .eslintrc.js template still uses @babel/eslint-parser, which can't be installed anymore by the projects upgraded to @symfony/webpack-encore 7 (which requires Babel 8):

  • @babel/eslint-parser 8 requires ESLint 9+, but the projects are still on ESLint 8 with the legacy .eslintrc.js config.
  • @babel/eslint-parser 7 requires @babel/core 7.

These projects therefore dropped it and switched to ESLint's default parser with ecmaVersion: 'latest', but the DevKit PRs revert that, and the "Webpack Encore" job then fails with Cannot find module '@babel/eslint-parser':

This changes the template to that same config, so it no longer conflicts with these branches.

The branches still on Babel 7 (SonataAdminBundle 5.x, SonataPageBundle 5.x, form-extensions 3.x) only use standard syntax: npx eslint --max-warnings 0 assets/js passes on all three with the new config. They can drop @babel/eslint-parser from their package.json afterwards, but it's harmless to keep until then.

🤖 Generated with Claude Code

@babel/eslint-parser 8 requires ESLint 9+, while the projects are still
on ESLint 8 with the legacy .eslintrc.js config, and @babel/eslint-parser
7 requires @babel/core 7. So projects upgrading to Webpack Encore 7
(which requires Babel 8) can no longer use it.

The JS code only uses standard syntax, so ESLint's default parser is
enough when the ECMAScript version is set to latest.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dmaicher
dmaicher merged commit 1c1828a into sonata-project:master Nov 23, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant