feat(linter): add schema for react/no-unstable-nested-components (#23287)

issue #22955
This commit is contained in:
Mikhail Baev authored and GitHub committed 2026-06-11 20:23:58 +02:00
1 parent e63a13988f
commit 3d782b7d06
4 files changed
+109 -5

No files matched your search

+18 -1
View File
@@ -1203,7 +1203,10 @@ export interface DummyRuleMap {
"react/no-unescaped-entities"?: RuleNoConfig;
"react/no-unknown-property"?: AllowWarnDeny | [AllowWarnDeny] | [AllowWarnDeny, NoUnknownPropertyConfig];
"react/no-unsafe"?: AllowWarnDeny | [AllowWarnDeny] | [AllowWarnDeny, NoUnsafeConfig];
"react/no-unstable-nested-components"?: DummyRule;
"react/no-unstable-nested-components"?:
| AllowWarnDeny
| [AllowWarnDeny]
| [AllowWarnDeny, NoUnstableNestedComponentsConfig];
"react/no-will-update-set-state"?: AllowWarnDeny | [AllowWarnDeny] | [AllowWarnDeny, NoWillUpdateSetStateConfig];
"react/only-export-components"?: AllowWarnDeny | [AllowWarnDeny] | [AllowWarnDeny, OnlyExportComponentsConfig];
"react/prefer-es6-class"?: AllowWarnDeny | [AllowWarnDeny] | [AllowWarnDeny, AlwaysNever];
@@ -4231,6 +4234,20 @@ export interface NoUnsafeConfig {
*/
checkAliases?: boolean;
}
export interface NoUnstableNestedComponentsConfig {
/**
* Allow component definitions in props.
*/
allowAsProps?: boolean;
/**
* Optional custom propTypes validators accepted for eslint-plugin-react compatibility.
*/
customValidators?: string[];
/**
* Glob pattern for render-prop names that may receive inline component definitions.
*/
propNamePattern?: string;
}
export interface OnlyExportComponentsConfig {
/**
* Allow exporting primitive constants (string/number/boolean/template literal)
+1 -2
View File
@@ -13,7 +13,7 @@ use crate::rules::RuleEnum;
/// These should return the DummyRule struct/schema instead of the actual rule struct/schema,
/// until we verify that the rule's schema is valid and can be generated by schemars.
#[cfg(feature = "ruledocs")]
const NO_VERIFIED_VALID_SCHEMA: [&str; 57] = [
const NO_VERIFIED_VALID_SCHEMA: [&str; 56] = [
"eslint/func-name-matching",
"eslint/no-restricted-globals",
"eslint/no-restricted-imports",
@@ -44,7 +44,6 @@ const NO_VERIFIED_VALID_SCHEMA: [&str; 57] = [
"react/jsx-no-script-url",
"react/jsx-no-target-blank",
"react/no-did-update-set-state",
"react/no-unstable-nested-components",
"react_perf/jsx-no-new-object-as-prop",
"typescript/array-type",
"typescript/ban-ts-comment",
+45 -1
View File
@@ -5576,7 +5576,24 @@
]
},
"react/no-unstable-nested-components": {
"$ref": "#/definitions/DummyRule"
"anyOf": [
{
"$ref": "#/definitions/AllowWarnDeny"
},
{
"type": "array",
"items": [
{
"$ref": "#/definitions/AllowWarnDeny"
},
{
"$ref": "#/definitions/NoUnstableNestedComponentsConfig"
}
],
"maxItems": 2,
"minItems": 1
}
]
},
"react/no-will-update-set-state": {
"anyOf": [
@@ -12405,6 +12422,33 @@
},
"additionalProperties": false
},
"NoUnstableNestedComponentsConfig": {
"type": "object",
"properties": {
"allowAsProps": {
"description": "Allow component definitions in props.",
"default": false,
"type": "boolean",
"markdownDescription": "Allow component definitions in props."
},
"customValidators": {
"description": "Optional custom propTypes validators accepted for eslint-plugin-react compatibility.",
"default": [],
"type": "array",
"items": {
"type": "string"
},
"markdownDescription": "Optional custom propTypes validators accepted for eslint-plugin-react compatibility."
},
"propNamePattern": {
"description": "Glob pattern for render-prop names that may receive inline component definitions.",
"default": "render*",
"type": "string",
"markdownDescription": "Glob pattern for render-prop names that may receive inline component definitions."
}
},
"additionalProperties": false
},
"NoUnusedExpressionsConfig": {
"type": "object",
"properties": {
@@ -5580,7 +5580,24 @@ expression: json
]
},
"react/no-unstable-nested-components": {
"$ref": "#/definitions/DummyRule"
"anyOf": [
{
"$ref": "#/definitions/AllowWarnDeny"
},
{
"type": "array",
"items": [
{
"$ref": "#/definitions/AllowWarnDeny"
},
{
"$ref": "#/definitions/NoUnstableNestedComponentsConfig"
}
],
"maxItems": 2,
"minItems": 1
}
]
},
"react/no-will-update-set-state": {
"anyOf": [
@@ -12409,6 +12426,33 @@ expression: json
},
"additionalProperties": false
},
"NoUnstableNestedComponentsConfig": {
"type": "object",
"properties": {
"allowAsProps": {
"description": "Allow component definitions in props.",
"default": false,
"type": "boolean",
"markdownDescription": "Allow component definitions in props."
},
"customValidators": {
"description": "Optional custom propTypes validators accepted for eslint-plugin-react compatibility.",
"default": [],
"type": "array",
"items": {
"type": "string"
},
"markdownDescription": "Optional custom propTypes validators accepted for eslint-plugin-react compatibility."
},
"propNamePattern": {
"description": "Glob pattern for render-prop names that may receive inline component definitions.",
"default": "render*",
"type": "string",
"markdownDescription": "Glob pattern for render-prop names that may receive inline component definitions."
}
},
"additionalProperties": false
},
"NoUnusedExpressionsConfig": {
"type": "object",
"properties": {