Skip to content

TBD Release (2.4.9) #383

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

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion src/pages/coding-standards/js.md
Original file line number Diff line number Diff line change
@@ -361,4 +361,33 @@ var foo = 'bar',

There is a set of custom Eslint rules to ensure code compatibility with the latest versions of third-party libraries.

These custom rules are included using the `rulePaths` setting in the [Eslint Grunt configuration](https://github.com/magento/magento2/blob/2.4/dev/tools/grunt/configs/eslint.json).
In previous versions of ESLint, these custom rules were included using the `rulePaths` setting in the [ESLint Grunt configuration](https://github.com/magento/magento2/blob/2.4/dev/tools/grunt/configs/eslint.json).

However, since ESLint 9 has deprecated `rulePaths`, you must update the configuration accordingly.

The following example shows the necessary changes to implement custom Eslint rules in the `dev/tools/grunt/configs/eslint.json` file.

```json
{
"file": {
"options": {
"overrideConfigFile": "vendor/magento/magento-coding-standard/eslint/eslint.config.mjs",
"useEslintrc": false
}
},
"test": {
"options": {
"overrideConfigFile": "vendor/magento/magento-coding-standard/eslint/eslint.config.mjs",
"outputFile": "dev/tests/static/eslint-error-report.xml",
"format": "junit",
"quiet": true
}
}
}
```

### Applying custom rules

To add or modify custom rules, update the `eslint.config.mjs` file in the `magento-coding-standard` repository.
In the latest version of ESLint, the configuration has transitioned from using the legacy `.eslintrc` settings to the new flat configuration.
Refer to the [migration guide](https://eslint.org/docs/latest/use/configure/migration-guide) in the ESlint documentation for detailed instructions on migrating to the new format.