Skip to content

Commit 1f88354

Browse files
authored
Remove legacy schema from vue/custom-event-name-casing (#2626)
1 parent 29317fb commit 1f88354

File tree

2 files changed

+18
-48
lines changed

2 files changed

+18
-48
lines changed

lib/rules/custom-event-name-casing.js

+18-36
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,6 @@ function getCalleeMemberNode(node) {
5454
return null
5555
}
5656

57-
const OBJECT_OPTION_SCHEMA = {
58-
type: 'object',
59-
properties: {
60-
ignores: {
61-
type: 'array',
62-
items: { type: 'string' },
63-
uniqueItems: true,
64-
additionalItems: false
65-
}
66-
},
67-
additionalProperties: false
68-
}
6957
module.exports = {
7058
meta: {
7159
type: 'suggestion',
@@ -75,24 +63,23 @@ module.exports = {
7563
url: 'https://eslint.vuejs.org/rules/custom-event-name-casing.html'
7664
},
7765
fixable: null,
78-
schema: {
79-
anyOf: [
80-
{
81-
type: 'array',
82-
items: [
83-
{
84-
enum: ALLOWED_CASE_OPTIONS
85-
},
86-
OBJECT_OPTION_SCHEMA
87-
]
66+
schema: [
67+
{
68+
enum: ALLOWED_CASE_OPTIONS
69+
},
70+
{
71+
type: 'object',
72+
properties: {
73+
ignores: {
74+
type: 'array',
75+
items: { type: 'string' },
76+
uniqueItems: true,
77+
additionalItems: false
78+
}
8879
},
89-
// For backward compatibility
90-
{
91-
type: 'array',
92-
items: [OBJECT_OPTION_SCHEMA]
93-
}
94-
]
95-
},
80+
additionalProperties: false
81+
}
82+
],
9683
messages: {
9784
unexpected: "Custom event name '{{name}}' must be {{caseType}}."
9885
}
@@ -102,13 +89,8 @@ module.exports = {
10289
/** @type {Map<ObjectExpression|Program, {contextReferenceIds:Set<Identifier>,emitReferenceIds:Set<Identifier>}>} */
10390
const setupContexts = new Map()
10491
let emitParamName = ''
105-
const options =
106-
context.options.length === 1 && typeof context.options[0] !== 'string'
107-
? // For backward compatibility
108-
[undefined, context.options[0]]
109-
: context.options
110-
const caseType = options[0] || DEFAULT_CASE
111-
const objectOption = options[1] || {}
92+
const caseType = context.options[0] || DEFAULT_CASE
93+
const objectOption = context.options[1] || {}
11294
const caseChecker = casing.getChecker(caseType)
11395
/** @type {RegExp[]} */
11496
const ignores = (objectOption.ignores || []).map(toRegExp)

tests/lib/rules/custom-event-name-casing.js

-12
Original file line numberDiff line numberDiff line change
@@ -237,18 +237,6 @@ tester.run('custom-event-name-casing', rule, {
237237
]
238238
},
239239

240-
// For backward compatibility
241-
{
242-
filename: 'test.vue',
243-
code: `
244-
<template>
245-
<input
246-
@click="$emit('fooBar')">
247-
</template>
248-
`,
249-
options: [{ ignores: ['fooBar'] }]
250-
},
251-
252240
// camelCase
253241
{
254242
filename: 'test.vue',

0 commit comments

Comments
 (0)