@elastic/eslint-plugin-eui 2.6.0 → 2.8.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/README.md +15 -0
- package/lib/cjs/index.js +33 -24
- package/lib/cjs/rules/a11y/badge_accessibility_rules.d.ts +3 -0
- package/lib/cjs/rules/a11y/badge_accessibility_rules.d.ts.map +1 -0
- package/lib/cjs/rules/a11y/badge_accessibility_rules.js +82 -0
- package/lib/cjs/rules/a11y/icon_accessibility_rules.d.ts +3 -0
- package/lib/cjs/rules/a11y/icon_accessibility_rules.d.ts.map +1 -0
- package/lib/cjs/rules/a11y/icon_accessibility_rules.js +82 -0
- package/lib/cjs/rules/no_css_color.d.ts.map +1 -1
- package/lib/cjs/rules/no_css_color.js +6 -4
- package/lib/cjs/rules/no_static_z_index.d.ts +3 -0
- package/lib/cjs/rules/no_static_z_index.d.ts.map +1 -0
- package/lib/cjs/rules/no_static_z_index.js +361 -0
- package/lib/cjs/utils/get_property_name.d.ts +3 -0
- package/lib/cjs/utils/get_property_name.d.ts.map +1 -0
- package/lib/cjs/utils/get_property_name.js +28 -0
- package/lib/cjs/utils/remove_attr.d.ts +26 -0
- package/lib/cjs/utils/remove_attr.d.ts.map +1 -0
- package/lib/cjs/utils/remove_attr.js +39 -0
- package/lib/esm/index.js +33 -24
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/rules/a11y/badge_accessibility_rules.d.ts +2 -0
- package/lib/esm/rules/a11y/badge_accessibility_rules.js +84 -0
- package/lib/esm/rules/a11y/badge_accessibility_rules.js.map +1 -0
- package/lib/esm/rules/a11y/icon_accessibility_rules.d.ts +2 -0
- package/lib/esm/rules/a11y/icon_accessibility_rules.js +87 -0
- package/lib/esm/rules/a11y/icon_accessibility_rules.js.map +1 -0
- package/lib/esm/rules/no_css_color.js +10 -7
- package/lib/esm/rules/no_css_color.js.map +1 -1
- package/lib/esm/rules/no_static_z_index.d.ts +2 -0
- package/lib/esm/rules/no_static_z_index.js +394 -0
- package/lib/esm/rules/no_static_z_index.js.map +1 -0
- package/lib/esm/utils/get_property_name.d.ts +2 -0
- package/lib/esm/utils/get_property_name.js +27 -0
- package/lib/esm/utils/get_property_name.js.map +1 -0
- package/lib/esm/utils/remove_attr.d.ts +25 -0
- package/lib/esm/utils/remove_attr.js +34 -0
- package/lib/esm/utils/remove_attr.js.map +1 -0
- package/package.json +1 -1
|
@@ -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"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type TSESTree, type TSESLint } from '@typescript-eslint/utils';
|
|
2
|
+
/**
|
|
3
|
+
* Computes the removal range for a JSX attribute, including a preceding space
|
|
4
|
+
* when present, to keep formatting intact after autofix.
|
|
5
|
+
*
|
|
6
|
+
* This helper is useful in ESLint rule fixers when calling `fixer.removeRange(...)`,
|
|
7
|
+
* ensuring that the attribute and its leading space are removed cleanly.
|
|
8
|
+
*
|
|
9
|
+
* @typeParam TContext - An ESLint rule context type extending `TSESLint.RuleContext`.
|
|
10
|
+
* @param context - The current ESLint rule context providing access to `SourceCode`.
|
|
11
|
+
* @param attr - The JSX attribute node to remove.
|
|
12
|
+
* @returns A readonly tuple `[start, end]` representing the inclusive start and exclusive end indexes for removal.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* context.report({
|
|
17
|
+
* node: openingElement,
|
|
18
|
+
* messageId: 'removeAttr',
|
|
19
|
+
* fix: fixer => {
|
|
20
|
+
* const [start, end] = removeAttribute(context, ariaHiddenAttr);
|
|
21
|
+
* return fixer.removeRange([start, end]);
|
|
22
|
+
* },
|
|
23
|
+
* });
|
|
24
|
+
**/
|
|
25
|
+
export declare function removeAttribute<TContext extends TSESLint.RuleContext<string, unknown[]>>(context: TContext, attr: TSESTree.JSXAttribute): readonly [number, number];
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.removeAttribute = removeAttribute;
|
|
4
|
+
/**
|
|
5
|
+
* Computes the removal range for a JSX attribute, including a preceding space
|
|
6
|
+
* when present, to keep formatting intact after autofix.
|
|
7
|
+
*
|
|
8
|
+
* This helper is useful in ESLint rule fixers when calling `fixer.removeRange(...)`,
|
|
9
|
+
* ensuring that the attribute and its leading space are removed cleanly.
|
|
10
|
+
*
|
|
11
|
+
* @typeParam TContext - An ESLint rule context type extending `TSESLint.RuleContext`.
|
|
12
|
+
* @param context - The current ESLint rule context providing access to `SourceCode`.
|
|
13
|
+
* @param attr - The JSX attribute node to remove.
|
|
14
|
+
* @returns A readonly tuple `[start, end]` representing the inclusive start and exclusive end indexes for removal.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* context.report({
|
|
19
|
+
* node: openingElement,
|
|
20
|
+
* messageId: 'removeAttr',
|
|
21
|
+
* fix: fixer => {
|
|
22
|
+
* const [start, end] = removeAttribute(context, ariaHiddenAttr);
|
|
23
|
+
* return fixer.removeRange([start, end]);
|
|
24
|
+
* },
|
|
25
|
+
* });
|
|
26
|
+
**/
|
|
27
|
+
function removeAttribute(context, attr) {
|
|
28
|
+
const { sourceCode } = context;
|
|
29
|
+
const start = attr.range[0];
|
|
30
|
+
const before = sourceCode.text[start - 1];
|
|
31
|
+
const rangeStart = before === ' ' ? start - 1 : start;
|
|
32
|
+
return [rangeStart, attr.range[1]];
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=remove_attr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove_attr.js","sourceRoot":"","sources":["../../../src/utils/remove_attr.ts"],"names":[],"mappings":";;AA0BA,0CAWC;AAnCD;;;;;;;;;;;;;;;;;;;;;;IAsBI;AAEJ,SAAgB,eAAe,CAG7B,OAAiB,EACjB,IAA2B;IAC3B,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAC/B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC5B,MAAM,MAAM,GAAG,UAAU,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;IAC1C,MAAM,UAAU,GAAG,MAAM,KAAK,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAEtD,OAAO,CAAC,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAU,CAAC;AAC9C,CAAC"}
|