@elastic/eslint-plugin-eui 2.6.0 → 2.7.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/lib/cjs/index.js CHANGED
@@ -1,18 +1,19 @@
1
1
  "use strict";
2
2
 
3
+ var _accessible_interactive_element = require("./rules/a11y/accessible_interactive_element");
4
+ var _callout_announce_on_mount = require("./rules/a11y/callout_announce_on_mount");
5
+ var _consistent_is_invalid_props = require("./rules/a11y/consistent_is_invalid_props");
3
6
  var _href_or_on_click = require("./rules/href_or_on_click");
4
- var _no_restricted_eui_imports = require("./rules/no_restricted_eui_imports");
5
7
  var _no_css_color = require("./rules/no_css_color");
8
+ var _no_restricted_eui_imports = require("./rules/no_restricted_eui_imports");
9
+ var _no_static_z_index = require("./rules/no_static_z_index");
10
+ var _no_unnamed_interactive_element = require("./rules/a11y/no_unnamed_interactive_element");
11
+ var _no_unnamed_radio_group = require("./rules/a11y/no_unnamed_radio_group");
12
+ var _prefer_eui_icon_tip = require("./rules/a11y/prefer_eui_icon_tip");
6
13
  var _require_aria_label_for_modals = require("./rules/a11y/require_aria_label_for_modals");
7
- var _consistent_is_invalid_props = require("./rules/a11y/consistent_is_invalid_props");
14
+ var _require_table_caption = require("./rules/a11y/require_table_caption");
8
15
  var _sr_output_disabled_tooltip = require("./rules/a11y/sr_output_disabled_tooltip");
9
- var _prefer_eui_icon_tip = require("./rules/a11y/prefer_eui_icon_tip");
10
- var _no_unnamed_radio_group = require("./rules/a11y/no_unnamed_radio_group");
11
- var _no_unnamed_interactive_element = require("./rules/a11y/no_unnamed_interactive_element");
12
16
  var _tooltip_focusable_anchor = require("./rules/a11y/tooltip_focusable_anchor");
13
- var _callout_announce_on_mount = require("./rules/a11y/callout_announce_on_mount");
14
- var _accessible_interactive_element = require("./rules/a11y/accessible_interactive_element");
15
- var _require_table_caption = require("./rules/a11y/require_table_caption");
16
17
  /*
17
18
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
18
19
  * or more contributor license agreements. Licensed under the Elastic License
@@ -23,37 +24,39 @@ var _require_table_caption = require("./rules/a11y/require_table_caption");
23
24
 
24
25
  const config = {
25
26
  rules: {
27
+ 'accessible-interactive-element': _accessible_interactive_element.AccessibleInteractiveElements,
28
+ 'callout-announce-on-mount': _callout_announce_on_mount.CallOutAnnounceOnMount,
29
+ 'consistent-is-invalid-props': _consistent_is_invalid_props.ConsistentIsInvalidProps,
26
30
  'href-or-on-click': _href_or_on_click.HrefOnClick,
27
- 'no-restricted-eui-imports': _no_restricted_eui_imports.NoRestrictedEuiImports,
28
31
  'no-css-color': _no_css_color.NoCssColor,
32
+ 'no-restricted-eui-imports': _no_restricted_eui_imports.NoRestrictedEuiImports,
33
+ 'no-static-z-index': _no_static_z_index.NoStaticZIndex,
34
+ 'no-unnamed-interactive-element': _no_unnamed_interactive_element.NoUnnamedInteractiveElement,
35
+ 'no-unnamed-radio-group': _no_unnamed_radio_group.NoUnnamedRadioGroup,
36
+ 'prefer-eui-icon-tip': _prefer_eui_icon_tip.PreferEuiIconTip,
29
37
  'require-aria-label-for-modals': _require_aria_label_for_modals.RequireAriaLabelForModals,
30
- 'consistent-is-invalid-props': _consistent_is_invalid_props.ConsistentIsInvalidProps,
38
+ 'require-table-caption': _require_table_caption.RequireTableCaption,
31
39
  'sr-output-disabled-tooltip': _sr_output_disabled_tooltip.ScreenReaderOutputDisabledTooltip,
32
- 'prefer-eui-icon-tip': _prefer_eui_icon_tip.PreferEuiIconTip,
33
- 'no-unnamed-radio-group': _no_unnamed_radio_group.NoUnnamedRadioGroup,
34
- 'callout-announce-on-mount': _callout_announce_on_mount.CallOutAnnounceOnMount,
35
- 'no-unnamed-interactive-element': _no_unnamed_interactive_element.NoUnnamedInteractiveElement,
36
- 'tooltip-focusable-anchor': _tooltip_focusable_anchor.TooltipFocusableAnchor,
37
- 'accessible-interactive-element': _accessible_interactive_element.AccessibleInteractiveElements,
38
- 'require-table-caption': _require_table_caption.RequireTableCaption
40
+ 'tooltip-focusable-anchor': _tooltip_focusable_anchor.TooltipFocusableAnchor
39
41
  },
40
42
  configs: {
41
43
  recommended: {
42
44
  plugins: ['@elastic/eslint-plugin-eui'],
43
45
  rules: {
46
+ '@elastic/eui/accessible-interactive-element': 'warn',
47
+ '@elastic/eui/callout-announce-on-mount': 'warn',
48
+ '@elastic/eui/consistent-is-invalid-props': 'warn',
44
49
  '@elastic/eui/href-or-on-click': 'warn',
45
- '@elastic/eui/no-restricted-eui-imports': 'warn',
46
50
  '@elastic/eui/no-css-color': 'warn',
51
+ '@elastic/eui/no-restricted-eui-imports': 'warn',
52
+ '@elastic/eui/no-static-z-index': 'warn',
53
+ '@elastic/eui/no-unnamed-interactive-element': 'warn',
54
+ '@elastic/eui/no-unnamed-radio-group': 'warn',
55
+ '@elastic/eui/prefer-eui-icon-tip': 'warn',
47
56
  '@elastic/eui/require-aria-label-for-modals': 'warn',
48
- '@elastic/eui/consistent-is-invalid-props': 'warn',
57
+ '@elastic/eui/require-table-caption': 'warn',
49
58
  '@elastic/eui/sr-output-disabled-tooltip': 'warn',
50
- '@elastic/eui/prefer-eui-icon-tip': 'warn',
51
- '@elastic/eui/no-unnamed-radio-group': 'warn',
52
- '@elastic/eui/callout-announce-on-mount': 'warn',
53
- '@elastic/eui/no-unnamed-interactive-element': 'warn',
54
- '@elastic/eui/tooltip-focusable-anchor': 'warn',
55
- '@elastic/eui/accessible-interactive-element': 'warn',
56
- '@elastic/eui/require-table-caption': 'warn'
59
+ '@elastic/eui/tooltip-focusable-anchor': 'warn'
57
60
  }
58
61
  }
59
62
  }
@@ -1 +1 @@
1
- {"version":3,"file":"no_css_color.d.ts","sourceRoot":"","sources":["../../../src/rules/no_css_color.ts"],"names":[],"mappings":"AASA,OAAO,EAAY,WAAW,EAAE,MAAM,0BAA0B,CAAC;AA4OjE,eAAO,MAAM,UAAU,2IAsRrB,CAAC"}
1
+ {"version":3,"file":"no_css_color.d.ts","sourceRoot":"","sources":["../../../src/rules/no_css_color.ts"],"names":[],"mappings":"AASA,OAAO,EAAY,WAAW,EAAE,MAAM,0BAA0B,CAAC;AA+OjE,eAAO,MAAM,UAAU,2IAuRrB,CAAC"}
@@ -7,6 +7,7 @@ exports.NoCssColor = void 0;
7
7
  var _cssstyle = require("cssstyle");
8
8
  var _utils = require("@typescript-eslint/utils");
9
9
  var _resolve_member_expression_root = require("../utils/resolve_member_expression_root");
10
+ var _get_property_name = require("../utils/get_property_name");
10
11
  /*
11
12
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
12
13
  * or more contributor license agreements. Licensed under the Elastic License
@@ -56,13 +57,14 @@ const checkPropertySpecifiesInvalidCSSColor = ([property, value]) => {
56
57
  */
57
58
  const raiseReportIfPropertyHasInvalidCssColor = (context, propertyNode, messageToReport) => {
58
59
  let didReport = false;
59
- if (propertyNode.key.type === 'Identifier' && !htmlElementColorDeclarationRegex.test(propertyNode.key.name)) {
60
+ const propertyName = (0, _get_property_name.getPropertyName)(propertyNode);
61
+ if (!propertyName || !htmlElementColorDeclarationRegex.test(propertyName)) {
60
62
  return didReport;
61
63
  }
62
64
  if (propertyNode.value.type === 'Literal') {
63
- if (didReport = checkPropertySpecifiesInvalidCSSColor([
64
- // @ts-expect-error the key name is present in this scenario
65
- propertyNode.key.name, propertyNode.value.value])) {
65
+ if (didReport = checkPropertySpecifiesInvalidCSSColor([propertyName,
66
+ // @ts-expect-error the value is present in this scenario
67
+ propertyNode.value.value])) {
66
68
  context.report(messageToReport);
67
69
  }
68
70
  } else if (propertyNode.value.type === 'Identifier') {
@@ -0,0 +1,3 @@
1
+ import { ESLintUtils } from '@typescript-eslint/utils';
2
+ export declare const NoStaticZIndex: ESLintUtils.RuleModule<"noStaticZIndex" | "noStaticZIndexSpecific" | "noStaticZIndexSpecificDeclaredVariable", [], unknown, ESLintUtils.RuleListener>;
3
+ //# sourceMappingURL=no_static_z_index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no_static_z_index.d.ts","sourceRoot":"","sources":["../../../src/rules/no_static_z_index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAY,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAkRjE,eAAO,MAAM,cAAc,uJAwOzB,CAAC"}
@@ -0,0 +1,361 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.NoStaticZIndex = void 0;
7
+ var _utils = require("@typescript-eslint/utils");
8
+ var _get_property_name = require("../utils/get_property_name");
9
+ /*
10
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
11
+ * or more contributor license agreements. Licensed under the Elastic License
12
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
13
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
14
+ * Side Public License, v 1.
15
+ */
16
+
17
+ const propertiesCheckingZIndex = ['zIndex', 'z-index'];
18
+ const zIndexDeclarationRegex = RegExp(String.raw`(${propertiesCheckingZIndex.join('|')})`);
19
+
20
+ // Regex to find z-index declarations in CSS strings
21
+ // Matches:
22
+ // 1. z-index property name (case insensitive)
23
+ // 2. colon
24
+ // 3. value (captured group 1) until semicolon, closing brace, or !important
25
+ const cssZIndexRegex = /z-index\s*:\s*([^;!}]+)/gi;
26
+ const checkPropertySpecifiesInvalidZIndex = (property, value) => {
27
+ if (!property || value === undefined || value === null) return false;
28
+ const normalizedProperty = property.trim();
29
+ const isZIndex = propertiesCheckingZIndex.includes(normalizedProperty);
30
+ if (!isZIndex) return false;
31
+ return isInvalidZIndexValue(value);
32
+ };
33
+ const isInvalidZIndexValue = value => {
34
+ const allowedCssKeywords = ['auto', 'inherit', 'initial', 'unset', 'revert', 'revert-layer'];
35
+ const stringValue = String(value).trim().toLowerCase();
36
+ if (allowedCssKeywords.includes(stringValue)) {
37
+ return false;
38
+ }
39
+
40
+ // Check if it's a number (positive, negative, or zero)
41
+ // This regex allows integers. z-index only accepts integers.
42
+ if (/^-?\d+$/.test(stringValue)) {
43
+ return true;
44
+ }
45
+ return false;
46
+ };
47
+ const raiseReportIfPropertyHasInvalidZIndex = (context, propertyNode, messageToReport) => {
48
+ let didReport = false;
49
+ const propertyName = (0, _get_property_name.getPropertyName)(propertyNode);
50
+ if (!propertyName || !zIndexDeclarationRegex.test(propertyName)) {
51
+ return didReport;
52
+ }
53
+ const visitNode = node => {
54
+ // Handle Literal values: zIndex: 10, 'z-index': '10'
55
+ if (node.type === 'Literal') {
56
+ if (checkPropertySpecifiesInvalidZIndex(propertyName, node.value)) {
57
+ didReport = true;
58
+ context.report({
59
+ ...messageToReport,
60
+ loc: node.loc
61
+ });
62
+ }
63
+ }
64
+ // Handle Identifier values: zIndex: someVar
65
+ else if (node.type === 'Identifier') {
66
+ const identifierName = node.name;
67
+ const identifierDeclaration = context.sourceCode.getScope(node).variables.find(variable => variable.name === identifierName);
68
+ const identifierDeclarationInit = identifierDeclaration?.defs[0]?.node.type === 'VariableDeclarator' ? identifierDeclaration.defs[0].node.init : undefined;
69
+ if (identifierDeclarationInit?.type === 'Literal' && checkPropertySpecifiesInvalidZIndex(propertyName, identifierDeclarationInit.value)) {
70
+ didReport = true;
71
+ context.report({
72
+ loc: node.loc,
73
+ messageId: 'noStaticZIndexSpecificDeclaredVariable',
74
+ data: {
75
+ property: propertyName,
76
+ line: String(node.loc.start.line),
77
+ variableName: node.name
78
+ }
79
+ });
80
+ }
81
+ } else if (node.type === 'ConditionalExpression') {
82
+ visitNode(node.consequent);
83
+ visitNode(node.alternate);
84
+ } else if (node.type === 'LogicalExpression') {
85
+ visitNode(node.left);
86
+ visitNode(node.right);
87
+ } else if (node.type === 'TSAsExpression') {
88
+ visitNode(node.expression);
89
+ } else if (node.type === 'UnaryExpression') {
90
+ if (node.operator === '-') {
91
+ if (node.argument.type === 'Literal' && typeof node.argument.value === 'number') {
92
+ if (checkPropertySpecifiesInvalidZIndex(propertyName, -node.argument.value)) {
93
+ didReport = true;
94
+ context.report({
95
+ ...messageToReport,
96
+ loc: node.loc
97
+ });
98
+ }
99
+ } else {
100
+ visitNode(node.argument);
101
+ }
102
+ }
103
+ }
104
+ };
105
+ if (propertyNode.value) {
106
+ visitNode(propertyNode.value);
107
+ }
108
+ return didReport;
109
+ };
110
+ const handleObjectProperties = (context, propertyParentNode, property, reportMessage) => {
111
+ if (property.type === 'Property') {
112
+ if (property.value.type === 'ObjectExpression') {
113
+ property.value.properties.forEach(nestedProperty => {
114
+ const nestedReportMessage = {
115
+ ...reportMessage,
116
+ loc: nestedProperty.loc
117
+ };
118
+ if (nestedReportMessage.data) {
119
+ const newData = {
120
+ ...nestedReportMessage.data,
121
+ property: (0, _get_property_name.getPropertyName)(nestedProperty) || 'unknown'
122
+ };
123
+ if ('line' in newData) {
124
+ newData.line = String(nestedProperty.loc.start.line);
125
+ }
126
+ nestedReportMessage.data = newData;
127
+ }
128
+ handleObjectProperties(context, propertyParentNode, nestedProperty, nestedReportMessage);
129
+ });
130
+ } else {
131
+ raiseReportIfPropertyHasInvalidZIndex(context, property, reportMessage);
132
+ }
133
+ } else if (property.type === 'SpreadElement') {
134
+ if (property.argument.type !== 'Identifier') {
135
+ return;
136
+ }
137
+ const spreadElementIdentifierName = property.argument.name;
138
+ let scopeNode = propertyParentNode;
139
+ if (propertyParentNode.type === 'JSXAttribute' && propertyParentNode.value?.type === 'JSXExpressionContainer') {
140
+ scopeNode = propertyParentNode.value.expression;
141
+ }
142
+ const spreadElementDeclaration = context.sourceCode.getScope(scopeNode).references.find(ref => ref.identifier.name === spreadElementIdentifierName)?.resolved;
143
+ if (!spreadElementDeclaration) {
144
+ return;
145
+ }
146
+ const propertyName = (0, _get_property_name.getPropertyName)(property) || 'spread';
147
+ reportMessage = {
148
+ loc: propertyParentNode.loc,
149
+ messageId: 'noStaticZIndexSpecificDeclaredVariable',
150
+ data: {
151
+ property: propertyName,
152
+ variableName: spreadElementIdentifierName,
153
+ line: String(property.loc.start.line)
154
+ }
155
+ };
156
+ const spreadElementDeclarationNode = spreadElementDeclaration.defs[0]?.node.type === 'VariableDeclarator' ? spreadElementDeclaration.defs[0].node.init : undefined;
157
+ if (spreadElementDeclarationNode?.type === 'ObjectExpression') {
158
+ spreadElementDeclarationNode.properties.forEach(spreadProperty => {
159
+ handleObjectProperties(context, propertyParentNode, spreadProperty, reportMessage);
160
+ });
161
+ }
162
+ }
163
+ };
164
+ const checkTemplateLiteralForZIndex = (context, node) => {
165
+ for (let i = 0; i < node.quasis.length; i++) {
166
+ const declarationTemplateNode = node.quasis[i];
167
+ const rawValue = declarationTemplateNode.value.raw;
168
+ // Strip comments
169
+ const valueWithoutComments = rawValue.replace(/\/\*[\s\S]*?\*\//g, '');
170
+ let match;
171
+ // reset regex state
172
+ cssZIndexRegex.lastIndex = 0;
173
+ while ((match = cssZIndexRegex.exec(valueWithoutComments)) !== null) {
174
+ const value = match[1].trim();
175
+ if (isInvalidZIndexValue(value)) {
176
+ context.report({
177
+ node: declarationTemplateNode,
178
+ messageId: 'noStaticZIndex'
179
+ });
180
+ }
181
+ }
182
+ }
183
+ };
184
+ const NoStaticZIndex = exports.NoStaticZIndex = _utils.ESLintUtils.RuleCreator.withoutDocs({
185
+ create(context) {
186
+ return {
187
+ TaggedTemplateExpression(node) {
188
+ if (node.tag.type !== 'Identifier' || node.tag.type === 'Identifier' && node.tag.name !== 'css') {
189
+ return;
190
+ }
191
+ checkTemplateLiteralForZIndex(context, node.quasi);
192
+ },
193
+ JSXAttribute(node) {
194
+ if (!(node.name.name === 'style' || node.name.name === 'css')) {
195
+ return;
196
+ }
197
+ if (!node.value || node.value.type !== 'JSXExpressionContainer') {
198
+ return;
199
+ }
200
+ const expression = node.value.expression;
201
+
202
+ // Handle identifier expression: style={someStyle}
203
+ if (expression.type === 'Identifier') {
204
+ const styleVariableName = expression.name;
205
+ const nodeScope = context.sourceCode.getScope(expression);
206
+ const variableDeclarationMatches = nodeScope.references.find(ref => ref.identifier.name === styleVariableName)?.resolved;
207
+ let variableInitializationNode;
208
+ if (variableDeclarationMatches?.defs[0]?.node.type === 'VariableDeclarator' && variableDeclarationMatches.defs[0].node.init) {
209
+ variableInitializationNode = variableDeclarationMatches.defs[0].node.init;
210
+ if (variableInitializationNode.type === 'ObjectExpression') {
211
+ variableInitializationNode.properties.forEach(property => {
212
+ handleObjectProperties(context, node, property, {
213
+ loc: property.loc,
214
+ messageId: 'noStaticZIndexSpecificDeclaredVariable',
215
+ data: {
216
+ property: (0, _get_property_name.getPropertyName)(property) || 'unknown',
217
+ variableName: styleVariableName,
218
+ line: String(property.loc.start.line)
219
+ }
220
+ });
221
+ });
222
+ } else if (variableInitializationNode.type === 'CallExpression' && variableInitializationNode.callee.type === 'Identifier' && variableInitializationNode.callee.name === 'css') {
223
+ variableInitializationNode.arguments.forEach(argument => {
224
+ if (argument.type === 'ObjectExpression') {
225
+ argument.properties.forEach(property => {
226
+ handleObjectProperties(context, node, property, {
227
+ loc: property.loc,
228
+ messageId: 'noStaticZIndexSpecificDeclaredVariable',
229
+ data: {
230
+ property: (0, _get_property_name.getPropertyName)(property) || 'unknown',
231
+ variableName: styleVariableName,
232
+ line: String(property.loc.start.line)
233
+ }
234
+ });
235
+ });
236
+ }
237
+ });
238
+ }
239
+ }
240
+ return;
241
+ }
242
+
243
+ // Handle inline object: style={{ zIndex: 10 }}
244
+ if (expression.type === 'ObjectExpression') {
245
+ const declarationPropertiesNode = expression.properties;
246
+ declarationPropertiesNode?.forEach(property => {
247
+ handleObjectProperties(context, node, property, {
248
+ loc: property.loc,
249
+ messageId: 'noStaticZIndexSpecific',
250
+ data: {
251
+ property: (0, _get_property_name.getPropertyName)(property) || 'unknown'
252
+ }
253
+ });
254
+ });
255
+ return;
256
+ }
257
+
258
+ // Handle inline CallExpression: css={css({ zIndex: 10 })}
259
+ if (expression.type === 'CallExpression' && expression.callee.type === 'Identifier' && expression.callee.name === 'css') {
260
+ expression.arguments.forEach(argument => {
261
+ if (argument.type === 'ObjectExpression') {
262
+ argument.properties.forEach(property => {
263
+ handleObjectProperties(context, node, property, {
264
+ loc: node.loc,
265
+ messageId: 'noStaticZIndexSpecific',
266
+ data: {
267
+ property: (0, _get_property_name.getPropertyName)(property) || 'unknown'
268
+ }
269
+ });
270
+ });
271
+ }
272
+ });
273
+ return;
274
+ }
275
+
276
+ // Handle inline ArrayExpression: css={[...]}
277
+ if (expression.type === 'ArrayExpression') {
278
+ expression.elements.forEach(element => {
279
+ if (!element) return;
280
+ if (element.type === 'ObjectExpression') {
281
+ element.properties.forEach(property => {
282
+ handleObjectProperties(context, node, property, {
283
+ loc: property.loc,
284
+ messageId: 'noStaticZIndexSpecific',
285
+ data: {
286
+ property: (0, _get_property_name.getPropertyName)(property) || 'unknown'
287
+ }
288
+ });
289
+ });
290
+ } else if (element.type === 'CallExpression' && element.callee.type === 'Identifier' && element.callee.name === 'css') {
291
+ element.arguments.forEach(argument => {
292
+ if (argument.type === 'ObjectExpression') {
293
+ argument.properties.forEach(property => {
294
+ handleObjectProperties(context, node, property, {
295
+ loc: property.loc,
296
+ messageId: 'noStaticZIndexSpecific',
297
+ data: {
298
+ property: (0, _get_property_name.getPropertyName)(property) || 'unknown'
299
+ }
300
+ });
301
+ });
302
+ }
303
+ });
304
+ }
305
+ });
306
+ }
307
+
308
+ // Handle css prop with template literal or function
309
+ if (node.name.name === 'css') {
310
+ // css={`...`}
311
+ if (expression.type === 'TemplateLiteral') {
312
+ checkTemplateLiteralForZIndex(context, expression);
313
+ return;
314
+ }
315
+
316
+ // css={() => ({ ... })} or css={function() { return { ... } }}
317
+ if (expression.type === 'FunctionExpression' || expression.type === 'ArrowFunctionExpression') {
318
+ let declarationPropertiesNode = [];
319
+ if (expression.body.type === 'ObjectExpression') {
320
+ declarationPropertiesNode = expression.body.properties;
321
+ }
322
+ if (expression.body.type === 'BlockStatement') {
323
+ const functionReturnStatementNode = expression.body.body?.find(_node => {
324
+ return _node.type === 'ReturnStatement';
325
+ });
326
+ if (functionReturnStatementNode?.type === 'ReturnStatement' && functionReturnStatementNode.argument?.type === 'ObjectExpression') {
327
+ declarationPropertiesNode = functionReturnStatementNode.argument.properties.filter(property => property.type === 'Property');
328
+ }
329
+ }
330
+ if (!declarationPropertiesNode.length) {
331
+ return;
332
+ }
333
+ declarationPropertiesNode.forEach(property => {
334
+ handleObjectProperties(context, node, property, {
335
+ loc: property.loc,
336
+ messageId: 'noStaticZIndexSpecific',
337
+ data: {
338
+ property: (0, _get_property_name.getPropertyName)(property) || 'unknown'
339
+ }
340
+ });
341
+ });
342
+ return;
343
+ }
344
+ }
345
+ }
346
+ };
347
+ },
348
+ meta: {
349
+ type: 'suggestion',
350
+ docs: {
351
+ description: 'Use `z-index` definitions from `euiTheme` as opposed to static values'
352
+ },
353
+ messages: {
354
+ noStaticZIndexSpecificDeclaredVariable: 'Avoid using a literal z-index value for "{{property}}", use an EUI theme z-index level instead in declared variable {{variableName}} on line {{line}}',
355
+ noStaticZIndexSpecific: 'Avoid using a literal z-index value for "{{property}}", use an EUI theme z-index level instead',
356
+ noStaticZIndex: 'Avoid using a literal z-index value, use an EUI theme z-index level instead'
357
+ },
358
+ schema: []
359
+ },
360
+ defaultOptions: []
361
+ });
@@ -0,0 +1,3 @@
1
+ import { TSESTree } from '@typescript-eslint/utils';
2
+ export declare const getPropertyName: (propertyNode: TSESTree.Property | TSESTree.SpreadElement) => string | null;
3
+ //# sourceMappingURL=get_property_name.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get_property_name.d.ts","sourceRoot":"","sources":["../../../src/utils/get_property_name.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,eAAO,MAAM,eAAe,GAC1B,cAAc,QAAQ,CAAC,QAAQ,GAAG,QAAQ,CAAC,aAAa,KACvD,MAAM,GAAG,IAeX,CAAC"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getPropertyName = void 0;
7
+ /*
8
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
9
+ * or more contributor license agreements. Licensed under the Elastic License
10
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
11
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
12
+ * Side Public License, v 1.
13
+ */
14
+
15
+ const getPropertyName = propertyNode => {
16
+ if (propertyNode.type === 'Property') {
17
+ if (propertyNode.key.type === 'Identifier') {
18
+ return propertyNode.key.name;
19
+ }
20
+ if (propertyNode.key.type === 'Literal') {
21
+ return String(propertyNode.key.value);
22
+ }
23
+ } else if (propertyNode.type === 'SpreadElement' && propertyNode.argument.type === 'Identifier') {
24
+ return propertyNode.argument.name;
25
+ }
26
+ return null;
27
+ };
28
+ exports.getPropertyName = getPropertyName;
package/lib/esm/index.js CHANGED
@@ -7,52 +7,55 @@
7
7
  * Side Public License, v 1.
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
+ const accessible_interactive_element_1 = require("./rules/a11y/accessible_interactive_element");
11
+ const callout_announce_on_mount_1 = require("./rules/a11y/callout_announce_on_mount");
12
+ const consistent_is_invalid_props_1 = require("./rules/a11y/consistent_is_invalid_props");
10
13
  const href_or_on_click_1 = require("./rules/href_or_on_click");
11
- const no_restricted_eui_imports_1 = require("./rules/no_restricted_eui_imports");
12
14
  const no_css_color_1 = require("./rules/no_css_color");
15
+ const no_restricted_eui_imports_1 = require("./rules/no_restricted_eui_imports");
16
+ const no_static_z_index_1 = require("./rules/no_static_z_index");
17
+ const no_unnamed_interactive_element_1 = require("./rules/a11y/no_unnamed_interactive_element");
18
+ const no_unnamed_radio_group_1 = require("./rules/a11y/no_unnamed_radio_group");
19
+ const prefer_eui_icon_tip_1 = require("./rules/a11y/prefer_eui_icon_tip");
13
20
  const require_aria_label_for_modals_1 = require("./rules/a11y/require_aria_label_for_modals");
14
- const consistent_is_invalid_props_1 = require("./rules/a11y/consistent_is_invalid_props");
21
+ const require_table_caption_1 = require("./rules/a11y/require_table_caption");
15
22
  const sr_output_disabled_tooltip_1 = require("./rules/a11y/sr_output_disabled_tooltip");
16
- const prefer_eui_icon_tip_1 = require("./rules/a11y/prefer_eui_icon_tip");
17
- const no_unnamed_radio_group_1 = require("./rules/a11y/no_unnamed_radio_group");
18
- const no_unnamed_interactive_element_1 = require("./rules/a11y/no_unnamed_interactive_element");
19
23
  const tooltip_focusable_anchor_1 = require("./rules/a11y/tooltip_focusable_anchor");
20
- const callout_announce_on_mount_1 = require("./rules/a11y/callout_announce_on_mount");
21
- const accessible_interactive_element_1 = require("./rules/a11y/accessible_interactive_element");
22
- const require_table_caption_1 = require("./rules/a11y/require_table_caption");
23
24
  const config = {
24
25
  rules: {
26
+ 'accessible-interactive-element': accessible_interactive_element_1.AccessibleInteractiveElements,
27
+ 'callout-announce-on-mount': callout_announce_on_mount_1.CallOutAnnounceOnMount,
28
+ 'consistent-is-invalid-props': consistent_is_invalid_props_1.ConsistentIsInvalidProps,
25
29
  'href-or-on-click': href_or_on_click_1.HrefOnClick,
26
- 'no-restricted-eui-imports': no_restricted_eui_imports_1.NoRestrictedEuiImports,
27
30
  'no-css-color': no_css_color_1.NoCssColor,
31
+ 'no-restricted-eui-imports': no_restricted_eui_imports_1.NoRestrictedEuiImports,
32
+ 'no-static-z-index': no_static_z_index_1.NoStaticZIndex,
33
+ 'no-unnamed-interactive-element': no_unnamed_interactive_element_1.NoUnnamedInteractiveElement,
34
+ 'no-unnamed-radio-group': no_unnamed_radio_group_1.NoUnnamedRadioGroup,
35
+ 'prefer-eui-icon-tip': prefer_eui_icon_tip_1.PreferEuiIconTip,
28
36
  'require-aria-label-for-modals': require_aria_label_for_modals_1.RequireAriaLabelForModals,
29
- 'consistent-is-invalid-props': consistent_is_invalid_props_1.ConsistentIsInvalidProps,
37
+ 'require-table-caption': require_table_caption_1.RequireTableCaption,
30
38
  'sr-output-disabled-tooltip': sr_output_disabled_tooltip_1.ScreenReaderOutputDisabledTooltip,
31
- 'prefer-eui-icon-tip': prefer_eui_icon_tip_1.PreferEuiIconTip,
32
- 'no-unnamed-radio-group': no_unnamed_radio_group_1.NoUnnamedRadioGroup,
33
- 'callout-announce-on-mount': callout_announce_on_mount_1.CallOutAnnounceOnMount,
34
- 'no-unnamed-interactive-element': no_unnamed_interactive_element_1.NoUnnamedInteractiveElement,
35
39
  'tooltip-focusable-anchor': tooltip_focusable_anchor_1.TooltipFocusableAnchor,
36
- 'accessible-interactive-element': accessible_interactive_element_1.AccessibleInteractiveElements,
37
- 'require-table-caption': require_table_caption_1.RequireTableCaption,
38
40
  },
39
41
  configs: {
40
42
  recommended: {
41
43
  plugins: ['@elastic/eslint-plugin-eui'],
42
44
  rules: {
45
+ '@elastic/eui/accessible-interactive-element': 'warn',
46
+ '@elastic/eui/callout-announce-on-mount': 'warn',
47
+ '@elastic/eui/consistent-is-invalid-props': 'warn',
43
48
  '@elastic/eui/href-or-on-click': 'warn',
44
- '@elastic/eui/no-restricted-eui-imports': 'warn',
45
49
  '@elastic/eui/no-css-color': 'warn',
50
+ '@elastic/eui/no-restricted-eui-imports': 'warn',
51
+ '@elastic/eui/no-static-z-index': 'warn',
52
+ '@elastic/eui/no-unnamed-interactive-element': 'warn',
53
+ '@elastic/eui/no-unnamed-radio-group': 'warn',
54
+ '@elastic/eui/prefer-eui-icon-tip': 'warn',
46
55
  '@elastic/eui/require-aria-label-for-modals': 'warn',
47
- '@elastic/eui/consistent-is-invalid-props': 'warn',
56
+ '@elastic/eui/require-table-caption': 'warn',
48
57
  '@elastic/eui/sr-output-disabled-tooltip': 'warn',
49
- '@elastic/eui/prefer-eui-icon-tip': 'warn',
50
- '@elastic/eui/no-unnamed-radio-group': 'warn',
51
- '@elastic/eui/callout-announce-on-mount': 'warn',
52
- '@elastic/eui/no-unnamed-interactive-element': 'warn',
53
58
  '@elastic/eui/tooltip-focusable-anchor': 'warn',
54
- '@elastic/eui/accessible-interactive-element': 'warn',
55
- '@elastic/eui/require-table-caption': 'warn',
56
59
  },
57
60
  },
58
61
  },
@@ -1 +1 @@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ACF;CACF,CAAC;AAEF,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC"}
@@ -11,6 +11,7 @@ exports.NoCssColor = void 0;
11
11
  const cssstyle_1 = require("cssstyle");
12
12
  const utils_1 = require("@typescript-eslint/utils");
13
13
  const resolve_member_expression_root_1 = require("../utils/resolve_member_expression_root");
14
+ const get_property_name_1 = require("../utils/get_property_name");
14
15
  /**
15
16
  * @description List of superset css properties that can apply color to html box element elements and text nodes, leveraging the
16
17
  * css style package allows us to directly singly check for these properties even if the actual declaration was written using the shorthand form
@@ -44,7 +45,7 @@ const checkPropertySpecifiesInvalidCSSColor = ([property, value]) => {
44
45
  'initial',
45
46
  'unset',
46
47
  'revert',
47
- 'revert-layer'
48
+ 'revert-layer',
48
49
  ];
49
50
  const normalizedColorValue = colorValue.toLowerCase().trim();
50
51
  if (allowedCssKeywords.includes(normalizedColorValue)) {
@@ -57,14 +58,14 @@ const checkPropertySpecifiesInvalidCSSColor = ([property, value]) => {
57
58
  */
58
59
  const raiseReportIfPropertyHasInvalidCssColor = (context, propertyNode, messageToReport) => {
59
60
  let didReport = false;
60
- if (propertyNode.key.type === 'Identifier' &&
61
- !htmlElementColorDeclarationRegex.test(propertyNode.key.name)) {
61
+ const propertyName = (0, get_property_name_1.getPropertyName)(propertyNode);
62
+ if (!propertyName || !htmlElementColorDeclarationRegex.test(propertyName)) {
62
63
  return didReport;
63
64
  }
64
65
  if (propertyNode.value.type === 'Literal') {
65
66
  if ((didReport = checkPropertySpecifiesInvalidCSSColor([
66
- // @ts-expect-error the key name is present in this scenario
67
- propertyNode.key.name,
67
+ propertyName,
68
+ // @ts-expect-error the value is present in this scenario
68
69
  propertyNode.value.value,
69
70
  ]))) {
70
71
  context.report(messageToReport);
@@ -138,7 +139,8 @@ const handleObjectProperties = (context, propertyParentNode, property, reportMes
138
139
  else if (property.type === 'SpreadElement') {
139
140
  const spreadElementIdentifierName = property.argument.name;
140
141
  const spreadElementDeclaration = context.sourceCode
141
- .getScope(propertyParentNode.value.expression)
142
+ .getScope(propertyParentNode.value
143
+ .expression)
142
144
  .references.find((ref) => ref.identifier.name === spreadElementIdentifierName)?.resolved;
143
145
  if (!spreadElementDeclaration) {
144
146
  return;
@@ -327,7 +329,8 @@ exports.NoCssColor = utils_1.ESLintUtils.RuleCreator.withoutDocs({
327
329
  node.value.expression.type === 'ArrowFunctionExpression') {
328
330
  let declarationPropertiesNode = [];
329
331
  if (node.value.expression.body.type === 'ObjectExpression') {
330
- declarationPropertiesNode = node.value.expression.body.properties;
332
+ declarationPropertiesNode = node.value.expression.body
333
+ .properties;
331
334
  }
332
335
  if (node.value.expression.body.type === 'BlockStatement') {
333
336
  const functionReturnStatementNode = node.value.expression.body.body?.find((_node) => {
@@ -1 +1 @@
1
- {"version":3,"file":"no_css_color.js","sourceRoot":"","sources":["../../../src/rules/no_css_color.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,uCAA+C;AAC/C,oDAAiE;AAEjE,4FAAsF;AAWtF;;;GAGG;AACH,MAAM,4BAA4B,GAAG,CAAC,OAAO,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAC;AAEvE;;;GAGG;AACH,MAAM,gCAAgC,GAAG,MAAM,CAC7C,MAAM,CAAC,GAAG,CAAA,IAAI,4BAA4B,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CACxD,CAAC;AAEF,MAAM,qCAAqC,GAAG,CAAC,CAAC,QAAQ,EAAE,KAAK,CAAW,EAAE,EAAE;IAC5E,IAAI,CAAC,QAAQ,IAAI,CAAC,KAAK;QAAE,OAAO,KAAK,CAAC;IAEtC,MAAM,KAAK,GAAG,IAAI,8BAAmB,EAAE,CAAC;IAExC,4HAA4H;IAC5H,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;IAE1E,MAAM,MAAM,GAAG,4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AsB,CAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE;gCAC9C,GAAG,EAAE,QAAQ,CAAC,GAAG;gCACjB,SAAS,EAAE,oBAAoB;gCAC/B,IAAI,EAAE;oCACJ,kFAAkF;oCAClF,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,IAAI;iCAC5B;6BACF,CAAC,CAAC;wBACL,CAAC,CAAC,CAAC;wBAEH,OAAO;oBACT,CAAC;gBACH,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE;YACJ,WAAW,EACT,qEAAqE;SACxE;QACD,QAAQ,EAAE;YACR,kCAAkC,EAChC,iJAAiJ;YACnJ,kBAAkB,EAChB,0FAA0F;YAC5F,UAAU,EACR,uEAAuE;SAC1E;QACD,MAAM,EAAE,EAAE;KACX;IACD,cAAc,EAAE,EAAE;CACnB,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { ESLintUtils } from '@typescript-eslint/utils';
2
+ export declare const NoStaticZIndex: ESLintUtils.RuleModule<"noStaticZIndex" | "noStaticZIndexSpecific" | "noStaticZIndexSpecificDeclaredVariable", [], unknown, ESLintUtils.RuleListener>;
@@ -0,0 +1,394 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
4
+ * or more contributor license agreements. Licensed under the Elastic License
5
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
6
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
7
+ * Side Public License, v 1.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.NoStaticZIndex = void 0;
11
+ const utils_1 = require("@typescript-eslint/utils");
12
+ const get_property_name_1 = require("../utils/get_property_name");
13
+ const propertiesCheckingZIndex = ['zIndex', 'z-index'];
14
+ const zIndexDeclarationRegex = RegExp(String.raw `(${propertiesCheckingZIndex.join('|')})`);
15
+ // Regex to find z-index declarations in CSS strings
16
+ // Matches:
17
+ // 1. z-index property name (case insensitive)
18
+ // 2. colon
19
+ // 3. value (captured group 1) until semicolon, closing brace, or !important
20
+ const cssZIndexRegex = /z-index\s*:\s*([^;!}]+)/gi;
21
+ const checkPropertySpecifiesInvalidZIndex = (property, value) => {
22
+ if (!property || value === undefined || value === null)
23
+ return false;
24
+ const normalizedProperty = property.trim();
25
+ const isZIndex = propertiesCheckingZIndex.includes(normalizedProperty);
26
+ if (!isZIndex)
27
+ return false;
28
+ return isInvalidZIndexValue(value);
29
+ };
30
+ const isInvalidZIndexValue = (value) => {
31
+ const allowedCssKeywords = [
32
+ 'auto',
33
+ 'inherit',
34
+ 'initial',
35
+ 'unset',
36
+ 'revert',
37
+ 'revert-layer',
38
+ ];
39
+ const stringValue = String(value).trim().toLowerCase();
40
+ if (allowedCssKeywords.includes(stringValue)) {
41
+ return false;
42
+ }
43
+ // Check if it's a number (positive, negative, or zero)
44
+ // This regex allows integers. z-index only accepts integers.
45
+ if (/^-?\d+$/.test(stringValue)) {
46
+ return true;
47
+ }
48
+ return false;
49
+ };
50
+ const raiseReportIfPropertyHasInvalidZIndex = (context, propertyNode, messageToReport) => {
51
+ let didReport = false;
52
+ const propertyName = (0, get_property_name_1.getPropertyName)(propertyNode);
53
+ if (!propertyName || !zIndexDeclarationRegex.test(propertyName)) {
54
+ return didReport;
55
+ }
56
+ const visitNode = (node) => {
57
+ // Handle Literal values: zIndex: 10, 'z-index': '10'
58
+ if (node.type === 'Literal') {
59
+ if (checkPropertySpecifiesInvalidZIndex(propertyName, node.value)) {
60
+ didReport = true;
61
+ context.report({
62
+ ...messageToReport,
63
+ loc: node.loc,
64
+ });
65
+ }
66
+ }
67
+ // Handle Identifier values: zIndex: someVar
68
+ else if (node.type === 'Identifier') {
69
+ const identifierName = node.name;
70
+ const identifierDeclaration = context.sourceCode
71
+ .getScope(node)
72
+ .variables.find((variable) => variable.name === identifierName);
73
+ const identifierDeclarationInit = identifierDeclaration?.defs[0]?.node.type === 'VariableDeclarator'
74
+ ? identifierDeclaration.defs[0].node.init
75
+ : undefined;
76
+ if (identifierDeclarationInit?.type === 'Literal' &&
77
+ checkPropertySpecifiesInvalidZIndex(propertyName, identifierDeclarationInit.value)) {
78
+ didReport = true;
79
+ context.report({
80
+ loc: node.loc,
81
+ messageId: 'noStaticZIndexSpecificDeclaredVariable',
82
+ data: {
83
+ property: propertyName,
84
+ line: String(node.loc.start.line),
85
+ variableName: node.name,
86
+ },
87
+ });
88
+ }
89
+ }
90
+ else if (node.type === 'ConditionalExpression') {
91
+ visitNode(node.consequent);
92
+ visitNode(node.alternate);
93
+ }
94
+ else if (node.type === 'LogicalExpression') {
95
+ visitNode(node.left);
96
+ visitNode(node.right);
97
+ }
98
+ else if (node.type === 'TSAsExpression') {
99
+ visitNode(node.expression);
100
+ }
101
+ else if (node.type === 'UnaryExpression') {
102
+ if (node.operator === '-') {
103
+ if (node.argument.type === 'Literal' &&
104
+ typeof node.argument.value === 'number') {
105
+ if (checkPropertySpecifiesInvalidZIndex(propertyName, -node.argument.value)) {
106
+ didReport = true;
107
+ context.report({
108
+ ...messageToReport,
109
+ loc: node.loc,
110
+ });
111
+ }
112
+ }
113
+ else {
114
+ visitNode(node.argument);
115
+ }
116
+ }
117
+ }
118
+ };
119
+ if (propertyNode.value) {
120
+ visitNode(propertyNode.value);
121
+ }
122
+ return didReport;
123
+ };
124
+ const handleObjectProperties = (context, propertyParentNode, property, reportMessage) => {
125
+ if (property.type === 'Property') {
126
+ if (property.value.type === 'ObjectExpression') {
127
+ property.value.properties.forEach((nestedProperty) => {
128
+ const nestedReportMessage = {
129
+ ...reportMessage,
130
+ loc: nestedProperty.loc,
131
+ };
132
+ if (nestedReportMessage.data) {
133
+ const newData = {
134
+ ...nestedReportMessage.data,
135
+ property: (0, get_property_name_1.getPropertyName)(nestedProperty) || 'unknown',
136
+ };
137
+ if ('line' in newData) {
138
+ newData.line = String(nestedProperty.loc.start.line);
139
+ }
140
+ nestedReportMessage.data = newData;
141
+ }
142
+ handleObjectProperties(context, propertyParentNode, nestedProperty, nestedReportMessage);
143
+ });
144
+ }
145
+ else {
146
+ raiseReportIfPropertyHasInvalidZIndex(context, property, reportMessage);
147
+ }
148
+ }
149
+ else if (property.type === 'SpreadElement') {
150
+ if (property.argument.type !== 'Identifier') {
151
+ return;
152
+ }
153
+ const spreadElementIdentifierName = property.argument.name;
154
+ let scopeNode = propertyParentNode;
155
+ if (propertyParentNode.type === 'JSXAttribute' &&
156
+ propertyParentNode.value?.type === 'JSXExpressionContainer') {
157
+ scopeNode = propertyParentNode.value.expression;
158
+ }
159
+ const spreadElementDeclaration = context.sourceCode
160
+ .getScope(scopeNode)
161
+ .references.find((ref) => ref.identifier.name === spreadElementIdentifierName)?.resolved;
162
+ if (!spreadElementDeclaration) {
163
+ return;
164
+ }
165
+ const propertyName = (0, get_property_name_1.getPropertyName)(property) || 'spread';
166
+ reportMessage = {
167
+ loc: propertyParentNode.loc,
168
+ messageId: 'noStaticZIndexSpecificDeclaredVariable',
169
+ data: {
170
+ property: propertyName,
171
+ variableName: spreadElementIdentifierName,
172
+ line: String(property.loc.start.line),
173
+ },
174
+ };
175
+ const spreadElementDeclarationNode = spreadElementDeclaration.defs[0]?.node.type === 'VariableDeclarator'
176
+ ? spreadElementDeclaration.defs[0].node.init
177
+ : undefined;
178
+ if (spreadElementDeclarationNode?.type === 'ObjectExpression') {
179
+ spreadElementDeclarationNode.properties.forEach((spreadProperty) => {
180
+ handleObjectProperties(context, propertyParentNode, spreadProperty, reportMessage);
181
+ });
182
+ }
183
+ }
184
+ };
185
+ const checkTemplateLiteralForZIndex = (context, node) => {
186
+ for (let i = 0; i < node.quasis.length; i++) {
187
+ const declarationTemplateNode = node.quasis[i];
188
+ const rawValue = declarationTemplateNode.value.raw;
189
+ // Strip comments
190
+ const valueWithoutComments = rawValue.replace(/\/\*[\s\S]*?\*\//g, '');
191
+ let match;
192
+ // reset regex state
193
+ cssZIndexRegex.lastIndex = 0;
194
+ while ((match = cssZIndexRegex.exec(valueWithoutComments)) !== null) {
195
+ const value = match[1].trim();
196
+ if (isInvalidZIndexValue(value)) {
197
+ context.report({
198
+ node: declarationTemplateNode,
199
+ messageId: 'noStaticZIndex',
200
+ });
201
+ }
202
+ }
203
+ }
204
+ };
205
+ exports.NoStaticZIndex = utils_1.ESLintUtils.RuleCreator.withoutDocs({
206
+ create(context) {
207
+ return {
208
+ TaggedTemplateExpression(node) {
209
+ if (node.tag.type !== 'Identifier' ||
210
+ (node.tag.type === 'Identifier' && node.tag.name !== 'css')) {
211
+ return;
212
+ }
213
+ checkTemplateLiteralForZIndex(context, node.quasi);
214
+ },
215
+ JSXAttribute(node) {
216
+ if (!(node.name.name === 'style' || node.name.name === 'css')) {
217
+ return;
218
+ }
219
+ if (!node.value || node.value.type !== 'JSXExpressionContainer') {
220
+ return;
221
+ }
222
+ const expression = node.value.expression;
223
+ // Handle identifier expression: style={someStyle}
224
+ if (expression.type === 'Identifier') {
225
+ const styleVariableName = expression.name;
226
+ const nodeScope = context.sourceCode.getScope(expression);
227
+ const variableDeclarationMatches = nodeScope.references.find((ref) => ref.identifier.name === styleVariableName)?.resolved;
228
+ let variableInitializationNode;
229
+ if (variableDeclarationMatches?.defs[0]?.node.type ===
230
+ 'VariableDeclarator' &&
231
+ variableDeclarationMatches.defs[0].node.init) {
232
+ variableInitializationNode =
233
+ variableDeclarationMatches.defs[0].node.init;
234
+ if (variableInitializationNode.type === 'ObjectExpression') {
235
+ variableInitializationNode.properties.forEach((property) => {
236
+ handleObjectProperties(context, node, property, {
237
+ loc: property.loc,
238
+ messageId: 'noStaticZIndexSpecificDeclaredVariable',
239
+ data: {
240
+ property: (0, get_property_name_1.getPropertyName)(property) || 'unknown',
241
+ variableName: styleVariableName,
242
+ line: String(property.loc.start.line),
243
+ },
244
+ });
245
+ });
246
+ }
247
+ else if (variableInitializationNode.type === 'CallExpression' &&
248
+ variableInitializationNode.callee.type === 'Identifier' &&
249
+ variableInitializationNode.callee.name === 'css') {
250
+ variableInitializationNode.arguments.forEach((argument) => {
251
+ if (argument.type === 'ObjectExpression') {
252
+ argument.properties.forEach((property) => {
253
+ handleObjectProperties(context, node, property, {
254
+ loc: property.loc,
255
+ messageId: 'noStaticZIndexSpecificDeclaredVariable',
256
+ data: {
257
+ property: (0, get_property_name_1.getPropertyName)(property) || 'unknown',
258
+ variableName: styleVariableName,
259
+ line: String(property.loc.start.line),
260
+ },
261
+ });
262
+ });
263
+ }
264
+ });
265
+ }
266
+ }
267
+ return;
268
+ }
269
+ // Handle inline object: style={{ zIndex: 10 }}
270
+ if (expression.type === 'ObjectExpression') {
271
+ const declarationPropertiesNode = expression.properties;
272
+ declarationPropertiesNode?.forEach((property) => {
273
+ handleObjectProperties(context, node, property, {
274
+ loc: property.loc,
275
+ messageId: 'noStaticZIndexSpecific',
276
+ data: {
277
+ property: (0, get_property_name_1.getPropertyName)(property) || 'unknown',
278
+ },
279
+ });
280
+ });
281
+ return;
282
+ }
283
+ // Handle inline CallExpression: css={css({ zIndex: 10 })}
284
+ if (expression.type === 'CallExpression' &&
285
+ expression.callee.type === 'Identifier' &&
286
+ expression.callee.name === 'css') {
287
+ expression.arguments.forEach((argument) => {
288
+ if (argument.type === 'ObjectExpression') {
289
+ argument.properties.forEach((property) => {
290
+ handleObjectProperties(context, node, property, {
291
+ loc: node.loc,
292
+ messageId: 'noStaticZIndexSpecific',
293
+ data: {
294
+ property: (0, get_property_name_1.getPropertyName)(property) || 'unknown',
295
+ },
296
+ });
297
+ });
298
+ }
299
+ });
300
+ return;
301
+ }
302
+ // Handle inline ArrayExpression: css={[...]}
303
+ if (expression.type === 'ArrayExpression') {
304
+ expression.elements.forEach((element) => {
305
+ if (!element)
306
+ return;
307
+ if (element.type === 'ObjectExpression') {
308
+ element.properties.forEach((property) => {
309
+ handleObjectProperties(context, node, property, {
310
+ loc: property.loc,
311
+ messageId: 'noStaticZIndexSpecific',
312
+ data: {
313
+ property: (0, get_property_name_1.getPropertyName)(property) || 'unknown',
314
+ },
315
+ });
316
+ });
317
+ }
318
+ else if (element.type === 'CallExpression' &&
319
+ element.callee.type === 'Identifier' &&
320
+ element.callee.name === 'css') {
321
+ element.arguments.forEach((argument) => {
322
+ if (argument.type === 'ObjectExpression') {
323
+ argument.properties.forEach((property) => {
324
+ handleObjectProperties(context, node, property, {
325
+ loc: property.loc,
326
+ messageId: 'noStaticZIndexSpecific',
327
+ data: {
328
+ property: (0, get_property_name_1.getPropertyName)(property) || 'unknown',
329
+ },
330
+ });
331
+ });
332
+ }
333
+ });
334
+ }
335
+ });
336
+ }
337
+ // Handle css prop with template literal or function
338
+ if (node.name.name === 'css') {
339
+ // css={`...`}
340
+ if (expression.type === 'TemplateLiteral') {
341
+ checkTemplateLiteralForZIndex(context, expression);
342
+ return;
343
+ }
344
+ // css={() => ({ ... })} or css={function() { return { ... } }}
345
+ if (expression.type === 'FunctionExpression' ||
346
+ expression.type === 'ArrowFunctionExpression') {
347
+ let declarationPropertiesNode = [];
348
+ if (expression.body.type === 'ObjectExpression') {
349
+ declarationPropertiesNode = expression.body.properties;
350
+ }
351
+ if (expression.body.type === 'BlockStatement') {
352
+ const functionReturnStatementNode = expression.body.body?.find((_node) => {
353
+ return _node.type === 'ReturnStatement';
354
+ });
355
+ if (functionReturnStatementNode?.type === 'ReturnStatement' &&
356
+ functionReturnStatementNode.argument?.type ===
357
+ 'ObjectExpression') {
358
+ declarationPropertiesNode =
359
+ functionReturnStatementNode.argument.properties.filter((property) => property.type === 'Property');
360
+ }
361
+ }
362
+ if (!declarationPropertiesNode.length) {
363
+ return;
364
+ }
365
+ declarationPropertiesNode.forEach((property) => {
366
+ handleObjectProperties(context, node, property, {
367
+ loc: property.loc,
368
+ messageId: 'noStaticZIndexSpecific',
369
+ data: {
370
+ property: (0, get_property_name_1.getPropertyName)(property) || 'unknown',
371
+ },
372
+ });
373
+ });
374
+ return;
375
+ }
376
+ }
377
+ },
378
+ };
379
+ },
380
+ meta: {
381
+ type: 'suggestion',
382
+ docs: {
383
+ description: 'Use `z-index` definitions from `euiTheme` as opposed to static values',
384
+ },
385
+ messages: {
386
+ noStaticZIndexSpecificDeclaredVariable: 'Avoid using a literal z-index value for "{{property}}", use an EUI theme z-index level instead in declared variable {{variableName}} on line {{line}}',
387
+ noStaticZIndexSpecific: 'Avoid using a literal z-index value for "{{property}}", use an EUI theme z-index level instead',
388
+ noStaticZIndex: 'Avoid using a literal z-index value, use an EUI theme z-index level instead',
389
+ },
390
+ schema: [],
391
+ },
392
+ defaultOptions: [],
393
+ });
394
+ //# sourceMappingURL=no_static_z_index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no_static_z_index.js","sourceRoot":"","sources":["../../../src/rules/no_static_z_index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,oDAAiE;AAKjE,kEAA6D;AAO7D,MAAM,wBAAwB,GAAG,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;AAEvD,MAAM,sBAAsB,GAAG,MAAM,CACnC,MAAM,CAAC,GAAG,CAAA,IAAI,wBAAwB,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CACpD,CAAC;AAEF,oDAAoD;AACpD,WAAW;AACX,8CAA8C;AAC9C,WAAW;AACX,4EAA4E;AAC5E,MAAM,cAAc,GAAG,2BAA2B,CAAC;AAEnD,MAAM,mCAAmC,GAAG,CAC1C,QAAgB,EAChB,KAAc,EACd,EAAE;IACF,IAAI,CAAC,QAAQ,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAErE,MAAM,kBAAkB,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC;IAC3C,MAAM,QAAQ,GAAG,wBAAwB,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC;IAEvE,IAAI,CAAC,QAAQ;QAAE,OAAO,KAAK,CAAC;IAE5B,OAAO,oBAAoB,CAAC,KAAK,CAAC,CAAC;AACrC,CAAC,CAAC;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E;YACR,sCAAsC,EACpC,uJAAuJ;YACzJ,sBAAsB,EACpB,gGAAgG;YAClG,cAAc,EACZ,6EAA6E;SAChF;QACD,MAAM,EAAE,EAAE;KACX;IACD,cAAc,EAAE,EAAE;CACnB,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { TSESTree } from '@typescript-eslint/utils';
2
+ export declare const getPropertyName: (propertyNode: TSESTree.Property | TSESTree.SpreadElement) => string | null;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
4
+ * or more contributor license agreements. Licensed under the Elastic License
5
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
6
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
7
+ * Side Public License, v 1.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.getPropertyName = void 0;
11
+ const getPropertyName = (propertyNode) => {
12
+ if (propertyNode.type === 'Property') {
13
+ if (propertyNode.key.type === 'Identifier') {
14
+ return propertyNode.key.name;
15
+ }
16
+ if (propertyNode.key.type === 'Literal') {
17
+ return String(propertyNode.key.value);
18
+ }
19
+ }
20
+ else if (propertyNode.type === 'SpreadElement' &&
21
+ propertyNode.argument.type === 'Identifier') {
22
+ return propertyNode.argument.name;
23
+ }
24
+ return null;
25
+ };
26
+ exports.getPropertyName = getPropertyName;
27
+ //# sourceMappingURL=get_property_name.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get_property_name.js","sourceRoot":"","sources":["../../../src/utils/get_property_name.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAII,MAAM,eAAe,GAAG,CAC7B,YAAwD,EACzC,EAAE;IACjB,IAAI,YAAY,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;QACrC,IAAI,YAAY,CAAC,GAAG,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;YAC3C,OAAO,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC;QAC/B,CAAC;QACD,IAAI,YAAY,CAAC,GAAG,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YACxC,OAAO,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACxC,CAAC;IACH,CAAC;SAAM,IACL,YAAY,CAAC,IAAI,KAAK,eAAe;QACrC,YAAY,CAAC,QAAQ,CAAC,IAAI,KAAK,YAAY,EAC3C,CAAC;QACD,OAAO,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC;IACpC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAjBW,QAAA,eAAe,mBAiB1B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elastic/eslint-plugin-eui",
3
- "version": "2.6.0",
3
+ "version": "2.7.0",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",