From 9d8f2de61246cdf71c92e0a752f83c9edb1f9e34 Mon Sep 17 00:00:00 2001 From: Flo Edelmann Date: Sun, 5 Jan 2025 14:05:56 +0100 Subject: [PATCH] Change `anyOf` to `oneOf` in rule schemas to make intent clearer (#2663) --- lib/rules/attributes-order.js | 2 +- lib/rules/block-lang.js | 2 +- lib/rules/block-order.js | 2 +- lib/rules/html-comment-content-newline.js | 2 +- lib/rules/html-comment-indent.js | 2 +- lib/rules/html-indent.js | 4 ++-- lib/rules/max-attributes-per-line.js | 4 ++-- lib/rules/max-len.js | 2 +- lib/rules/no-restricted-call-after-await.js | 2 +- lib/rules/no-restricted-component-options.js | 2 +- lib/rules/no-restricted-static-attribute.js | 2 +- lib/rules/script-indent.js | 2 +- lib/rules/v-slot-style.js | 2 +- 13 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/rules/attributes-order.js b/lib/rules/attributes-order.js index 30dc75c27..50c9b452c 100644 --- a/lib/rules/attributes-order.js +++ b/lib/rules/attributes-order.js @@ -435,7 +435,7 @@ module.exports = { order: { type: 'array', items: { - anyOf: [ + oneOf: [ { enum: Object.values(ATTRS) }, { type: 'array', diff --git a/lib/rules/block-lang.js b/lib/rules/block-lang.js index 55b85ce82..2190b17cb 100644 --- a/lib/rules/block-lang.js +++ b/lib/rules/block-lang.js @@ -128,7 +128,7 @@ module.exports = { type: 'object', properties: { lang: { - anyOf: [ + oneOf: [ { type: 'string' }, { type: 'array', diff --git a/lib/rules/block-order.js b/lib/rules/block-order.js index c93de09b2..03b3d4a5f 100644 --- a/lib/rules/block-order.js +++ b/lib/rules/block-order.js @@ -49,7 +49,7 @@ module.exports = { order: { type: 'array', items: { - anyOf: [ + oneOf: [ { type: 'string' }, { type: 'array', items: { type: 'string' }, uniqueItems: true } ] diff --git a/lib/rules/html-comment-content-newline.js b/lib/rules/html-comment-content-newline.js index 590ec9fc1..ef543b6f4 100644 --- a/lib/rules/html-comment-content-newline.js +++ b/lib/rules/html-comment-content-newline.js @@ -41,7 +41,7 @@ module.exports = { fixable: 'whitespace', schema: [ { - anyOf: [ + oneOf: [ { enum: ['always', 'never'] }, diff --git a/lib/rules/html-comment-indent.js b/lib/rules/html-comment-indent.js index f0f7babd5..2d4f613d3 100644 --- a/lib/rules/html-comment-indent.js +++ b/lib/rules/html-comment-indent.js @@ -68,7 +68,7 @@ module.exports = { fixable: 'whitespace', schema: [ { - anyOf: [{ type: 'integer', minimum: 0 }, { enum: ['tab'] }] + oneOf: [{ type: 'integer', minimum: 0 }, { enum: ['tab'] }] } ], messages: { diff --git a/lib/rules/html-indent.js b/lib/rules/html-indent.js index ed2bf1a62..05cdace92 100644 --- a/lib/rules/html-indent.js +++ b/lib/rules/html-indent.js @@ -33,7 +33,7 @@ module.exports = { fixable: 'whitespace', schema: [ { - anyOf: [{ type: 'integer', minimum: 1 }, { enum: ['tab'] }] + oneOf: [{ type: 'integer', minimum: 1 }, { enum: ['tab'] }] }, { type: 'object', @@ -41,7 +41,7 @@ module.exports = { attribute: { type: 'integer', minimum: 0 }, baseIndent: { type: 'integer', minimum: 0 }, closeBracket: { - anyOf: [ + oneOf: [ { type: 'integer', minimum: 0 }, { type: 'object', diff --git a/lib/rules/max-attributes-per-line.js b/lib/rules/max-attributes-per-line.js index f5c96c127..8a9de1349 100644 --- a/lib/rules/max-attributes-per-line.js +++ b/lib/rules/max-attributes-per-line.js @@ -74,7 +74,7 @@ module.exports = { type: 'object', properties: { singleline: { - anyOf: [ + oneOf: [ { type: 'number', minimum: 1 @@ -92,7 +92,7 @@ module.exports = { ] }, multiline: { - anyOf: [ + oneOf: [ { type: 'number', minimum: 1 diff --git a/lib/rules/max-len.js b/lib/rules/max-len.js index 0492aa42a..b5dce5eb1 100644 --- a/lib/rules/max-len.js +++ b/lib/rules/max-len.js @@ -57,7 +57,7 @@ const OPTIONS_SCHEMA = { } const OPTIONS_OR_INTEGER_SCHEMA = { - anyOf: [ + oneOf: [ OPTIONS_SCHEMA, { type: 'integer', diff --git a/lib/rules/no-restricted-call-after-await.js b/lib/rules/no-restricted-call-after-await.js index b235896a3..180dfe413 100644 --- a/lib/rules/no-restricted-call-after-await.js +++ b/lib/rules/no-restricted-call-after-await.js @@ -43,7 +43,7 @@ module.exports = { properties: { module: { type: 'string' }, path: { - anyOf: [ + oneOf: [ { type: 'string' }, { type: 'array', diff --git a/lib/rules/no-restricted-component-options.js b/lib/rules/no-restricted-component-options.js index 5af68053c..b8563a92b 100644 --- a/lib/rules/no-restricted-component-options.js +++ b/lib/rules/no-restricted-component-options.js @@ -139,7 +139,7 @@ module.exports = { type: 'object', properties: { name: { - anyOf: [ + oneOf: [ { type: 'string' }, { type: 'array', diff --git a/lib/rules/no-restricted-static-attribute.js b/lib/rules/no-restricted-static-attribute.js index a71b29e49..d9241620b 100644 --- a/lib/rules/no-restricted-static-attribute.js +++ b/lib/rules/no-restricted-static-attribute.js @@ -115,7 +115,7 @@ module.exports = { type: 'object', properties: { key: { type: 'string' }, - value: { anyOf: [{ type: 'string' }, { enum: [true] }] }, + value: { oneOf: [{ type: 'string' }, { enum: [true] }] }, element: { type: 'string' }, message: { type: 'string', minLength: 1 } }, diff --git a/lib/rules/script-indent.js b/lib/rules/script-indent.js index 839b770ad..df9c5eaba 100644 --- a/lib/rules/script-indent.js +++ b/lib/rules/script-indent.js @@ -19,7 +19,7 @@ module.exports = { fixable: 'whitespace', schema: [ { - anyOf: [{ type: 'integer', minimum: 1 }, { enum: ['tab'] }] + oneOf: [{ type: 'integer', minimum: 1 }, { enum: ['tab'] }] }, { type: 'object', diff --git a/lib/rules/v-slot-style.js b/lib/rules/v-slot-style.js index d932aa9d9..964550b98 100644 --- a/lib/rules/v-slot-style.js +++ b/lib/rules/v-slot-style.js @@ -92,7 +92,7 @@ module.exports = { fixable: 'code', schema: [ { - anyOf: [ + oneOf: [ { enum: ['shorthand', 'longform'] }, { type: 'object',