Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit efd1286

Browse filesBrowse files
committed
Remove legacy schema from vue/custom-event-name-casing (#2626)
1 parent 1ffb919 commit efd1286
Copy full SHA for efd1286

File tree

2 files changed

+18
-48
lines changed
Filter options

2 files changed

+18
-48
lines changed

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

Copy file name to clipboardExpand all lines: lib/rules/custom-event-name-casing.js
+18-36Lines changed: 18 additions & 36 deletions
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

Copy file name to clipboardExpand all lines: tests/lib/rules/custom-event-name-casing.js
-12Lines changed: 0 additions & 12 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.