@akinon/eslint-plugin-projectzero 1.104.0 → 1.105.0-rc.84
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/dist/rules/check-menu-depth.js +14 -27
- package/package.json +1 -1
- package/rules/check-menu-depth.ts +9 -31
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @akinon/eslint-plugin-projectzero
|
|
2
2
|
|
|
3
|
+
## 1.105.0-rc.84
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- d8be48fb: ZERO-3422: Update fetch method to use dynamic request method in wallet complete redirection middleware
|
|
8
|
+
- 16aff543: ZERO-3431: Add test script for redirect utility in package.json
|
|
9
|
+
- 64699d3ff: ZERO-2761: Fix invalid import for plugin module
|
|
10
|
+
- e974d8e8: ZERO-3406: Fix rc build
|
|
11
|
+
- 7eb51ca9: ZERO-3424 :Update package versions
|
|
12
|
+
- 7727ae55: ZERO-3073: Refactor basket page to use server-side data fetching and simplify component structure
|
|
13
|
+
- 8b1d24eb: ZERO-3422: Update fetch method to use dynamic request method in wallet complete redirection middleware
|
|
14
|
+
- 33377cfd: ZERO-3267: Refactor import statement for ROUTES in error-page component
|
|
15
|
+
- 62779ee: ZERO-3668: Refactor check-menu-depth rule to simplify depth validation logic and remove unused error messages
|
|
16
|
+
- 33d4d0c: ZERO-3615: remove custom not found
|
|
17
|
+
|
|
3
18
|
## 1.104.0
|
|
4
19
|
|
|
5
20
|
## 1.103.0
|
|
@@ -8,33 +8,21 @@ exports.default = utils_1.ESLintUtils.RuleCreator.withoutDocs({
|
|
|
8
8
|
CallExpression(node) {
|
|
9
9
|
const { callee, arguments: args } = node;
|
|
10
10
|
if (callee.type !== types_1.AST_NODE_TYPES.Identifier ||
|
|
11
|
-
callee.name !== 'getMenu'
|
|
11
|
+
callee.name !== 'getMenu' ||
|
|
12
|
+
args.length === 0 ||
|
|
13
|
+
args[0].type !== types_1.AST_NODE_TYPES.ObjectExpression) {
|
|
12
14
|
return;
|
|
13
15
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const depthProperty = args[0].properties.find((prop) => prop.type === types_1.AST_NODE_TYPES.Property &&
|
|
25
|
-
prop.key.type === types_1.AST_NODE_TYPES.Identifier &&
|
|
26
|
-
prop.key.name === 'depth');
|
|
27
|
-
if (!depthProperty) {
|
|
28
|
-
context.report({
|
|
29
|
-
node: args[0],
|
|
30
|
-
messageId: 'noDepthMessage'
|
|
31
|
-
});
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
if (depthProperty.type === types_1.AST_NODE_TYPES.Property &&
|
|
35
|
-
depthProperty.value.type === types_1.AST_NODE_TYPES.Literal &&
|
|
36
|
-
typeof depthProperty.value.value === 'number' &&
|
|
37
|
-
depthProperty.value.value > 3) {
|
|
16
|
+
const depthProperty = args[0].properties.find((prop) => {
|
|
17
|
+
var _a;
|
|
18
|
+
return prop.type === types_1.AST_NODE_TYPES.Property &&
|
|
19
|
+
prop.key.type === types_1.AST_NODE_TYPES.Identifier &&
|
|
20
|
+
prop.key.name === 'depth' &&
|
|
21
|
+
((_a = prop.value) === null || _a === void 0 ? void 0 : _a.type) === types_1.AST_NODE_TYPES.Literal &&
|
|
22
|
+
typeof prop.value.value === 'number' &&
|
|
23
|
+
prop.value.value > 3;
|
|
24
|
+
});
|
|
25
|
+
if (depthProperty) {
|
|
38
26
|
context.report({
|
|
39
27
|
node: depthProperty,
|
|
40
28
|
messageId: 'depthMessage'
|
|
@@ -47,8 +35,7 @@ exports.default = utils_1.ESLintUtils.RuleCreator.withoutDocs({
|
|
|
47
35
|
type: 'problem',
|
|
48
36
|
fixable: 'code',
|
|
49
37
|
messages: {
|
|
50
|
-
depthMessage: 'A request for a menu deeper than 3 levels from the server can lead to unnecessary memory usage and unwanted outcomes. Therefore, sending a request for a 3-level menu on the client side and making additional requests on hover for deeper levels may be more efficient.'
|
|
51
|
-
noDepthMessage: 'Calling getMenu() without a depth parameter fetches the entire menu, which can cause performance and memory issues. Please provide a depth parameter (maximum 3).'
|
|
38
|
+
depthMessage: 'A request for a menu deeper than 3 levels from the server can lead to unnecessary memory usage and unwanted outcomes. Therefore, sending a request for a 3-level menu on the client side and making additional requests on hover for deeper levels may be more efficient.'
|
|
52
39
|
},
|
|
53
40
|
schema: []
|
|
54
41
|
},
|
package/package.json
CHANGED
|
@@ -9,44 +9,24 @@ export default ESLintUtils.RuleCreator.withoutDocs({
|
|
|
9
9
|
|
|
10
10
|
if (
|
|
11
11
|
callee.type !== AST_NODE_TYPES.Identifier ||
|
|
12
|
-
callee.name !== 'getMenu'
|
|
12
|
+
callee.name !== 'getMenu' ||
|
|
13
|
+
args.length === 0 ||
|
|
14
|
+
args[0].type !== AST_NODE_TYPES.ObjectExpression
|
|
13
15
|
) {
|
|
14
16
|
return;
|
|
15
17
|
}
|
|
16
18
|
|
|
17
|
-
if (args.length === 0) {
|
|
18
|
-
context.report({
|
|
19
|
-
node: callee,
|
|
20
|
-
messageId: 'noDepthMessage'
|
|
21
|
-
});
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (args[0].type !== AST_NODE_TYPES.ObjectExpression) {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
19
|
const depthProperty = args[0].properties.find(
|
|
30
20
|
(prop) =>
|
|
31
21
|
prop.type === AST_NODE_TYPES.Property &&
|
|
32
22
|
prop.key.type === AST_NODE_TYPES.Identifier &&
|
|
33
|
-
prop.key.name === 'depth'
|
|
23
|
+
prop.key.name === 'depth' &&
|
|
24
|
+
prop.value?.type === AST_NODE_TYPES.Literal &&
|
|
25
|
+
typeof prop.value.value === 'number' &&
|
|
26
|
+
prop.value.value > 3
|
|
34
27
|
);
|
|
35
28
|
|
|
36
|
-
if (
|
|
37
|
-
context.report({
|
|
38
|
-
node: args[0],
|
|
39
|
-
messageId: 'noDepthMessage'
|
|
40
|
-
});
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (
|
|
45
|
-
depthProperty.type === AST_NODE_TYPES.Property &&
|
|
46
|
-
depthProperty.value.type === AST_NODE_TYPES.Literal &&
|
|
47
|
-
typeof depthProperty.value.value === 'number' &&
|
|
48
|
-
depthProperty.value.value > 3
|
|
49
|
-
) {
|
|
29
|
+
if (depthProperty) {
|
|
50
30
|
context.report({
|
|
51
31
|
node: depthProperty,
|
|
52
32
|
messageId: 'depthMessage'
|
|
@@ -60,9 +40,7 @@ export default ESLintUtils.RuleCreator.withoutDocs({
|
|
|
60
40
|
fixable: 'code',
|
|
61
41
|
messages: {
|
|
62
42
|
depthMessage:
|
|
63
|
-
'A request for a menu deeper than 3 levels from the server can lead to unnecessary memory usage and unwanted outcomes. Therefore, sending a request for a 3-level menu on the client side and making additional requests on hover for deeper levels may be more efficient.'
|
|
64
|
-
noDepthMessage:
|
|
65
|
-
'Calling getMenu() without a depth parameter fetches the entire menu, which can cause performance and memory issues. Please provide a depth parameter (maximum 3).'
|
|
43
|
+
'A request for a menu deeper than 3 levels from the server can lead to unnecessary memory usage and unwanted outcomes. Therefore, sending a request for a 3-level menu on the client side and making additional requests on hover for deeper levels may be more efficient.'
|
|
66
44
|
},
|
|
67
45
|
schema: []
|
|
68
46
|
},
|