Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 12e28c2

Browse files
authored
Merge pull request #272 from magento-gl/AC-13683-v1
AC-13683::Investigate latest major version of grunt-eslint
2 parents d7ece6d + 4d17750 commit 12e28c2

18 files changed

+790
-611
lines changed

‎.github/workflows/php.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- name: Setup node
2626
uses: actions/setup-node@v2
2727
with:
28-
node-version: '16'
28+
node-version: '21'
2929

3030
- uses: actions/checkout@v2
3131

@@ -65,7 +65,7 @@ jobs:
6565
- name: Setup node
6666
uses: actions/setup-node@v2
6767
with:
68-
node-version: '16'
68+
node-version: '21'
6969

7070
- uses: actions/checkout@v2
7171

@@ -82,7 +82,7 @@ jobs:
8282
- name: Setup node
8383
uses: actions/setup-node@v2
8484
with:
85-
node-version: '16'
85+
node-version: '21'
8686

8787
- uses: actions/checkout@v2
8888

‎eslint/.eslintrc‎

Lines changed: 0 additions & 8 deletions
This file was deleted.

‎eslint/.eslintrc-jquery‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"ignorePatterns": ["**/vendor/**/*.js", "**/node_modules/**/*.js"],
33
"rules": {
4-
"jquery-no-andSelf": 2,
5-
"jquery-no-bind-unbind": 2,
6-
"jquery-no-input-event-shorthand": 2,
7-
"jquery-no-delegate-undelegate": 2,
8-
"jquery-no-event-shorthand": 2,
9-
"jquery-no-size": 2,
10-
"jquery-no-trim": 2,
11-
"jquery-no-misc-deprecated-functions": 2,
12-
"jquery-no-deprecated-expr": 2
4+
"magento-coding-standard-eslint-plugin/jquery-no-andSelf": 2,
5+
"magento-coding-standard-eslint-plugin/jquery-no-bind-unbind": 2,
6+
"magento-coding-standard-eslint-plugin/jquery-no-input-event-shorthand": 2,
7+
"magento-coding-standard-eslint-plugin/jquery-no-delegate-undelegate": 2,
8+
"magento-coding-standard-eslint-plugin/jquery-no-event-shorthand": 2,
9+
"magento-coding-standard-eslint-plugin/jquery-no-size": 2,
10+
"magento-coding-standard-eslint-plugin/jquery-no-trim": 2,
11+
"magento-coding-standard-eslint-plugin/jquery-no-misc-deprecated-functions": 2,
12+
"magento-coding-standard-eslint-plugin/jquery-no-deprecated-expr": 2
1313
}
1414
}

‎eslint/eslint.config.mjs‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* ESLint Configuration for Magento Project
3+
*
4+
* This configuration extends Magento, jQuery, and reset ESLint rules,
5+
* while enforcing Magento coding standards using the `magento-coding-standard-eslint-plugin`.
6+
* It uses FlatCompat to handle multiple config files in a modular way.
7+
*/
8+
9+
import { defineConfig } from "eslint/config";
10+
import magentoCodingStandardEslintPlugin from "magento-coding-standard-eslint-plugin";
11+
import path from "node:path";
12+
import { fileURLToPath } from "node:url";
13+
import js from "@eslint/js";
14+
import { FlatCompat } from "@eslint/eslintrc";
15+
16+
const __filename = fileURLToPath(import.meta.url);
17+
const __dirname = path.dirname(__filename);
18+
const compat = new FlatCompat({
19+
baseDirectory: __dirname,
20+
recommendedConfig: js.configs.recommended,
21+
allConfig: js.configs.all
22+
});
23+
export default defineConfig([{
24+
extends: compat.extends(
25+
"./.eslintrc-reset", // Resets all rules before applying custom ones
26+
"./.eslintrc-magento", // Magento-specific coding standards
27+
"./.eslintrc-jquery", // jQuery-related ESLint Rules
28+
"./.eslintrc-misc", // Miscellaneous Rules
29+
),
30+
plugins: {
31+
"magento-coding-standard-eslint-plugin": magentoCodingStandardEslintPlugin, // This is in flat config format (object)
32+
}
33+
}]);

‎eslint/index.js‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/**
2+
* ESLint Plugin for jQuery Deprecation Rules
3+
* This module aggregates individual jQuery-related rules into a single .
4+
*/
5+
import jqueryNoAndSelf from './rules/jquery-no-andSelf.js';
6+
import jqueryNoBindUnbind from './rules/jquery-no-bind-unbind.js';
7+
import jqueryNoDelegateUndelegate from './rules/jquery-no-delegate-undelegate.js';
8+
import jqueryNoDeprecatedExpr from './rules/jquery-no-deprecated-expr.js';
9+
import jqueryNoEventShorthand from './rules/jquery-no-event-shorthand.js';
10+
import jqueryNoInputEventShorthand from './rules/jquery-no-input-event-shorthand.js';
11+
import jqueryNoMiscDeprecatedFunctions from './rules/jquery-no-misc-deprecated-functions.js';
12+
import jqueryNoSize from './rules/jquery-no-size.js';
13+
import jqueryNoTrim from './rules/jquery-no-trim.js';
14+
15+
export default {
16+
rules: {
17+
'jquery-no-andSelf': jqueryNoAndSelf,
18+
'jquery-no-bind-unbind': jqueryNoBindUnbind,
19+
'jquery-no-delegate-undelegate': jqueryNoDelegateUndelegate,
20+
'jquery-no-deprecated-expr': jqueryNoDeprecatedExpr,
21+
'jquery-no-event-shorthand': jqueryNoEventShorthand,
22+
'jquery-no-input-event-shorthand': jqueryNoInputEventShorthand,
23+
'jquery-no-misc-deprecated-functions': jqueryNoMiscDeprecatedFunctions,
24+
'jquery-no-size': jqueryNoSize,
25+
'jquery-no-trim': jqueryNoTrim
26+
}
27+
};

‎eslint/package.json‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"name": "magento-coding-standard-eslint-plugin",
3+
"version": "1.0.0",
4+
"main": "index.js",
5+
"resolutions": {
6+
"eslint": "~9.22.0"
7+
},
8+
"eslintConfig": {
9+
"plugins": ["magento-coding-standard-eslint-plugin"]
10+
},
11+
"type": "module"
12+
}

‎eslint/rules/jquery-no-andSelf.js‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
module.exports = {
1+
// Import utils using ES module syntax
2+
import utils from './utils.js';
3+
4+
export default {
25
meta: {
36
type: 'suggestion',
47
docs: {
@@ -20,10 +23,6 @@ module.exports = {
2023
* @returns {Object}
2124
*/
2225
create: function (context) {
23-
'use strict';
24-
25-
var utils = require('./utils.js');
26-
2726
return {
2827
/**
2928
* Checks if andSelf is used in the node and reports it.

‎eslint/rules/jquery-no-bind-unbind.js‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
module.exports = {
1+
// Import utils using ES module syntax
2+
import utils from './utils.js';
3+
4+
export default {
25
meta: {
36
type: 'suggestion',
47
docs: {
@@ -20,10 +23,6 @@ module.exports = {
2023
* @returns {Object}
2124
*/
2225
create: function (context) {
23-
'use strict';
24-
25-
var utils = require('./utils.js');
26-
2726
return {
2827
/**
2928
* Checks if bind and unbind are used in the node and reports it.

‎eslint/rules/jquery-no-delegate-undelegate.js‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
module.exports = {
1+
// Import utils using ES module syntax
2+
import utils from './utils.js';
3+
4+
export default {
25
meta: {
36
type: 'suggestion',
47
docs: {
@@ -20,10 +23,6 @@ module.exports = {
2023
* @returns {Object}
2124
*/
2225
create: function (context) {
23-
'use strict';
24-
25-
var utils = require('./utils.js');
26-
2726
return {
2827
/**
2928
* Checks if delegate and undelegate are used in the node and reports it.

‎eslint/rules/jquery-no-deprecated-expr.js‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
module.exports = {
1+
// Import utils using ES module syntax
2+
import utils from './utils.js';
3+
4+
export default {
25
meta: {
36
type: 'suggestion',
47
docs: {
@@ -17,10 +20,6 @@ module.exports = {
1720
* @returns {Object}
1821
*/
1922
create: function (context) {
20-
'use strict';
21-
22-
var utils = require('./utils.js');
23-
2423
return {
2524
/**
2625
* Checks for jQuery.expr[':']

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /