oxlint-plugin-react-doctor 0.6.0-dev.113637e → 0.6.0-dev.4d7c9dc
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 +34 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -17386,11 +17386,19 @@ const isSynchronous = (node, within) => {
|
|
|
17386
17386
|
if (isNodeOfType(node, "AwaitExpression") || isNodeOfType(node, "UnaryExpression") && node.operator === "void" || isNodeOfType(node, "FunctionDeclaration") || isNodeOfType(node, "FunctionExpression") || isNodeOfType(node, "ArrowFunctionExpression")) return false;
|
|
17387
17387
|
return isSynchronous(node.parent, within);
|
|
17388
17388
|
};
|
|
17389
|
+
const unwrapUseCallback = (node) => {
|
|
17390
|
+
if (!node || !isNodeOfType(node, "CallExpression")) return node;
|
|
17391
|
+
const callee = node.callee;
|
|
17392
|
+
return isNodeOfType(callee, "Identifier") && callee.name === "useCallback" || isNodeOfType(callee, "MemberExpression") && isNodeOfType(callee.property, "Identifier") && callee.property.name === "useCallback" ? node.arguments?.[0] : node;
|
|
17393
|
+
};
|
|
17389
17394
|
const resolveToFunction = (ref) => {
|
|
17390
17395
|
const definitionNode = ref.resolved?.defs[0]?.node;
|
|
17391
17396
|
if (!definitionNode) return null;
|
|
17392
17397
|
if (isFunctionLike$1(definitionNode)) return definitionNode;
|
|
17393
|
-
if (isNodeOfType(definitionNode, "VariableDeclarator")
|
|
17398
|
+
if (isNodeOfType(definitionNode, "VariableDeclarator")) {
|
|
17399
|
+
const initializer = unwrapUseCallback(definitionNode.init);
|
|
17400
|
+
if (isFunctionLike$1(initializer)) return initializer;
|
|
17401
|
+
}
|
|
17394
17402
|
return null;
|
|
17395
17403
|
};
|
|
17396
17404
|
const resolvesToAsyncFunction = (ref) => Boolean(resolveToFunction(ref)?.async);
|
|
@@ -32001,6 +32009,7 @@ const renderingHydrationMismatchTime = defineRule({
|
|
|
32001
32009
|
});
|
|
32002
32010
|
//#endregion
|
|
32003
32011
|
//#region src/plugin/rules/performance/rendering-hydration-no-flicker.ts
|
|
32012
|
+
const USE_EFFECT_ONLY = new Set(["useEffect"]);
|
|
32004
32013
|
const renderingHydrationNoFlicker = defineRule({
|
|
32005
32014
|
id: "rendering-hydration-no-flicker",
|
|
32006
32015
|
title: "useEffect setState flashes on mount",
|
|
@@ -32008,7 +32017,7 @@ const renderingHydrationNoFlicker = defineRule({
|
|
|
32008
32017
|
severity: "warn",
|
|
32009
32018
|
recommendation: "Use `useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot)` or add `suppressHydrationWarning` to the element",
|
|
32010
32019
|
create: (context) => ({ CallExpression(node) {
|
|
32011
|
-
if (!isHookCall$1(node,
|
|
32020
|
+
if (!isHookCall$1(node, USE_EFFECT_ONLY) || (node.arguments?.length ?? 0) < 2) return;
|
|
32012
32021
|
const depsNode = node.arguments[1];
|
|
32013
32022
|
if (!isNodeOfType(depsNode, "ArrayExpression") || depsNode.elements?.length !== 0) return;
|
|
32014
32023
|
const callback = getEffectCallback(node);
|
|
@@ -35735,6 +35744,7 @@ const ROLE_SUPPORTS_ARIA_PROPS = {
|
|
|
35735
35744
|
"aria-labelledby",
|
|
35736
35745
|
"aria-live",
|
|
35737
35746
|
"aria-owns",
|
|
35747
|
+
"aria-readonly",
|
|
35738
35748
|
"aria-relevant",
|
|
35739
35749
|
"aria-required",
|
|
35740
35750
|
"aria-roledescription"
|
|
@@ -35785,6 +35795,7 @@ const ROLE_SUPPORTS_ARIA_PROPS = {
|
|
|
35785
35795
|
"aria-labelledby",
|
|
35786
35796
|
"aria-live",
|
|
35787
35797
|
"aria-owns",
|
|
35798
|
+
"aria-readonly",
|
|
35788
35799
|
"aria-relevant",
|
|
35789
35800
|
"aria-required",
|
|
35790
35801
|
"aria-roledescription",
|
|
@@ -35816,6 +35827,7 @@ const ROLE_SUPPORTS_ARIA_PROPS = {
|
|
|
35816
35827
|
"aria-labelledby",
|
|
35817
35828
|
"aria-live",
|
|
35818
35829
|
"aria-owns",
|
|
35830
|
+
"aria-readonly",
|
|
35819
35831
|
"aria-relevant",
|
|
35820
35832
|
"aria-required",
|
|
35821
35833
|
"aria-roledescription"
|
|
@@ -37114,7 +37126,9 @@ const ROLE_SUPPORTS_ARIA_PROPS = {
|
|
|
37114
37126
|
"aria-label",
|
|
37115
37127
|
"aria-labelledby",
|
|
37116
37128
|
"aria-live",
|
|
37129
|
+
"aria-multiselectable",
|
|
37117
37130
|
"aria-owns",
|
|
37131
|
+
"aria-readonly",
|
|
37118
37132
|
"aria-relevant",
|
|
37119
37133
|
"aria-roledescription",
|
|
37120
37134
|
"aria-rowcount"
|
|
@@ -37142,6 +37156,7 @@ const ROLE_SUPPORTS_ARIA_PROPS = {
|
|
|
37142
37156
|
"aria-labelledby",
|
|
37143
37157
|
"aria-live",
|
|
37144
37158
|
"aria-owns",
|
|
37159
|
+
"aria-readonly",
|
|
37145
37160
|
"aria-relevant",
|
|
37146
37161
|
"aria-required",
|
|
37147
37162
|
"aria-roledescription",
|
|
@@ -37331,8 +37346,10 @@ const ROLE_SUPPORTS_ARIA_PROPS = {
|
|
|
37331
37346
|
"aria-label",
|
|
37332
37347
|
"aria-labelledby",
|
|
37333
37348
|
"aria-live",
|
|
37349
|
+
"aria-multiselectable",
|
|
37334
37350
|
"aria-orientation",
|
|
37335
37351
|
"aria-owns",
|
|
37352
|
+
"aria-readonly",
|
|
37336
37353
|
"aria-relevant",
|
|
37337
37354
|
"aria-required",
|
|
37338
37355
|
"aria-roledescription"
|
|
@@ -37548,6 +37565,7 @@ const ROLE_SUPPORTS_ARIA_PROPS = {
|
|
|
37548
37565
|
"aria-live",
|
|
37549
37566
|
"aria-owns",
|
|
37550
37567
|
"aria-posinset",
|
|
37568
|
+
"aria-readonly",
|
|
37551
37569
|
"aria-relevant",
|
|
37552
37570
|
"aria-required",
|
|
37553
37571
|
"aria-roledescription",
|
|
@@ -37576,6 +37594,7 @@ const ROLE_SUPPORTS_ARIA_PROPS = {
|
|
|
37576
37594
|
"aria-live",
|
|
37577
37595
|
"aria-owns",
|
|
37578
37596
|
"aria-posinset",
|
|
37597
|
+
"aria-readonly",
|
|
37579
37598
|
"aria-relevant",
|
|
37580
37599
|
"aria-required",
|
|
37581
37600
|
"aria-roledescription",
|
|
@@ -37778,6 +37797,7 @@ const ROLE_SUPPORTS_ARIA_PROPS = {
|
|
|
37778
37797
|
"aria-live",
|
|
37779
37798
|
"aria-orientation",
|
|
37780
37799
|
"aria-owns",
|
|
37800
|
+
"aria-readonly",
|
|
37781
37801
|
"aria-relevant",
|
|
37782
37802
|
"aria-required",
|
|
37783
37803
|
"aria-roledescription"
|
|
@@ -37912,6 +37932,7 @@ const ROLE_SUPPORTS_ARIA_PROPS = {
|
|
|
37912
37932
|
"aria-labelledby",
|
|
37913
37933
|
"aria-live",
|
|
37914
37934
|
"aria-owns",
|
|
37935
|
+
"aria-readonly",
|
|
37915
37936
|
"aria-relevant",
|
|
37916
37937
|
"aria-required",
|
|
37917
37938
|
"aria-roledescription",
|
|
@@ -37988,6 +38009,7 @@ const ROLE_SUPPORTS_ARIA_PROPS = {
|
|
|
37988
38009
|
"aria-multiline",
|
|
37989
38010
|
"aria-owns",
|
|
37990
38011
|
"aria-placeholder",
|
|
38012
|
+
"aria-readonly",
|
|
37991
38013
|
"aria-relevant",
|
|
37992
38014
|
"aria-required",
|
|
37993
38015
|
"aria-roledescription"
|
|
@@ -38098,10 +38120,11 @@ const ROLE_SUPPORTS_ARIA_PROPS = {
|
|
|
38098
38120
|
"aria-live",
|
|
38099
38121
|
"aria-orientation",
|
|
38100
38122
|
"aria-owns",
|
|
38123
|
+
"aria-readonly",
|
|
38101
38124
|
"aria-relevant",
|
|
38102
38125
|
"aria-roledescription",
|
|
38103
|
-
"aria-valuemin",
|
|
38104
38126
|
"aria-valuemax",
|
|
38127
|
+
"aria-valuemin",
|
|
38105
38128
|
"aria-valuenow",
|
|
38106
38129
|
"aria-valuetext"
|
|
38107
38130
|
]),
|
|
@@ -38125,6 +38148,7 @@ const ROLE_SUPPORTS_ARIA_PROPS = {
|
|
|
38125
38148
|
"aria-labelledby",
|
|
38126
38149
|
"aria-live",
|
|
38127
38150
|
"aria-owns",
|
|
38151
|
+
"aria-readonly",
|
|
38128
38152
|
"aria-relevant",
|
|
38129
38153
|
"aria-required",
|
|
38130
38154
|
"aria-roledescription",
|
|
@@ -38258,6 +38282,7 @@ const ROLE_SUPPORTS_ARIA_PROPS = {
|
|
|
38258
38282
|
"aria-labelledby",
|
|
38259
38283
|
"aria-live",
|
|
38260
38284
|
"aria-owns",
|
|
38285
|
+
"aria-readonly",
|
|
38261
38286
|
"aria-relevant",
|
|
38262
38287
|
"aria-required",
|
|
38263
38288
|
"aria-roledescription"
|
|
@@ -38326,6 +38351,7 @@ const ROLE_SUPPORTS_ARIA_PROPS = {
|
|
|
38326
38351
|
"aria-labelledby",
|
|
38327
38352
|
"aria-level",
|
|
38328
38353
|
"aria-live",
|
|
38354
|
+
"aria-multiselectable",
|
|
38329
38355
|
"aria-orientation",
|
|
38330
38356
|
"aria-owns",
|
|
38331
38357
|
"aria-relevant",
|
|
@@ -38393,6 +38419,7 @@ const ROLE_SUPPORTS_ARIA_PROPS = {
|
|
|
38393
38419
|
"aria-multiline",
|
|
38394
38420
|
"aria-owns",
|
|
38395
38421
|
"aria-placeholder",
|
|
38422
|
+
"aria-readonly",
|
|
38396
38423
|
"aria-relevant",
|
|
38397
38424
|
"aria-required",
|
|
38398
38425
|
"aria-roledescription"
|
|
@@ -38495,6 +38522,7 @@ const ROLE_SUPPORTS_ARIA_PROPS = {
|
|
|
38495
38522
|
"aria-label",
|
|
38496
38523
|
"aria-labelledby",
|
|
38497
38524
|
"aria-live",
|
|
38525
|
+
"aria-multiselectable",
|
|
38498
38526
|
"aria-orientation",
|
|
38499
38527
|
"aria-owns",
|
|
38500
38528
|
"aria-relevant",
|
|
@@ -38512,6 +38540,7 @@ const ROLE_SUPPORTS_ARIA_PROPS = {
|
|
|
38512
38540
|
"aria-details",
|
|
38513
38541
|
"aria-disabled",
|
|
38514
38542
|
"aria-dropeffect",
|
|
38543
|
+
"aria-errormessage",
|
|
38515
38544
|
"aria-flowto",
|
|
38516
38545
|
"aria-grabbed",
|
|
38517
38546
|
"aria-hidden",
|
|
@@ -38520,8 +38549,10 @@ const ROLE_SUPPORTS_ARIA_PROPS = {
|
|
|
38520
38549
|
"aria-label",
|
|
38521
38550
|
"aria-labelledby",
|
|
38522
38551
|
"aria-live",
|
|
38552
|
+
"aria-multiselectable",
|
|
38523
38553
|
"aria-orientation",
|
|
38524
38554
|
"aria-owns",
|
|
38555
|
+
"aria-readonly",
|
|
38525
38556
|
"aria-relevant",
|
|
38526
38557
|
"aria-required",
|
|
38527
38558
|
"aria-roledescription",
|