diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c1eaf38e2..996905229e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange * [meta] add issue template ([#3483][] @ROSSROSALES) * [Docs] Use emoji for jsx-runtime config and config file for eslint-doc-generator ([#3504][] @bmish)[ * [Docs] [`prefer-exact-props`]: fix example flow syntax ([#3510][] @smackfu) +* [Perf] use `anyOf` instead of `oneOf` (@ljharb @remcohaszing) [#3510]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3510 [#3504]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3504 diff --git a/lib/rules/forbid-component-props.js b/lib/rules/forbid-component-props.js index a155cf1806..95ba3a5377 100644 --- a/lib/rules/forbid-component-props.js +++ b/lib/rules/forbid-component-props.js @@ -39,7 +39,7 @@ module.exports = { forbid: { type: 'array', items: { - oneOf: [{ + anyOf: [{ type: 'string', }, { type: 'object', diff --git a/lib/rules/forbid-dom-props.js b/lib/rules/forbid-dom-props.js index 3788018614..d5131af98d 100644 --- a/lib/rules/forbid-dom-props.js +++ b/lib/rules/forbid-dom-props.js @@ -54,7 +54,7 @@ module.exports = { forbid: { type: 'array', items: { - oneOf: [{ + anyOf: [{ type: 'string', }, { type: 'object', diff --git a/lib/rules/function-component-definition.js b/lib/rules/function-component-definition.js index 8e6103ae8a..e0a27dedca 100644 --- a/lib/rules/function-component-definition.js +++ b/lib/rules/function-component-definition.js @@ -132,7 +132,7 @@ module.exports = { type: 'object', properties: { namedComponents: { - oneOf: [ + anyOf: [ { enum: [ 'function-declaration', @@ -154,7 +154,7 @@ module.exports = { ], }, unnamedComponents: { - oneOf: [ + anyOf: [ { enum: ['arrow-function', 'function-expression'] }, { type: 'array', diff --git a/lib/rules/jsx-closing-bracket-location.js b/lib/rules/jsx-closing-bracket-location.js index 7e578051d3..4816fd0068 100644 --- a/lib/rules/jsx-closing-bracket-location.js +++ b/lib/rules/jsx-closing-bracket-location.js @@ -30,7 +30,7 @@ module.exports = { messages, schema: [{ - oneOf: [ + anyOf: [ { enum: ['after-props', 'props-aligned', 'tag-aligned', 'line-aligned'], }, diff --git a/lib/rules/jsx-curly-brace-presence.js b/lib/rules/jsx-curly-brace-presence.js index 996aecc3de..c7b3e55d2e 100755 --- a/lib/rules/jsx-curly-brace-presence.js +++ b/lib/rules/jsx-curly-brace-presence.js @@ -50,7 +50,7 @@ module.exports = { schema: [ { - oneOf: [ + anyOf: [ { type: 'object', properties: { diff --git a/lib/rules/jsx-curly-newline.js b/lib/rules/jsx-curly-newline.js index d9208e10cd..77c2c82d8d 100644 --- a/lib/rules/jsx-curly-newline.js +++ b/lib/rules/jsx-curly-newline.js @@ -56,7 +56,7 @@ module.exports = { schema: [ { - oneOf: [ + anyOf: [ { enum: ['consistent', 'never'], }, diff --git a/lib/rules/jsx-curly-spacing.js b/lib/rules/jsx-curly-spacing.js index e888b10833..094e612c7d 100644 --- a/lib/rules/jsx-curly-spacing.js +++ b/lib/rules/jsx-curly-spacing.js @@ -68,7 +68,7 @@ module.exports = { }, }, basicConfigOrBoolean: { - oneOf: [{ + anyOf: [{ $ref: '#/definitions/basicConfig', }, { type: 'boolean', @@ -77,7 +77,7 @@ module.exports = { }, type: 'array', items: [{ - oneOf: [{ + anyOf: [{ allOf: [{ $ref: '#/definitions/basicConfig', }, { diff --git a/lib/rules/jsx-indent-props.js b/lib/rules/jsx-indent-props.js index 4b40247da4..0d971ac7ac 100644 --- a/lib/rules/jsx-indent-props.js +++ b/lib/rules/jsx-indent-props.js @@ -55,7 +55,7 @@ module.exports = { messages, schema: [{ - oneOf: [{ + anyOf: [{ enum: ['tab', 'first'], }, { type: 'integer', @@ -63,7 +63,7 @@ module.exports = { type: 'object', properties: { indentMode: { - oneOf: [{ + anyOf: [{ enum: ['tab', 'first'], }, { type: 'integer', diff --git a/lib/rules/jsx-indent.js b/lib/rules/jsx-indent.js index d66ac50690..9a86e6c03a 100644 --- a/lib/rules/jsx-indent.js +++ b/lib/rules/jsx-indent.js @@ -58,7 +58,7 @@ module.exports = { messages, schema: [{ - oneOf: [{ + anyOf: [{ enum: ['tab'], }, { type: 'integer', diff --git a/lib/rules/no-unescaped-entities.js b/lib/rules/no-unescaped-entities.js index 9aedd47658..2ae5cdc6b9 100644 --- a/lib/rules/no-unescaped-entities.js +++ b/lib/rules/no-unescaped-entities.js @@ -52,7 +52,7 @@ module.exports = { forbid: { type: 'array', items: { - oneOf: [{ + anyOf: [{ type: 'string', }, { type: 'object',