oxlint-plugin-react-doctor 0.9.0-dev.db9d300 → 0.9.1-dev.54ba416
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.js +12 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1017,11 +1017,14 @@ const forEachChildNode = (node, visit) => {
|
|
|
1017
1017
|
};
|
|
1018
1018
|
const walkAst = (node, visitor) => {
|
|
1019
1019
|
if (!node || typeof node !== "object") return;
|
|
1020
|
-
const
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1020
|
+
const pendingNodes = [node];
|
|
1021
|
+
while (pendingNodes.length > 0) {
|
|
1022
|
+
const currentNode = pendingNodes.pop();
|
|
1023
|
+
if (currentNode === void 0 || visitor(currentNode) === false) continue;
|
|
1024
|
+
const childNodes = [];
|
|
1025
|
+
forEachChildNode(currentNode, (childNode) => childNodes.push(childNode));
|
|
1026
|
+
for (let childIndex = childNodes.length - 1; childIndex >= 0; childIndex -= 1) pendingNodes.push(childNodes[childIndex]);
|
|
1027
|
+
}
|
|
1025
1028
|
};
|
|
1026
1029
|
//#endregion
|
|
1027
1030
|
//#region src/plugin/rules/state-and-effects/activity-wraps-effect-heavy-subtree.ts
|
|
@@ -43678,8 +43681,8 @@ const BODY_TEXT_ELEMENT_NAMES$1 = new Set([
|
|
|
43678
43681
|
"p",
|
|
43679
43682
|
"td"
|
|
43680
43683
|
]);
|
|
43681
|
-
const
|
|
43682
|
-
const
|
|
43684
|
+
const CASED_LETTER_PATTERN = /[\p{Lu}\p{Ll}\p{Lt}]/u;
|
|
43685
|
+
const UPPERCASE_LETTER_PATTERN = /\p{Lu}/u;
|
|
43683
43686
|
const hasUppercaseStyle = (node) => {
|
|
43684
43687
|
const classNameValue = getStringFromClassNameAttr(node);
|
|
43685
43688
|
if (classNameValue && getUnvariantClassNameTokens(classNameValue).includes("uppercase")) return true;
|
|
@@ -43704,8 +43707,8 @@ const noAllCapsBodyText = defineRule({
|
|
|
43704
43707
|
if (!isNodeOfType(openingElement.name, "JSXIdentifier")) return;
|
|
43705
43708
|
if (!BODY_TEXT_ELEMENT_NAMES$1.has(openingElement.name.name)) return;
|
|
43706
43709
|
const staticText = getStaticJsxText(node).replace(/\s+/g, " ").trim();
|
|
43707
|
-
if (staticText.length < 48 || !
|
|
43708
|
-
if (
|
|
43710
|
+
if (staticText.length < 48 || !CASED_LETTER_PATTERN.test(staticText)) return;
|
|
43711
|
+
if (!(UPPERCASE_LETTER_PATTERN.test(staticText) && staticText === staticText.toUpperCase()) && !hasUppercaseStyle(openingElement)) return;
|
|
43709
43712
|
context.report({
|
|
43710
43713
|
node: openingElement,
|
|
43711
43714
|
message: "Long all-caps copy is difficult to scan. Use sentence case here and keep uppercase treatment for compact labels."
|