@akinon/eslint-plugin-projectzero 1.93.0-snapshot-ZERO-3586-20250828143733 → 1.94.0

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 CHANGED
@@ -1,58 +1,8 @@
1
1
  # @akinon/eslint-plugin-projectzero
2
2
 
3
- ## 1.93.0-snapshot-ZERO-3586-20250828143733
3
+ ## 1.94.0
4
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
- - 64699d3f: 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
- - 3b47394: ZERO-3582: Enhance check-menu-depth rule to enforce depth parameter in getMenu calls and add corresponding error messages
15
- - 33377cfd: ZERO-3267: Refactor import statement for ROUTES in error-page component
16
-
17
- ## 1.93.0-rc.52
18
-
19
- ## 1.93.0-rc.51
20
-
21
- ### Minor Changes
22
-
23
- - 3b47394: ZERO-3582: Enhance check-menu-depth rule to enforce depth parameter in getMenu calls and add corresponding error messages
24
-
25
- ## 1.93.0-rc.50
26
-
27
- ## 1.93.0-rc.49
28
-
29
- ### Minor Changes
30
-
31
- - d8be48fb: ZERO-3422: Update fetch method to use dynamic request method in wallet complete redirection middleware
32
- - 16aff54: ZERO-3431: Add test script for redirect utility in package.json
33
- - 64699d3ff: ZERO-2761: Fix invalid import for plugin module
34
- - e974d8e8: ZERO-3406: Fix rc build
35
- - 7eb51ca9: ZERO-3424 :Update package versions
36
- - 7727ae55: ZERO-3073: Refactor basket page to use server-side data fetching and simplify component structure
37
- - 8b1d24eb: ZERO-3422: Update fetch method to use dynamic request method in wallet complete redirection middleware
38
- - 33377cfd: ZERO-3267: Refactor import statement for ROUTES in error-page component
39
-
40
- ## 1.93.0-rc.48
41
-
42
- ## 1.93.0-rc.47
43
-
44
- ## 1.93.0-rc.46
45
-
46
- ### Minor Changes
47
-
48
- - d8be48fb: ZERO-3422: Update fetch method to use dynamic request method in wallet complete redirection middleware
49
- - 16aff543: ZERO-3431: Add test script for redirect utility in package.json
50
- - 64699d3ff: ZERO-2761: Fix invalid import for plugin module
51
- - e974d8e8: ZERO-3406: Fix rc build
52
- - 7eb51ca9: ZERO-3424 :Update package versions
53
- - 7727ae55: ZERO-3073: Refactor basket page to use server-side data fetching and simplify component structure
54
- - 8b1d24eb: ZERO-3422: Update fetch method to use dynamic request method in wallet complete redirection middleware
55
- - 33377cfd: ZERO-3267: Refactor import statement for ROUTES in error-page component
5
+ ## 1.93.0
56
6
 
57
7
  ## 1.92.0
58
8
 
@@ -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
- if (args.length === 0) {
15
- context.report({
16
- node: callee,
17
- messageId: 'noDepthMessage'
18
- });
19
- return;
20
- }
21
- if (args[0].type !== types_1.AST_NODE_TYPES.ObjectExpression) {
22
- return;
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akinon/eslint-plugin-projectzero",
3
- "version": "1.93.0-snapshot-ZERO-3586-20250828143733",
3
+ "version": "1.94.0",
4
4
  "private": false,
5
5
  "description": "ESLint plugin for Project Zero Next",
6
6
  "main": "dist/index.js",
@@ -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 (!depthProperty) {
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
  },