@flint.fyi/jsx 0.5.0 → 0.6.1
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/dist/index.d.mts +0 -7
- package/dist/index.mjs +1 -37
- package/package.json +10 -10
package/dist/index.d.mts
CHANGED
|
@@ -231,13 +231,6 @@ declare const jsx: import("@flint.fyi/core").Plugin<import("@flint.fyi/core").Ru
|
|
|
231
231
|
readonly pluginId: string;
|
|
232
232
|
readonly url: string;
|
|
233
233
|
}, "nonInteractiveTabIndex", undefined>, import("@flint.fyi/core").Rule<{
|
|
234
|
-
readonly description: "Disallow duplicate props in JSX elements.";
|
|
235
|
-
readonly id: "propDuplicates";
|
|
236
|
-
readonly presets: readonly ["logical", "logicalStrict"];
|
|
237
|
-
} & {
|
|
238
|
-
readonly pluginId: string;
|
|
239
|
-
readonly url: string;
|
|
240
|
-
}, "duplicateProp", undefined>, import("@flint.fyi/core").Rule<{
|
|
241
234
|
readonly description: "Reports redundant ARIA roles on elements with implicit roles.";
|
|
242
235
|
readonly id: "roleRedundancies";
|
|
243
236
|
readonly presets: readonly ["logical", "logicalStrict"];
|
package/dist/index.mjs
CHANGED
|
@@ -1227,9 +1227,7 @@ var clickEventKeyEvents_default = ruleCreator.createRule(typescriptLanguage, {
|
|
|
1227
1227
|
case "onKeyDown":
|
|
1228
1228
|
case "onKeyPress":
|
|
1229
1229
|
case "onKeyUp": return;
|
|
1230
|
-
case "onClick":
|
|
1231
|
-
onClickName = property.name;
|
|
1232
|
-
break;
|
|
1230
|
+
case "onClick": onClickName = property.name;
|
|
1233
1231
|
}
|
|
1234
1232
|
if (onClickName) context.report({
|
|
1235
1233
|
message: "missingKeyEvent",
|
|
@@ -2229,39 +2227,6 @@ var nonInteractiveElementTabIndexes_default = ruleCreator.createRule(typescriptL
|
|
|
2229
2227
|
}
|
|
2230
2228
|
});
|
|
2231
2229
|
//#endregion
|
|
2232
|
-
//#region src/rules/propDuplicates.ts
|
|
2233
|
-
var propDuplicates_default = ruleCreator.createRule(typescriptLanguage, {
|
|
2234
|
-
about: {
|
|
2235
|
-
description: "Disallow duplicate props in JSX elements.",
|
|
2236
|
-
id: "propDuplicates",
|
|
2237
|
-
presets: ["logical", "logicalStrict"]
|
|
2238
|
-
},
|
|
2239
|
-
messages: { duplicateProp: {
|
|
2240
|
-
primary: "Duplicate prop `{{ propName }}` found in JSX element. The last occurrence will override earlier ones.",
|
|
2241
|
-
secondary: ["Having duplicate props can lead to unexpected behavior since only the last value is used.", "This makes the code harder to understand and maintain."],
|
|
2242
|
-
suggestions: ["Remove the duplicate prop and keep only one definition."]
|
|
2243
|
-
} },
|
|
2244
|
-
setup(context) {
|
|
2245
|
-
function checkElement(node, { sourceFile }) {
|
|
2246
|
-
const seenProps = /* @__PURE__ */ new Set();
|
|
2247
|
-
for (const property of node.attributes.properties) {
|
|
2248
|
-
if (property.kind !== SyntaxKind.JsxAttribute || property.name.kind !== SyntaxKind.Identifier) continue;
|
|
2249
|
-
const propName = property.name.text;
|
|
2250
|
-
if (seenProps.has(propName)) context.report({
|
|
2251
|
-
data: { propName },
|
|
2252
|
-
message: "duplicateProp",
|
|
2253
|
-
range: getTSNodeRange(property.name, sourceFile)
|
|
2254
|
-
});
|
|
2255
|
-
else seenProps.add(propName);
|
|
2256
|
-
}
|
|
2257
|
-
}
|
|
2258
|
-
return { visitors: {
|
|
2259
|
-
JsxOpeningElement: checkElement,
|
|
2260
|
-
JsxSelfClosingElement: checkElement
|
|
2261
|
-
} };
|
|
2262
|
-
}
|
|
2263
|
-
});
|
|
2264
|
-
//#endregion
|
|
2265
2230
|
//#region src/rules/roleRedundancies.ts
|
|
2266
2231
|
const implicitRoles$1 = {
|
|
2267
2232
|
a: "link",
|
|
@@ -3218,7 +3183,6 @@ const jsx = createPlugin({
|
|
|
3218
3183
|
nonInteractiveElementInteractions_default,
|
|
3219
3184
|
nonInteractiveElementRoles_default,
|
|
3220
3185
|
nonInteractiveElementTabIndexes_default,
|
|
3221
|
-
propDuplicates_default,
|
|
3222
3186
|
roleRedundancies_default,
|
|
3223
3187
|
roleRequiredAriaProps_default,
|
|
3224
3188
|
roleSupportedAriaProps_default,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flint.fyi/jsx",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "[Experimental] A Flint plugin for JSX code.",
|
|
5
5
|
"homepage": "https://flint.fyi/rules/jsx",
|
|
6
6
|
"repository": {
|
|
@@ -22,21 +22,21 @@
|
|
|
22
22
|
"dist/"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
+
"@flint.fyi/core": "^0.26.0",
|
|
26
|
+
"@flint.fyi/typescript-language": "^0.20.1",
|
|
27
|
+
"@flint.fyi/utils": "^0.16.0",
|
|
25
28
|
"language-tags": "^2.1.0",
|
|
26
|
-
"typescript": "^6.0.0"
|
|
27
|
-
"@flint.fyi/core": "^0.24.0",
|
|
28
|
-
"@flint.fyi/typescript-language": "^0.19.0",
|
|
29
|
-
"@flint.fyi/utils": "^0.15.0"
|
|
29
|
+
"typescript": "^6.0.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
+
"@flint.fyi/build": "^0.1.0",
|
|
33
|
+
"@flint.fyi/rule-tester": "^0.19.1",
|
|
32
34
|
"@types/language-tags": "1.0.4",
|
|
33
|
-
"tsdown": "0.22.
|
|
34
|
-
"vitest": "4.1.
|
|
35
|
-
"@flint.fyi/rule-tester": "^0.17.0",
|
|
36
|
-
"@flint.fyi/build": "^0.1.0"
|
|
35
|
+
"tsdown": "0.22.14",
|
|
36
|
+
"vitest": "4.1.11"
|
|
37
37
|
},
|
|
38
38
|
"engines": {
|
|
39
|
-
"node": ">=
|
|
39
|
+
"node": ">=26.1.0"
|
|
40
40
|
},
|
|
41
41
|
"publishConfig": {
|
|
42
42
|
"access": "public"
|