oxlint-plugin-react-doctor 0.2.11-dev.b2934f9 → 0.2.11-dev.b65b157
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 +1 -22
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -26668,7 +26668,6 @@ const REACT_NATIVE_TEXT_COMPONENT_KEYWORDS = new Set([
|
|
|
26668
26668
|
"Description",
|
|
26669
26669
|
"Body"
|
|
26670
26670
|
]);
|
|
26671
|
-
const REACT_NATIVE_TEXT_TRANSPARENT_COMPONENTS = new Set(["fbt", "fbs"]);
|
|
26672
26671
|
const DEPRECATED_RN_MODULE_REPLACEMENTS = new Map([
|
|
26673
26672
|
["AsyncStorage", "@react-native-async-storage/async-storage"],
|
|
26674
26673
|
["Picker", "@react-native-picker/picker"],
|
|
@@ -27501,29 +27500,10 @@ const getRawTextDescription = (child) => {
|
|
|
27501
27500
|
}
|
|
27502
27501
|
return "text content";
|
|
27503
27502
|
};
|
|
27504
|
-
const resolveTextBoundaryName = (openingElement) => {
|
|
27505
|
-
if (isNodeOfType(openingElement.name, "JSXNamespacedName")) return openingElement.name.namespace.name;
|
|
27506
|
-
return resolveJsxElementName(openingElement);
|
|
27507
|
-
};
|
|
27508
27503
|
const isTextHandlingComponent = (elementName) => {
|
|
27509
27504
|
if (REACT_NATIVE_TEXT_COMPONENTS.has(elementName)) return true;
|
|
27510
27505
|
return [...REACT_NATIVE_TEXT_COMPONENT_KEYWORDS].some((keyword) => elementName.includes(keyword));
|
|
27511
27506
|
};
|
|
27512
|
-
const isTransparentTextWrapper = (elementName) => elementName !== null && REACT_NATIVE_TEXT_TRANSPARENT_COMPONENTS.has(elementName);
|
|
27513
|
-
const isInsideTextHandlingComponent = (node) => {
|
|
27514
|
-
let parentNode = node.parent;
|
|
27515
|
-
while (parentNode) {
|
|
27516
|
-
if (!isNodeOfType(parentNode, "JSXElement")) {
|
|
27517
|
-
parentNode = parentNode.parent;
|
|
27518
|
-
continue;
|
|
27519
|
-
}
|
|
27520
|
-
const parentName = resolveTextBoundaryName(parentNode.openingElement);
|
|
27521
|
-
if (parentName && isTextHandlingComponent(parentName)) return true;
|
|
27522
|
-
if (!isTransparentTextWrapper(parentName)) return false;
|
|
27523
|
-
parentNode = parentNode.parent;
|
|
27524
|
-
}
|
|
27525
|
-
return false;
|
|
27526
|
-
};
|
|
27527
27507
|
const rnNoRawText = defineRule({
|
|
27528
27508
|
id: "rn-no-raw-text",
|
|
27529
27509
|
requires: ["react-native"],
|
|
@@ -27537,10 +27517,9 @@ const rnNoRawText = defineRule({
|
|
|
27537
27517
|
},
|
|
27538
27518
|
JSXElement(node) {
|
|
27539
27519
|
if (isDomComponentFile) return;
|
|
27540
|
-
const elementName =
|
|
27520
|
+
const elementName = resolveJsxElementName(node.openingElement);
|
|
27541
27521
|
if (elementName && isTextHandlingComponent(elementName)) return;
|
|
27542
27522
|
if (isInsidePlatformOsWebBranch(node)) return;
|
|
27543
|
-
if (isTransparentTextWrapper(elementName) && isInsideTextHandlingComponent(node)) return;
|
|
27544
27523
|
for (const child of node.children ?? []) {
|
|
27545
27524
|
if (!isRawTextContent(child)) continue;
|
|
27546
27525
|
context.report({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oxlint-plugin-react-doctor",
|
|
3
|
-
"version": "0.2.11-dev.
|
|
3
|
+
"version": "0.2.11-dev.b65b157",
|
|
4
4
|
"description": "oxlint plugin for React Doctor: diagnose React codebases for security, performance, correctness, accessibility, bundle-size, and architecture issues",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"accessibility",
|