From eb0b43b2daa2017724de745b6f317ede621f30d7 Mon Sep 17 00:00:00 2001 From: Bhavin Parmar Date: Tue, 6 May 2025 15:13:34 +0530 Subject: [PATCH 1/4] AC-14314:: [AdobeDocs Approval] Dev doc update after upgrading eslint version to 9 --- src/pages/coding-standards/js.md | 34 +++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/src/pages/coding-standards/js.md b/src/pages/coding-standards/js.md index 4e9828f91..fd3640c7b 100644 --- a/src/pages/coding-standards/js.md +++ b/src/pages/coding-standards/js.md @@ -361,4 +361,36 @@ 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 version 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`, the configuration has been updated accordingly. + +This document outlines the necessary changes to implement custom Eslint rules. + +```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 `eslint.config.mjs` in the `magento-coding-standard` repository. +With latest version, configuration has changed from eslint to flat config. We use this https://eslint.org/docs/latest/use/configure/migration-guide as a +reference to migrate the eslint. + +This reference doc provides the command and other information in detail. such as to convert old `.eslintrc` file with new config +run below command +`npx @eslint/migrate-config .eslintrc` From cd069925fb299de6b1692659bb51762cae48bcdf Mon Sep 17 00:00:00 2001 From: Bhavin Parmar Date: Wed, 7 May 2025 11:20:37 +0530 Subject: [PATCH 2/4] AC-14314:: [AdobeDocs Approval] Dev doc update after upgrading eslint version to 9 --- src/pages/coding-standards/js.md | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/pages/coding-standards/js.md b/src/pages/coding-standards/js.md index fd3640c7b..9fc043c15 100644 --- a/src/pages/coding-standards/js.md +++ b/src/pages/coding-standards/js.md @@ -361,11 +361,11 @@ var foo = 'bar', There is a set of custom Eslint rules to ensure code compatibility with the latest versions of third-party libraries. -In previous version 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). +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`, the configuration has been updated accordingly. +However, since ESLint 9 has deprecated `rulePaths`, you must update the configuration accordingly. -This document outlines the necessary changes to implement custom Eslint rules. +The following example shows the necessary changes to implement custom Eslint rules `dev/tools/grunt/configs/eslint.json` . ```json { @@ -385,12 +385,10 @@ This document outlines the necessary changes to implement custom Eslint rules. } } ``` + ### Applying custom rules To add or modify custom rules, update `eslint.config.mjs` in the `magento-coding-standard` repository. -With latest version, configuration has changed from eslint to flat config. We use this https://eslint.org/docs/latest/use/configure/migration-guide as a -reference to migrate the eslint. +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. -This reference doc provides the command and other information in detail. such as to convert old `.eslintrc` file with new config -run below command -`npx @eslint/migrate-config .eslintrc` From 45781fa20d579300a1d1a8b77f37aba98f22ed86 Mon Sep 17 00:00:00 2001 From: Jeff Matthews Date: Wed, 7 May 2025 09:20:36 -0500 Subject: [PATCH 3/4] Apply suggestions from code review --- src/pages/coding-standards/js.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/coding-standards/js.md b/src/pages/coding-standards/js.md index 9fc043c15..c47a9f813 100644 --- a/src/pages/coding-standards/js.md +++ b/src/pages/coding-standards/js.md @@ -365,7 +365,7 @@ In previous versions of ESLint, these custom rules were included using the `rule 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 `dev/tools/grunt/configs/eslint.json` . +The following example shows the necessary changes to implement custom Eslint rules in the `dev/tools/grunt/configs/eslint.json` file. ```json { @@ -388,7 +388,7 @@ The following example shows the necessary changes to implement custom Eslint rul ### Applying custom rules -To add or modify custom rules, update `eslint.config.mjs` in the `magento-coding-standard` repository. +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. From 1d59895341f74a6f21bf3508ca7a62554ec85322 Mon Sep 17 00:00:00 2001 From: Jeff Matthews Date: Wed, 7 May 2025 09:27:28 -0500 Subject: [PATCH 4/4] fix: validation --- src/pages/coding-standards/js.md | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/coding-standards/js.md b/src/pages/coding-standards/js.md index c47a9f813..7150b8ee0 100644 --- a/src/pages/coding-standards/js.md +++ b/src/pages/coding-standards/js.md @@ -391,4 +391,3 @@ The following example shows the necessary changes to implement custom Eslint rul 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. -