Socket
Socket
Sign inDemoInstall

eslint-plugin-vue

Package Overview
Dependencies
107
Maintainers
5
Versions
167
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 9.15.1 to 9.16.0

lib/rules/block-order.js

4

lib/index.js

@@ -18,2 +18,3 @@ /*

'block-lang': require('./rules/block-lang'),
'block-order': require('./rules/block-order'),
'block-spacing': require('./rules/block-spacing'),

@@ -83,2 +84,3 @@ 'block-tag-newline': require('./rules/block-tag-newline'),

'no-deprecated-inline-template': require('./rules/no-deprecated-inline-template'),
'no-deprecated-model-definition': require('./rules/no-deprecated-model-definition'),
'no-deprecated-props-default-this': require('./rules/no-deprecated-props-default-this'),

@@ -152,2 +154,3 @@ 'no-deprecated-router-link-tag-prop': require('./rules/no-deprecated-router-link-tag-prop'),

'no-use-computed-property-like-method': require('./rules/no-use-computed-property-like-method'),
'no-use-v-else-with-v-for': require('./rules/no-use-v-else-with-v-for'),
'no-use-v-if-with-v-for': require('./rules/no-use-v-if-with-v-for'),

@@ -197,2 +200,3 @@ 'no-useless-concat': require('./rules/no-useless-concat'),

'require-toggle-inside-transition': require('./rules/require-toggle-inside-transition'),
'require-typed-object-prop': require('./rules/require-typed-object-prop'),
'require-typed-ref': require('./rules/require-typed-ref'),

@@ -199,0 +203,0 @@ 'require-v-for-key': require('./rules/require-v-for-key'),

30

lib/processor.js

@@ -49,27 +49,35 @@ /**

switch (directiveType) {
case 'disableBlock':
case 'disableBlock': {
state.block.disableAllKeys.add(data[1])
break
case 'disableLine':
}
case 'disableLine': {
state.line.disableAllKeys.add(data[1])
break
case 'enableBlock':
}
case 'enableBlock': {
state.block.disableAllKeys.clear()
break
case 'enableLine':
}
case 'enableLine': {
state.line.disableAllKeys.clear()
break
case 'disableBlockRule':
}
case 'disableBlockRule': {
addDisableRule(state.block.disableRuleKeys, data[1], data[2])
break
case 'disableLineRule':
}
case 'disableLineRule': {
addDisableRule(state.line.disableRuleKeys, data[1], data[2])
break
case 'enableBlockRule':
}
case 'enableBlockRule': {
state.block.disableRuleKeys.delete(data[1])
break
case 'enableLineRule':
}
case 'enableLineRule': {
state.line.disableRuleKeys.delete(data[1])
break
case 'clear':
}
case 'clear': {
state.block.disableAllKeys.clear()

@@ -80,6 +88,8 @@ state.block.disableRuleKeys.clear()

break
default:
}
default: {
// unused eslint-disable comments report
unusedDisableDirectiveReports.set(messageToKey(message), message)
break
}
}

@@ -86,0 +96,0 @@ return false

@@ -8,5 +8,5 @@ /**

// eslint-disable-next-line no-invalid-meta, no-invalid-meta-docs-categories
// eslint-disable-next-line internal/no-invalid-meta
module.exports = wrapCoreRule('array-bracket-newline', {
skipDynamicArguments: true
})

@@ -8,5 +8,5 @@ /**

// eslint-disable-next-line no-invalid-meta, no-invalid-meta-docs-categories
// eslint-disable-next-line internal/no-invalid-meta
module.exports = wrapCoreRule('array-bracket-spacing', {
skipDynamicArguments: true
})

@@ -8,5 +8,5 @@ /**

// eslint-disable-next-line no-invalid-meta, no-invalid-meta-docs-categories
// eslint-disable-next-line internal/no-invalid-meta
module.exports = wrapCoreRule('array-element-newline', {
skipDynamicArguments: true
})

@@ -8,3 +8,3 @@ /**

// eslint-disable-next-line no-invalid-meta, no-invalid-meta-docs-categories
// eslint-disable-next-line internal/no-invalid-meta
module.exports = wrapCoreRule('arrow-spacing')

@@ -63,3 +63,7 @@ /**

}
]
],
messages: {
mustBeHyphenated: "Attribute '{{text}}' must be hyphenated.",
cannotBeHyphenated: "Attribute '{{text}}' can't be hyphenated."
}
},

@@ -92,5 +96,3 @@ /** @param {RuleContext} context */

loc: node.loc,
message: useHyphenated
? "Attribute '{{text}}' must be hyphenated."
: "Attribute '{{text}}' can't be hyphenated.",
messageId: useHyphenated ? 'mustBeHyphenated' : 'cannotBeHyphenated',
data: {

@@ -104,2 +106,6 @@ text

if (/^[A-Z]/.test(name)) {
return null
}
return fixer.replaceText(

@@ -106,0 +112,0 @@ node.key,

@@ -123,4 +123,5 @@ /**

switch (name) {
case 'for':
case 'for': {
return ATTRS.LIST_RENDERING
}
case 'if':

@@ -130,20 +131,28 @@ case 'else-if':

case 'show':
case 'cloak':
case 'cloak': {
return ATTRS.CONDITIONALS
}
case 'pre':
case 'once':
case 'once': {
return ATTRS.RENDER_MODIFIERS
case 'model':
}
case 'model': {
return ATTRS.TWO_WAY_BINDING
case 'on':
}
case 'on': {
return ATTRS.EVENTS
}
case 'html':
case 'text':
case 'text': {
return ATTRS.CONTENT
case 'slot':
}
case 'slot': {
return ATTRS.SLOT
case 'is':
}
case 'is': {
return ATTRS.DEFINITION
default:
}
default: {
return ATTRS.OTHER_DIRECTIVES
}
}

@@ -159,13 +168,17 @@ }

switch (propName) {
case 'is':
case 'is': {
return ATTRS.DEFINITION
case 'id':
}
case 'id': {
return ATTRS.GLOBAL
}
case 'ref':
case 'key':
case 'key': {
return ATTRS.UNIQUE
}
case 'slot':
case 'slot-scope':
case 'slot-scope': {
return ATTRS.SLOT
default:
}
default: {
if (isVBind(attribute)) {

@@ -178,2 +191,3 @@ return ATTRS.ATTR_DYNAMIC

return ATTRS.ATTR_STATIC
}
}

@@ -189,5 +203,5 @@ }

const attributeType = getAttributeType(attribute)
return attributePosition[attributeType] != null
? attributePosition[attributeType]
: null
return attributePosition[attributeType] == null
? null
: attributePosition[attributeType]
}

@@ -285,5 +299,6 @@

node,
message: `Attribute "${currentNode}" should go before "${prevNode}".`,
messageId: 'expectedOrder',
data: {
currentNode
currentNode,
prevNode
},

@@ -448,5 +463,8 @@

}
]
],
messages: {
expectedOrder: `Attribute "{{currentNode}}" should go before "{{prevNode}}".`
}
},
create
}

@@ -45,6 +45,8 @@ /**

switch (langs.length) {
case 1:
case 1: {
return langs[0]
default:
}
default: {
return `${langs.slice(0, -1).join(', ')}, and ${langs[langs.length - 1]}`
}
}

@@ -51,0 +53,0 @@ }

@@ -8,5 +8,5 @@ /**

// eslint-disable-next-line no-invalid-meta, no-invalid-meta-docs-categories
// eslint-disable-next-line internal/no-invalid-meta
module.exports = wrapCoreRule('block-spacing', {
skipDynamicArguments: true
})

@@ -28,6 +28,8 @@ /**

switch (lineBreaks) {
case 1:
case 1: {
return '1 line break'
default:
}
default: {
return `${lineBreaks} line breaks`
}
}

@@ -76,4 +78,2 @@ }

"There should be no line break after '<{{tag}}>'.",
unexpectedClosingLinebreak:
"There should be no line break before '</{{tag}}>'.",
expectedOpeningLinebreak:

@@ -329,5 +329,3 @@ "Expected {{expected}} after '<{{tag}}>', but {{actual}} found.",

const elementsOptions = blocks[name]
if (!elementsOptions) {
verifyElement(element, options)
} else {
if (elementsOptions) {
normalizeOptionValue({

@@ -337,6 +335,8 @@ singleline: elementsOptions.singleline || options.singleline,

maxEmptyLines:
elementsOptions.maxEmptyLines != null
? elementsOptions.maxEmptyLines
: options.maxEmptyLines
elementsOptions.maxEmptyLines == null
? options.maxEmptyLines
: elementsOptions.maxEmptyLines
})(element)
} else {
verifyElement(element, options)
}

@@ -343,0 +343,0 @@ }

@@ -8,5 +8,5 @@ /**

// eslint-disable-next-line no-invalid-meta, no-invalid-meta-docs-categories
// eslint-disable-next-line internal/no-invalid-meta
module.exports = wrapCoreRule('brace-style', {
skipDynamicArguments: true
})

@@ -8,3 +8,3 @@ /**

// eslint-disable-next-line no-invalid-meta, no-invalid-meta-docs-categories
// eslint-disable-next-line internal/no-invalid-meta
module.exports = wrapCoreRule('camelcase')

@@ -8,3 +8,3 @@ /**

// eslint-disable-next-line no-invalid-meta, no-invalid-meta-docs-categories
// eslint-disable-next-line internal/no-invalid-meta
module.exports = wrapCoreRule('comma-dangle')

@@ -8,3 +8,3 @@ /**

// eslint-disable-next-line no-invalid-meta, no-invalid-meta-docs-categories
// eslint-disable-next-line internal/no-invalid-meta
module.exports = wrapCoreRule('comma-spacing', {

@@ -11,0 +11,0 @@ skipDynamicArguments: true,

@@ -8,3 +8,3 @@ /**

// eslint-disable-next-line no-invalid-meta, no-invalid-meta-docs-categories
// eslint-disable-next-line internal/no-invalid-meta
module.exports = wrapCoreRule('comma-style', {

@@ -11,0 +11,0 @@ create(_context, { coreHandlers }) {

@@ -73,6 +73,7 @@ /**

function enable(context, loc, group, rule) {
if (!rule) {
if (rule) {
context.report({
loc,
messageId: group === 'block' ? 'enableBlock' : 'enableLine'
messageId: group === 'block' ? 'enableBlockRule' : 'enableLineRule',
data: { rule }
})

@@ -82,4 +83,3 @@ } else {

loc,
messageId: group === 'block' ? 'enableBlockRule' : 'enableLineRule',
data: { rule }
messageId: group === 'block' ? 'enableBlock' : 'enableLine'
})

@@ -99,7 +99,7 @@ }

function disable(context, loc, group, rule, key) {
if (!rule) {
if (rule) {
context.report({
loc,
messageId: group === 'block' ? 'disableBlock' : 'disableLine',
data: { key }
messageId: group === 'block' ? 'disableBlockRule' : 'disableLineRule',
data: { rule, key }
})

@@ -109,4 +109,4 @@ } else {

loc,
messageId: group === 'block' ? 'disableBlockRule' : 'disableLineRule',
data: { rule, key }
messageId: group === 'block' ? 'disableBlock' : 'disableLine',
data: { key }
})

@@ -113,0 +113,0 @@ }

@@ -32,3 +32,3 @@ /**

},
fixable: 'code', // or "code" or "whitespace"
fixable: 'code',
schema: [

@@ -38,3 +38,6 @@ {

}
]
],
messages: {
incorrectCase: 'Property name "{{value}}" is not {{caseType}}.'
}
},

@@ -68,3 +71,3 @@ /** @param {RuleContext} context */

node,
message: 'Property name "{{value}}" is not {{caseType}}.',
messageId: 'incorrectCase',
data: {

@@ -71,0 +74,0 @@ value: nodeValue,

@@ -72,3 +72,6 @@ /**

}
]
],
messages: {
incorrectCase: 'Component name "{{name}}" is not {{caseType}}.'
}
},

@@ -160,3 +163,3 @@ /** @param {RuleContext} context */

loc: open.loc,
message: 'Component name "{{name}}" is not {{caseType}}.',
messageId: 'incorrectCase',
data: {

@@ -163,0 +166,0 @@ name,

@@ -1,184 +0,23 @@

/**
* @author Yosuke Ota
* issue https://github.com/vuejs/eslint-plugin-vue/issues/140
*/
'use strict'
const utils = require('../utils')
const { parseSelector } = require('../utils/selector')
const baseRule = require('./block-order')
/**
* @typedef {import('../utils/selector').VElementSelector} VElementSelector
*/
const DEFAULT_ORDER = Object.freeze([['script', 'template'], 'style'])
/**
* @param {VElement} element
* @return {string}
*/
function getAttributeString(element) {
return element.startTag.attributes
.map((attribute) => {
if (attribute.value && attribute.value.type !== 'VLiteral') {
return ''
}
return `${attribute.key.name}${
attribute.value && attribute.value.value
? `=${attribute.value.value}`
: ''
}`
})
.join(' ')
}
module.exports = {
// eslint-disable-next-line eslint-plugin/require-meta-schema, eslint-plugin/prefer-message-ids -- inherit schema from base rule
meta: {
type: 'suggestion',
...baseRule.meta,
// eslint-disable-next-line eslint-plugin/meta-property-ordering
type: baseRule.meta.type,
docs: {
description: 'enforce order of component top-level elements',
description: baseRule.meta.docs.description,
categories: ['vue3-recommended', 'recommended'],
url: 'https://eslint.vuejs.org/rules/component-tags-order.html'
},
fixable: 'code',
schema: [
{
type: 'object',
properties: {
order: {
type: 'array',
items: {
anyOf: [
{ type: 'string' },
{ type: 'array', items: { type: 'string' }, uniqueItems: true }
]
},
uniqueItems: true,
additionalItems: false
}
},
additionalProperties: false
}
],
messages: {
unexpected:
"'<{{elementName}}{{elementAttributes}}>' should be above '<{{firstUnorderedName}}{{firstUnorderedAttributes}}>' on line {{line}}."
}
deprecated: true,
replacedBy: ['block-order']
},
/**
* @param {RuleContext} context - The rule context.
* @returns {RuleListener} AST event handlers.
*/
/** @param {RuleContext} context */
create(context) {
/**
* @typedef {object} OrderElement
* @property {string} selectorText
* @property {VElementSelector} selector
* @property {number} index
*/
/** @type {OrderElement[]} */
const orders = []
/** @type {(string|string[])[]} */
const orderOptions =
(context.options[0] && context.options[0].order) || DEFAULT_ORDER
for (const [index, selectorOrSelectors] of orderOptions.entries()) {
if (Array.isArray(selectorOrSelectors)) {
for (const selector of selectorOrSelectors) {
orders.push({
selectorText: selector,
selector: parseSelector(selector, context),
index
})
}
} else {
orders.push({
selectorText: selectorOrSelectors,
selector: parseSelector(selectorOrSelectors, context),
index
})
}
}
/**
* @param {VElement} element
*/
function getOrderElement(element) {
return orders.find((o) => o.selector.test(element))
}
const documentFragment =
context.parserServices.getDocumentFragment &&
context.parserServices.getDocumentFragment()
function getTopLevelHTMLElements() {
if (documentFragment) {
return documentFragment.children.filter(utils.isVElement)
}
return []
}
return {
Program(node) {
if (utils.hasInvalidEOF(node)) {
return
}
const elements = getTopLevelHTMLElements()
const elementsWithOrder = elements.flatMap((element) => {
const order = getOrderElement(element)
return order ? [{ order, element }] : []
})
const sourceCode = context.getSourceCode()
for (const [index, elementWithOrders] of elementsWithOrder.entries()) {
const { order: expected, element } = elementWithOrders
const firstUnordered = elementsWithOrder
.slice(0, index)
.filter(({ order }) => expected.index < order.index)
.sort((e1, e2) => e1.order.index - e2.order.index)[0]
if (firstUnordered) {
const firstUnorderedAttributes = getAttributeString(
firstUnordered.element
)
const elementAttributes = getAttributeString(element)
context.report({
node: element,
loc: element.loc,
messageId: 'unexpected',
data: {
elementName: element.name,
elementAttributes: elementAttributes
? ` ${elementAttributes}`
: '',
firstUnorderedName: firstUnordered.element.name,
firstUnorderedAttributes: firstUnorderedAttributes
? ` ${firstUnorderedAttributes}`
: '',
line: firstUnordered.element.loc.start.line
},
*fix(fixer) {
// insert element before firstUnordered
const fixedElements = elements.flatMap((it) => {
if (it === firstUnordered.element) {
return [element, it]
} else if (it === element) {
return []
}
return [it]
})
for (let i = elements.length - 1; i >= 0; i--) {
if (elements[i] !== fixedElements[i]) {
yield fixer.replaceTextRange(
elements[i].range,
sourceCode.text.slice(...fixedElements[i].range)
)
}
}
}
})
}
}
}
}
return baseRule.create(context)
}
}

@@ -18,6 +18,2 @@ /**

fixable: null,
messages: {
hasArg: 'Use type-based declaration instead of runtime declaration.',
hasTypeArg: 'Use runtime declaration instead of type-based declaration.'
},
schema: [

@@ -27,3 +23,7 @@ {

}
]
],
messages: {
hasArg: 'Use type-based declaration instead of runtime declaration.',
hasTypeArg: 'Use runtime declaration instead of type-based declaration.'
}
},

@@ -41,3 +41,3 @@ /** @param {RuleContext} context */

switch (defineType) {
case 'type-based':
case 'type-based': {
if (node.arguments.length > 0) {

@@ -50,4 +50,5 @@ context.report({

break
}
case 'runtime':
case 'runtime': {
if (node.typeParameters && node.typeParameters.params.length > 0) {

@@ -60,2 +61,3 @@ context.report({

break
}
}

@@ -62,0 +64,0 @@ }

@@ -18,6 +18,2 @@ /**

fixable: null,
messages: {
hasArg: 'Use type-based declaration instead of runtime declaration.',
hasTypeArg: 'Use runtime declaration instead of type-based declaration.'
},
schema: [

@@ -27,3 +23,7 @@ {

}
]
],
messages: {
hasArg: 'Use type-based declaration instead of runtime declaration.',
hasTypeArg: 'Use runtime declaration instead of type-based declaration.'
}
},

@@ -41,3 +41,3 @@ /** @param {RuleContext} context */

switch (defineType) {
case 'type-based':
case 'type-based': {
if (node.arguments.length > 0) {

@@ -50,4 +50,5 @@ context.report({

break
}
case 'runtime':
case 'runtime': {
if (node.typeParameters && node.typeParameters.params.length > 0) {

@@ -60,2 +61,3 @@ context.report({

break
}
}

@@ -62,0 +64,0 @@ }

@@ -8,3 +8,3 @@ /**

// eslint-disable-next-line no-invalid-meta, no-invalid-meta-docs-categories
// eslint-disable-next-line internal/no-invalid-meta
module.exports = wrapCoreRule('dot-location')

@@ -8,5 +8,5 @@ /**

// eslint-disable-next-line no-invalid-meta, no-invalid-meta-docs-categories
// eslint-disable-next-line internal/no-invalid-meta
module.exports = wrapCoreRule('dot-notation', {
applyDocument: true
})

@@ -8,5 +8,5 @@ /**

// eslint-disable-next-line no-invalid-meta, no-invalid-meta-docs-categories
// eslint-disable-next-line internal/no-invalid-meta
module.exports = wrapCoreRule('eqeqeq', {
applyDocument: true
})

@@ -17,3 +17,3 @@ /**

},
fixable: 'whitespace', // or "code" or "whitespace"
fixable: 'whitespace',
schema: [

@@ -20,0 +20,0 @@ {

@@ -8,3 +8,3 @@ /**

// eslint-disable-next-line no-invalid-meta, no-invalid-meta-docs-categories
// eslint-disable-next-line internal/no-invalid-meta
module.exports = wrapCoreRule('func-call-spacing', {

@@ -11,0 +11,0 @@ skipDynamicArguments: true,

@@ -15,8 +15,11 @@ /**

switch (lineBreaks) {
case 0:
case 0: {
return 'no line breaks'
case 1:
}
case 1: {
return '1 line break'
default:
}
default: {
return `${lineBreaks} line breaks`
}
}

@@ -44,3 +47,7 @@ }

}
]
],
messages: {
expectedBeforeClosingBracket:
'Expected {{expected}} before closing bracket, but {{actual}} found.'
}
},

@@ -88,4 +95,3 @@ /** @param {RuleContext} context */

},
message:
'Expected {{expected}} before closing bracket, but {{actual}} found.',
messageId: 'expectedBeforeClosingBracket',
data: {

@@ -92,0 +98,0 @@ expected: getPhrase(expectedLineBreaks),

@@ -62,2 +62,3 @@ /**

},
fixable: 'whitespace',
schema: [

@@ -74,3 +75,6 @@ {

],
fixable: 'whitespace'
messages: {
missing: "Expected a space before '{{bracket}}', but not found.",
unexpected: "Expected no space before '{{bracket}}', but found."
}
},

@@ -107,3 +111,3 @@ /** @param {RuleContext} context */

loc: lastToken.loc,
message: "Expected a space before '{{bracket}}', but not found.",
messageId: 'missing',
data: { bracket: sourceCode.getText(lastToken) },

@@ -119,3 +123,3 @@ fix: (fixer) => fixer.insertTextBefore(lastToken, ' ')

},
message: "Expected no space before '{{bracket}}', but found.",
messageId: 'unexpected',
data: { bracket: sourceCode.getText(lastToken) },

@@ -122,0 +126,0 @@ fix: (fixer) =>

@@ -19,3 +19,6 @@ /**

fixable: 'code',
schema: []
schema: [],
messages: {
missingEndTag: "'<{{name}}>' should have end tag."
}
},

@@ -43,3 +46,3 @@ /** @param {RuleContext} context */

loc: node.startTag.loc,
message: "'<{{name}}>' should have end tag.",
messageId: 'missingEndTag',
data: { name },

@@ -46,0 +49,0 @@ fix: (fixer) => fixer.insertTextAfter(node, `</${name}>`)

@@ -23,2 +23,3 @@ /**

},
// eslint-disable-next-line eslint-plugin/prefer-message-ids
meta: {

@@ -25,0 +26,0 @@ type: 'layout',

@@ -30,3 +30,6 @@ /**

}
]
],
messages: {
expected: 'Expected to be enclosed by {{kind}}.'
}
},

@@ -67,3 +70,3 @@ /** @param {RuleContext} context */

loc: node.value.loc,
message: 'Expected to be enclosed by {{kind}}.',
messageId: 'expected',
data: { kind: quoteName },

@@ -70,0 +73,0 @@ fix(fixer) {

@@ -81,3 +81,3 @@ /**

const start = node.startTag.range[1]
const end = node.endTag != null ? node.endTag.range[0] : node.range[1]
const end = node.endTag == null ? node.range[1] : node.endTag.range[0]

@@ -123,2 +123,8 @@ return sourceCode.text.slice(start, end).trim() === ''

maxItems: 1
},
messages: {
requireSelfClosing:
'Require self-closing on {{elementType}} (<{{name}}>).',
disallowSelfClosing:
'Disallow self-closing on {{elementType}} (<{{name}}/>).'
}

@@ -136,3 +142,3 @@ },

VElement(node) {
if (hasInvalidEOF) {
if (hasInvalidEOF || node.parent.type === 'VDocumentFragment') {
return

@@ -152,3 +158,3 @@ }

loc: node.loc,
message: 'Require self-closing on {{elementType}} (<{{name}}>).',
messageId: 'requireSelfClosing',
data: {

@@ -177,4 +183,3 @@ elementType: ELEMENT_TYPE_MESSAGES[elementType],

loc: node.loc,
message:
'Disallow self-closing on {{elementType}} (<{{name}}/>).',
messageId: 'disallowSelfClosing',
data: {

@@ -181,0 +186,0 @@ elementType: ELEMENT_TYPE_MESSAGES[elementType],

@@ -34,2 +34,3 @@ // the following rule is based on yannickcr/eslint-plugin-react

module.exports = {
// eslint-disable-next-line eslint-plugin/prefer-message-ids
meta: {

@@ -36,0 +37,0 @@ type: 'problem',

@@ -8,5 +8,5 @@ /**

// eslint-disable-next-line no-invalid-meta, no-invalid-meta-docs-categories
// eslint-disable-next-line internal/no-invalid-meta
module.exports = wrapCoreRule('key-spacing', {
skipDynamicArguments: true
})

@@ -8,5 +8,5 @@ /**

// eslint-disable-next-line no-invalid-meta, no-invalid-meta-docs-categories
// eslint-disable-next-line internal/no-invalid-meta
module.exports = wrapCoreRule('keyword-spacing', {
skipDynamicArguments: true
})

@@ -26,4 +26,2 @@ /**

meta: {
// eslint-disable-next-line eslint-plugin/require-meta-has-suggestions
hasSuggestions: true,
type: 'suggestion',

@@ -36,2 +34,3 @@ docs: {

fixable: null,
hasSuggestions: true,
schema: [

@@ -55,3 +54,7 @@ {

}
]
],
messages: {
shouldMatchFileName:
'Component name `{{name}}` should match file name `{{filename}}`.'
}
},

@@ -108,4 +111,3 @@ /** @param {RuleContext} context */

node,
message:
'Component name `{{name}}` should match file name `{{filename}}`.',
messageId: 'shouldMatchFileName',
data: { filename, name },

@@ -112,0 +114,0 @@ suggest: [

@@ -21,3 +21,2 @@ /**

type: 'problem',
schema: [],
docs: {

@@ -30,2 +29,3 @@ description:

fixable: null,
schema: [],
messages: {

@@ -32,0 +32,0 @@ unexpected:

@@ -71,3 +71,3 @@ /**

},
fixable: 'whitespace', // or "code" or "whitespace"
fixable: 'whitespace',
schema: [

@@ -116,3 +116,6 @@ {

}
]
],
messages: {
shouldBeOnNewLine: "'{{name}}' should be on a new line."
}
},

@@ -160,3 +163,3 @@ /** @param {RuleContext} context */

loc: prop.loc,
message: "'{{name}}' should be on a new line.",
messageId: 'shouldBeOnNewLine',
data: { name: sourceCode.getText(prop.key) },

@@ -163,0 +166,0 @@ fix(fixer) {

@@ -37,6 +37,8 @@ /**

switch (lineBreaks) {
case 0:
case 0: {
return 'no'
default:
}
default: {
return `${lineBreaks}`
}
}

@@ -43,0 +45,0 @@ }

@@ -9,3 +9,3 @@ /**

// eslint-disable-next-line no-invalid-meta, no-invalid-meta-docs-categories
// eslint-disable-next-line internal/no-invalid-meta
module.exports = wrapCoreRule('multiline-ternary', {

@@ -12,0 +12,0 @@ skipDynamicArguments: true,

@@ -22,3 +22,9 @@ /**

}
]
],
messages: {
expectedSpaceAfter: "Expected 1 space after '{{', but not found.",
expectedSpaceBefore: "Expected 1 space before '}}', but not found.",
unexpectedSpaceAfter: "Expected no space after '{{', but found.",
unexpectedSpaceBefore: "Expected no space before '}}', but found."
}
},

@@ -58,3 +64,3 @@ /** @param {RuleContext} context */

node: openBrace,
message: "Expected 1 space after '{{', but not found.",
messageId: 'expectedSpaceAfter',
fix: (fixer) => fixer.insertTextAfter(openBrace, ' ')

@@ -66,3 +72,3 @@ })

node: closeBrace,
message: "Expected 1 space before '}}', but not found.",
messageId: 'expectedSpaceBefore',
fix: (fixer) => fixer.insertTextBefore(closeBrace, ' ')

@@ -78,3 +84,3 @@ })

},
message: "Expected no space after '{{', but found.",
messageId: 'unexpectedSpaceAfter',
fix: (fixer) =>

@@ -90,3 +96,3 @@ fixer.removeRange([openBrace.range[1], firstToken.range[0]])

},
message: "Expected no space before '}}', but found.",
messageId: 'unexpectedSpaceBefore',
fix: (fixer) =>

@@ -93,0 +99,0 @@ fixer.removeRange([lastToken.range[1], closeBrace.range[0]])

@@ -57,3 +57,3 @@ /**

},
fixable: 'whitespace', // or "code" or "whitespace"
fixable: 'whitespace',
schema: [

@@ -71,3 +71,7 @@ {

}
]
],
messages: {
missingEmptyLine:
'Enforce new lines between multi-line properties in Vue components.'
}
},

@@ -126,4 +130,3 @@

},
message:
'Enforce new lines between multi-line properties in Vue components.',
messageId: 'missingEmptyLine',
fix(fixer) {

@@ -130,0 +133,0 @@ /** @type {Token|null} */

@@ -88,3 +88,9 @@ /**

fixable: 'code',
schema: [{ enum: ['promise', 'callback'] }]
schema: [{ enum: ['promise', 'callback'] }],
messages: {
usePromise:
'Use the Promise returned by `nextTick` instead of passing a callback function.',
useCallback:
'Pass a callback function to `nextTick` instead of using the returned Promise.'
}
},

@@ -111,4 +117,3 @@ /** @param {RuleContext} context */

node,
message:
'Pass a callback function to `nextTick` instead of using the returned Promise.'
messageId: 'useCallback'
})

@@ -126,4 +131,3 @@ }

node,
message:
'Use the Promise returned by `nextTick` instead of passing a callback function.',
messageId: 'usePromise',
fix(fixer) {

@@ -130,0 +134,0 @@ return fixer.insertTextAfter(node, '().then')

@@ -17,3 +17,7 @@ /**

fixable: null,
schema: []
schema: [],
messages: {
noArrowFunctionsInWatch:
'You should not use an arrow function to define a watcher.'
}
},

@@ -40,4 +44,3 @@ /** @param {RuleContext} context */

node: handler,
message:
'You should not use an arrow function to define a watcher.'
messageId: 'noArrowFunctionsInWatch'
})

@@ -44,0 +47,0 @@ }

@@ -88,3 +88,9 @@ /**

fixable: null,
schema: []
schema: [],
messages: {
unexpectedInFunction:
'Unexpected {{expressionName}} in computed function.',
unexpectedInProperty:
'Unexpected {{expressionName}} in "{{propertyName}}" computed property.'
}
},

@@ -155,4 +161,3 @@ /** @param {RuleContext} context */

node,
message:
'Unexpected {{expressionName}} in "{{propertyName}}" computed property.',
messageId: 'unexpectedInProperty',
data: {

@@ -175,3 +180,3 @@ expressionName: expressionTypes[type],

node,
message: 'Unexpected {{expressionName}} in computed function.',
messageId: 'unexpectedInFunction',
data: {

@@ -178,0 +183,0 @@ expressionName: expressionTypes[type]

@@ -46,3 +46,8 @@ /**

}
]
],
messages: {
noBooleanDefault:
'Boolean prop should not set a default (Vue defaults it to false).',
defaultFalse: 'Boolean prop should only be defaulted to false.'
}
},

@@ -96,18 +101,19 @@ /** @param {RuleContext} context */

switch (booleanType) {
case 'no-default':
case 'no-default': {
context.report({
node: defaultNode,
message:
'Boolean prop should not set a default (Vue defaults it to false).'
messageId: 'noBooleanDefault'
})
break
}
case 'default-false':
case 'default-false': {
if (defaultNode.type !== 'Literal' || defaultNode.value !== false) {
context.report({
node: defaultNode,
message: 'Boolean prop should only be defaulted to false.'
messageId: 'defaultFalse'
})
}
break
}
}

@@ -114,0 +120,0 @@ }

@@ -73,3 +73,2 @@ /**

meta: {
hasSuggestions: true,
type: 'problem',

@@ -83,2 +82,3 @@ docs: {

fixable: null,
hasSuggestions: true,
schema: [

@@ -100,3 +100,8 @@ {

}
]
],
messages: {
disallowedChildContent:
'Child content is disallowed because it will be overwritten by the v-{{ directiveName }} directive.',
removeChildContent: 'Remove child content.'
}
},

@@ -144,8 +149,7 @@ /** @param {RuleContext} context */

loc: getLocationRange(childNodes),
message:
'Child content is disallowed because it will be overwritten by the v-{{ directiveName }} directive.',
messageId: 'disallowedChildContent',
data: { directiveName },
suggest: [
{
desc: 'Remove child content.',
messageId: 'removeChildContent',
*fix(fixer) {

@@ -152,0 +156,0 @@ for (const childNode of childNodes) {

@@ -9,3 +9,3 @@ /**

// eslint-disable-next-line no-invalid-meta, no-invalid-meta-docs-categories
// eslint-disable-next-line internal/no-invalid-meta
module.exports = utils.wrapCoreRule('no-console', {

@@ -12,0 +12,0 @@ skipCoreHandlers: true,

@@ -10,3 +10,3 @@ /**

// eslint-disable-next-line no-invalid-meta, no-invalid-meta-docs-categories
// eslint-disable-next-line internal/no-invalid-meta
module.exports = wrapCoreRule('no-constant-condition', {

@@ -13,0 +13,0 @@ create(_context, { coreHandlers }) {

@@ -69,3 +69,3 @@ /**

},
fixable: null, // or "code" or "whitespace"
fixable: null,
schema: [

@@ -81,3 +81,6 @@ {

}
]
],
messages: {
duplicatedKey: "Duplicated key '{{name}}'."
}
},

@@ -98,3 +101,3 @@ /** @param {RuleContext} context */

node: o.node,
message: "Duplicated key '{{name}}'.",
messageId: 'duplicatedKey',
data: {

@@ -134,3 +137,3 @@ name: o.name

node: variable.defs[0].node,
message: "Duplicated key '{{name}}'.",
messageId: 'duplicatedKey',
data: {

@@ -137,0 +140,0 @@ name: prop.propName

@@ -20,5 +20,6 @@ /**

fixable: null,
schema: [
// fill in your schema
]
schema: [],
messages: {
noDuplicateAttrInheritance: 'Set "inheritAttrs" to false.'
}
},

@@ -68,3 +69,3 @@ /** @param {RuleContext} context */

node: attrsRef.id,
message: 'Set "inheritAttrs" to false.'
messageId: 'noDuplicateAttrInheritance'
})

@@ -71,0 +72,0 @@ }

@@ -53,3 +53,6 @@ /**

}
]
],
messages: {
duplicateAttribute: "Duplicate attribute '{{name}}'."
}
},

@@ -96,3 +99,3 @@ /** @param {RuleContext} context */

loc: node.loc,
message: "Duplicate attribute '{{name}}'.",
messageId: 'duplicateAttribute',
data: { name }

@@ -99,0 +102,0 @@ })

@@ -8,3 +8,3 @@ /**

// eslint-disable-next-line no-invalid-meta, no-invalid-meta-docs-categories
// eslint-disable-next-line internal/no-invalid-meta
module.exports = wrapCoreRule('no-empty-pattern')

@@ -10,3 +10,3 @@ /**

// eslint-disable-next-line no-invalid-meta, no-invalid-meta-docs-categories
// eslint-disable-next-line internal/no-invalid-meta
module.exports = wrapCoreRule('no-extra-parens', {

@@ -101,7 +101,3 @@ skipDynamicArguments: true,

for (const token of tokenStore.getTokens(expression)) {
if (!parenStack) {
if (token.value === '|') {
return true
}
} else {
if (parenStack) {
if (parenStack.isUpToken(token)) {

@@ -111,2 +107,6 @@ parenStack = parenStack.upper

}
} else {
if (token.value === '|') {
return true
}
}

@@ -113,0 +113,0 @@ if (isLeftParen(token)) {

@@ -6,4 +6,6 @@ 'use strict'

module.exports = {
// eslint-disable-next-line eslint-plugin/prefer-message-ids
meta: {
...baseRule.meta,
// eslint-disable-next-line eslint-plugin/meta-property-ordering
type: baseRule.meta.type,

@@ -15,5 +17,5 @@ docs: {

},
schema: [],
deprecated: true,
replacedBy: ['valid-model-definition'],
schema: []
replacedBy: ['valid-model-definition']
},

@@ -20,0 +22,0 @@ /** @param {RuleContext} context */

@@ -9,5 +9,5 @@ /**

// eslint-disable-next-line no-invalid-meta, no-invalid-meta-docs-categories
// eslint-disable-next-line internal/no-invalid-meta
module.exports = utils.wrapCoreRule('no-loss-of-precision', {
applyDocument: true
})

@@ -26,3 +26,3 @@ /**

},
fixable: 'whitespace', // or "code" or "whitespace"
fixable: 'whitespace',
schema: [

@@ -38,3 +38,8 @@ {

}
]
],
messages: {
multipleSpaces: "Multiple spaces found before '{{displayValue}}'.",
useLatestParser:
'Use the latest vue-eslint-parser. See also https://eslint.vuejs.org/user-guide/#what-is-the-use-the-latest-vue-eslint-parser-error.'
}
},

@@ -57,4 +62,3 @@

loc: { line: 1, column: 0 },
message:
'Use the latest vue-eslint-parser. See also https://eslint.vuejs.org/user-guide/#what-is-the-use-the-latest-vue-eslint-parser-error.'
messageId: 'useLatestParser'
})

@@ -90,3 +94,3 @@ }

},
message: "Multiple spaces found before '{{displayValue}}'.",
messageId: 'multipleSpaces',
fix: (fixer) =>

@@ -93,0 +97,0 @@ fixer.replaceTextRange(

@@ -18,3 +18,9 @@ /**

fixable: null,
schema: []
schema: [],
messages: {
multipleRoot: 'The template root requires exactly one element.',
textRoot: 'The template root requires an element rather than texts.',
disallowedElement: "The template root disallows '<{{name}}>' elements.",
disallowedDirective: "The template root disallows 'v-for' directives."
}
},

@@ -61,11 +67,5 @@ /**

loc: extraText.loc,
message: 'The template root requires an element rather than texts.'
messageId: 'textRoot'
})
} else if (extraElement != null) {
context.report({
node: extraElement,
loc: extraElement.loc,
message: 'The template root requires exactly one element.'
})
} else {
} else if (extraElement == null) {
for (const element of rootElements) {

@@ -79,3 +79,3 @@ const tag = element.startTag

loc: tag.loc,
message: "The template root disallows '<{{name}}>' elements.",
messageId: 'disallowedElement',
data: { name }

@@ -88,6 +88,12 @@ })

loc: tag.loc,
message: "The template root disallows 'v-for' directives."
messageId: 'disallowedDirective'
})
}
}
} else {
context.report({
node: extraElement,
loc: extraElement.loc,
messageId: 'multipleRoot'
})
}

@@ -94,0 +100,0 @@ }

@@ -112,3 +112,3 @@ /**

},
fixable: null, // or "code" or "whitespace"
fixable: null,
schema: [

@@ -124,3 +124,6 @@ {

}
]
],
messages: {
unexpectedMutation: 'Unexpected mutation of "{{key}}" prop.'
}
},

@@ -142,3 +145,3 @@ /** @param {RuleContext} context */

node,
message: 'Unexpected mutation of "{{key}}" prop.',
messageId: 'unexpectedMutation',
data: {

@@ -145,0 +148,0 @@ key: name

@@ -70,3 +70,6 @@ /**

}
]
],
messages: {
parsingError: 'Parsing error: {{message}}.'
}
},

@@ -95,3 +98,3 @@ /**

loc: { line: error.lineNumber, column: error.column },
message: 'Parsing error: {{message}}.',
messageId: 'parsingError',
data: {

@@ -98,0 +101,0 @@ message: error.message.endsWith('.')

@@ -11,3 +11,2 @@ /**

meta: {
hasSuggestions: true,
type: 'suggestion',

@@ -21,2 +20,3 @@ docs: {

fixable: null,
hasSuggestions: true,
schema: [

@@ -48,3 +48,6 @@ {

}
]
],
messages: {
potentialTypo: `'{{name}}' may be a typo, which is similar to option [{{option}}].`
}
},

@@ -109,3 +112,3 @@ /** @param {RuleContext} context */

node: id,
message: `'{{name}}' may be a typo, which is similar to option [{{option}}].`,
messageId: 'potentialTypo',
data: {

@@ -112,0 +115,0 @@ name,

@@ -17,3 +17,2 @@ /**

meta: {
hasSuggestions: true,
type: 'problem',

@@ -26,2 +25,3 @@ docs: {

fixable: 'code',
hasSuggestions: true,
schema: [

@@ -28,0 +28,0 @@ {

@@ -113,5 +113,2 @@ /**

fixable: null,
messages: {
forbiddenClass: "'{{class}}' class is not allowed."
},
schema: {

@@ -122,2 +119,5 @@ type: 'array',

}
},
messages: {
forbiddenClass: "'{{class}}' class is not allowed."
}

@@ -124,0 +124,0 @@ },

@@ -71,3 +71,2 @@ /**

meta: {
hasSuggestions: true,
type: 'suggestion',

@@ -80,2 +79,3 @@ docs: {

fixable: null,
hasSuggestions: true,
schema: {

@@ -82,0 +82,0 @@ type: 'array',

@@ -91,3 +91,2 @@ /**

meta: {
hasSuggestions: true,
type: 'suggestion',

@@ -100,2 +99,3 @@ docs: {

fixable: null,
hasSuggestions: true,
schema: {

@@ -102,0 +102,0 @@ type: 'array',

@@ -36,2 +36,7 @@ /**

minItems: 0
},
messages: {
forbiddenElement: 'Unexpected use of forbidden HTML element {{name}}.',
// eslint-disable-next-line eslint-plugin/report-message-format
customMessage: '{{message}}'
}

@@ -54,5 +59,2 @@ },

for (const option of context.options) {
const message =
option.message ||
`Unexpected use of forbidden HTML element ${node.rawName}.`
const element = option.element || option

@@ -62,3 +64,7 @@

context.report({
message,
messageId: option.message ? 'customMessage' : 'forbiddenElement',
data: {
name: node.rawName,
message: option.message
},
node: node.startTag

@@ -65,0 +71,0 @@ })

@@ -56,3 +56,2 @@ /**

meta: {
hasSuggestions: true,
type: 'suggestion',

@@ -65,2 +64,3 @@ docs: {

fixable: null,
hasSuggestions: true,
schema: {

@@ -114,8 +114,9 @@ type: 'array',

context.report({
node: prop.type !== 'infer-type' ? prop.key : prop.node,
node: prop.type === 'infer-type' ? prop.node : prop.key,
messageId: 'restrictedProp',
data: { message },
suggest:
prop.type !== 'infer-type'
? createSuggest(
prop.type === 'infer-type'
? null
: createSuggest(
prop.key,

@@ -125,3 +126,2 @@ option,

)
: null
})

@@ -128,0 +128,0 @@ break

@@ -8,5 +8,5 @@ /**

// eslint-disable-next-line no-invalid-meta, no-invalid-meta-docs-categories
// eslint-disable-next-line internal/no-invalid-meta
module.exports = wrapCoreRule('no-restricted-syntax', {
applyDocument: true
})

@@ -19,3 +19,6 @@ /**

fixable: null,
schema: []
schema: [],
messages: {
noRootVIf: '`v-if` should not be used on root element without `v-else`.'
}
},

@@ -40,4 +43,3 @@ /** @param {RuleContext} context */

loc: element.loc,
message:
'`v-if` should not be used on root element without `v-else`.'
messageId: 'noRootVIf'
})

@@ -44,0 +46,0 @@ }

@@ -26,3 +26,6 @@ /**

},
/** @param {RuleContext} context */
/**
* @param {RuleContext} context
* @returns {RuleListener}
**/
create(context) {

@@ -36,2 +39,6 @@ /**

const setupScopePropsReferenceIds = new Map()
const wrapperExpressionTypes = new Set([
'ArrayExpression',
'ObjectExpression'
])

@@ -64,3 +71,11 @@ /**

const rightNode = utils.skipChainExpression(right)
if (
wrapperExpressionTypes.has(rightNode.type) &&
isPropsMemberAccessed(rightNode, propsReferences)
) {
return report(rightNode, 'getProperty', propsReferences.scopeName)
}
if (
left.type !== 'ArrayPattern' &&

@@ -72,2 +87,3 @@ left.type !== 'ObjectPattern' &&

}
/** @type {Expression | Super} */

@@ -82,3 +98,21 @@ let rightId = rightNode

}
/**
* @param {Expression} node
* @param {ScopePropsReferences} propsReferences
*/
function isPropsMemberAccessed(node, propsReferences) {
const propRefs = [...propsReferences.refs.values()]
return propRefs.some((props) => {
const isPropsInExpressionRange = utils.inRange(node.range, props)
const isPropsMemberExpression =
props.parent.type === 'MemberExpression' &&
props.parent.object === props
return isPropsInExpressionRange && isPropsMemberExpression
})
}
/**
* @typedef {object} ScopeStack

@@ -122,2 +156,7 @@ * @property {ScopeStack | null} upper

for (const reference of variable.references) {
// If reference is in another scope, we can't check it.
if (reference.from !== context.getScope()) {
continue
}
if (!reference.isRead()) {

@@ -154,2 +193,22 @@ continue

/**
* @param {CallExpression} node
*/
CallExpression(node) {
if (!scopeStack) {
return
}
const propsReferenceIds = setupScopePropsReferenceIds.get(
scopeStack.scopeNode
)
if (!propsReferenceIds) {
return
}
if (isPropsMemberAccessed(node, propsReferenceIds)) {
report(node, 'getProperty', propsReferenceIds.scopeName)
}
},
/**
* @param {VariableDeclarator} node

@@ -156,0 +215,0 @@ */

@@ -49,3 +49,7 @@ /**

fixable: 'code',
schema: []
schema: [],
messages: {
dataPropertyMustBeFunction:
'`data` property in component must be a function.'
}
},

@@ -68,3 +72,3 @@ /** @param {RuleContext} context */

node: invalidData,
message: '`data` property in component must be a function.',
messageId: 'dataPropertyMustBeFunction',
fix(fixer) {

@@ -71,0 +75,0 @@ const tokens = getFirstAndLastTokens(invalidData.value, sourceCode)

@@ -27,3 +27,9 @@ /**

fixable: null,
schema: []
schema: [],
messages: {
unexpectedSideEffectInFunction:
'Unexpected side effect in computed function.',
unexpectedSideEffectInProperty:
'Unexpected side effect in "{{key}}" computed property.'
}
},

@@ -106,3 +112,3 @@ /** @param {RuleContext} context */

node: invalid.node,
message: 'Unexpected side effect in "{{key}}" computed property.',
messageId: 'unexpectedSideEffectInProperty',
data: { key: computedProperty.key || 'Unknown' }

@@ -168,3 +174,3 @@ })

node: invalid.node,
message: 'Unexpected side effect in computed function.'
messageId: 'unexpectedSideEffectInFunction'
})

@@ -171,0 +177,0 @@ }

@@ -18,3 +18,6 @@ /**

fixable: 'whitespace',
schema: []
schema: [],
messages: {
unexpectedSpaces: 'Unexpected spaces found around equal signs.'
}
},

@@ -41,4 +44,3 @@ /** @param {RuleContext} context */

},
message: 'Unexpected spaces found around equal signs.',
data: {},
messageId: 'unexpectedSpaces',
fix: (fixer) => fixer.replaceTextRange(range, expect)

@@ -45,0 +47,0 @@ })

@@ -8,3 +8,3 @@ /**

// eslint-disable-next-line no-invalid-meta, no-invalid-meta-docs-categories
// eslint-disable-next-line internal/no-invalid-meta
module.exports = wrapCoreRule('no-sparse-arrays')

@@ -33,3 +33,7 @@ /**

fixable: null,
schema: []
schema: [],
messages: {
alreadyDeclaredInUpperScope:
"Variable '{{name}}' is already declared in the upper scope."
}
},

@@ -109,4 +113,3 @@ /** @param {RuleContext} context */

loc: varNode.loc,
message:
"Variable '{{name}}' is already declared in the upper scope.",
messageId: 'alreadyDeclaredInUpperScope',
data: {

@@ -113,0 +116,0 @@ name

@@ -119,3 +119,7 @@ /**

}
]
],
messages: {
missingRel:
'Using target="_blank" without rel="noopener noreferrer" is a security risk.'
}
},

@@ -148,4 +152,3 @@

node,
message:
'Using target="_blank" without rel="noopener noreferrer" is a security risk.',
messageId: 'missingRel',
suggest: [getSuggestion(node)]

@@ -152,0 +155,0 @@ })

@@ -19,3 +19,6 @@ /**

fixable: null,
schema: []
schema: [],
messages: {
unexpected: "Unexpected mustache. Use 'v-model' instead."
}
},

@@ -34,3 +37,3 @@ /** @param {RuleContext} context */

loc: node.loc,
message: "Unexpected mustache. Use 'v-model' instead."
messageId: 'unexpected'
})

@@ -37,0 +40,0 @@ }

@@ -30,3 +30,6 @@ /**

}
]
],
messages: {
unused: 'The "{{name}}" component has been registered but not used.'
}
},

@@ -37,5 +40,5 @@ /** @param {RuleContext} context */

const ignoreWhenBindingPresent =
options.ignoreWhenBindingPresent !== undefined
? options.ignoreWhenBindingPresent
: true
options.ignoreWhenBindingPresent === undefined
? true
: options.ignoreWhenBindingPresent
const usedComponents = new Set()

@@ -129,4 +132,3 @@ /** @type { { node: Property, name: string }[] } */

node,
message:
'The "{{name}}" component has been registered but not used.',
messageId: 'unused',
data: {

@@ -133,0 +135,0 @@ name

@@ -426,3 +426,3 @@ /**

groupName: 'props',
node: prop.type !== 'infer-type' ? prop.key : prop.node
node: prop.type === 'infer-type' ? prop.node : prop.key
})

@@ -429,0 +429,0 @@ }

@@ -54,3 +54,2 @@ /**

meta: {
hasSuggestions: true,
type: 'suggestion',

@@ -64,2 +63,3 @@ docs: {

fixable: null,
hasSuggestions: true,
schema: [

@@ -75,3 +75,8 @@ {

}
]
],
messages: {
unusedVariable: "'{{name}}' is defined but never used.",
replaceWithUnderscore:
'Replace `{{name}}` with `_{{name}}` to ignore the unused variable.'
}
},

@@ -119,3 +124,3 @@ /** @param {RuleContext} context */

loc: variable.id.loc,
message: `'{{name}}' is defined but never used.`,
messageId: 'unusedVariable',
data: {

@@ -128,3 +133,4 @@ name: variable.id.name

{
desc: `Replace the ${variable.id.name} with _${variable.id.name}`,
messageId: 'replaceWithUnderscore',
data: { name: variable.id.name },
fix(fixer) {

@@ -131,0 +137,0 @@ return fixer.replaceText(

@@ -41,3 +41,3 @@ /**

docs: {
description: 'disallow use v-if on the same element as v-for',
description: 'disallow using `v-if` on the same element as `v-for`',
categories: ['vue3-essential', 'essential'],

@@ -57,3 +57,8 @@ url: 'https://eslint.vuejs.org/rules/no-use-v-if-with-v-for.html'

}
]
],
messages: {
movedToWrapper: "This 'v-if' should be moved to the wrapper element.",
shouldUseComputed:
"The '{{iteratorName}}' {{kind}} inside 'v-for' directive should be replaced with a computed property that returns filtered array instead. You should not mix 'v-for' with 'v-if'."
}
},

@@ -85,4 +90,3 @@ /** @param {RuleContext} context */

loc: node.loc,
message:
"The '{{iteratorName}}' {{kind}} inside 'v-for' directive should be replaced with a computed property that returns filtered array instead. You should not mix 'v-for' with 'v-if'.",
messageId: 'shouldUseComputed',
data: {

@@ -104,3 +108,3 @@ iteratorName:

loc: node.loc,
message: "This 'v-if' should be moved to the wrapper element."
messageId: 'movedToWrapper'
})

@@ -107,0 +111,0 @@ }

@@ -8,5 +8,5 @@ /**

// eslint-disable-next-line no-invalid-meta, no-invalid-meta-docs-categories
// eslint-disable-next-line internal/no-invalid-meta
module.exports = wrapCoreRule('no-useless-concat', {
applyDocument: true
})

@@ -34,2 +34,3 @@ /**

meta: {
type: 'suggestion',
docs: {

@@ -41,6 +42,2 @@ description: 'disallow unnecessary mustache interpolations',

fixable: 'code',
messages: {
unexpected:
'Unexpected mustache interpolation with a string literal value.'
},
schema: [

@@ -60,3 +57,6 @@ {

],
type: 'suggestion'
messages: {
unexpected:
'Unexpected mustache interpolation with a string literal value.'
}
},

@@ -63,0 +63,0 @@ /** @param {RuleContext} context */

@@ -14,2 +14,3 @@ /**

meta: {
type: 'suggestion',
docs: {

@@ -21,5 +22,2 @@ description: 'disallow unnecessary `v-bind` directives',

fixable: 'code',
messages: {
unexpected: 'Unexpected `v-bind` with a string literal value.'
},
schema: [

@@ -39,3 +37,5 @@ {

],
type: 'suggestion'
messages: {
unexpected: 'Unexpected `v-bind` with a string literal value.'
}
},

@@ -42,0 +42,0 @@ /** @param {RuleContext} context */

@@ -17,3 +17,6 @@ /**

fixable: null,
schema: []
schema: [],
messages: {
unexpected: "'v-html' directive can lead to XSS attack."
}
},

@@ -28,3 +31,3 @@ /** @param {RuleContext} context */

loc: node.loc,
message: "'v-html' directive can lead to XSS attack."
messageId: 'unexpected'
})

@@ -31,0 +34,0 @@ }

@@ -17,3 +17,6 @@ /**

fixable: null,
schema: []
schema: [],
messages: {
unexpected: "Don't use 'v-text'."
}
},

@@ -28,3 +31,3 @@ /** @param {RuleContext} context */

loc: node.loc,
message: "Don't use 'v-text'."
messageId: 'unexpected'
})

@@ -31,0 +34,0 @@ }

@@ -8,5 +8,5 @@ /**

// eslint-disable-next-line no-invalid-meta, no-invalid-meta-docs-categories
// eslint-disable-next-line internal/no-invalid-meta
module.exports = wrapCoreRule('object-curly-newline', {
skipDynamicArguments: true
})

@@ -8,5 +8,5 @@ /**

// eslint-disable-next-line no-invalid-meta, no-invalid-meta-docs-categories
// eslint-disable-next-line internal/no-invalid-meta
module.exports = wrapCoreRule('object-curly-spacing', {
skipDynamicArguments: true
})

@@ -8,5 +8,5 @@ /**

// eslint-disable-next-line no-invalid-meta, no-invalid-meta-docs-categories
// eslint-disable-next-line internal/no-invalid-meta
module.exports = wrapCoreRule('object-property-newline', {
skipDynamicArguments: true
})

@@ -9,5 +9,5 @@ /**

// eslint-disable-next-line no-invalid-meta, no-invalid-meta-docs-categories
// eslint-disable-next-line internal/no-invalid-meta
module.exports = wrapCoreRule('object-shorthand', {
skipDynamicArguments: true
})

@@ -8,3 +8,3 @@ /**

// eslint-disable-next-line no-invalid-meta, no-invalid-meta-docs-categories
// eslint-disable-next-line internal/no-invalid-meta
module.exports = wrapCoreRule('operator-linebreak')

@@ -231,3 +231,7 @@ /**

}
]
],
messages: {
order:
'The "{{name}}" property should be above the "{{firstUnorderedPropertyName}}" property on line {{line}}.'
}
},

@@ -289,3 +293,3 @@ /** @param {RuleContext} context */

node: property.node,
message: `The "{{name}}" property should be above the "{{firstUnorderedPropertyName}}" property on line {{line}}.`,
messageId: 'order',
data: {

@@ -292,0 +296,0 @@ name: property.name,

@@ -56,3 +56,2 @@ /**

fixable: null,
// eslint-disable-next-line eslint-plugin/require-meta-has-suggestions -- `context.report` with suggestion is not recognized in `checkArrayExpression`
hasSuggestions: true,

@@ -59,0 +58,0 @@ schema: [],

@@ -8,5 +8,5 @@ /**

// eslint-disable-next-line no-invalid-meta, no-invalid-meta-docs-categories
// eslint-disable-next-line internal/no-invalid-meta
module.exports = wrapCoreRule('prefer-template', {
applyDocument: true
})

@@ -33,3 +33,3 @@ /**

node: item.node,
message: 'Prop "{{name}}" is not in {{caseType}}.',
messageId: 'invalidCase',
data: {

@@ -69,5 +69,8 @@ name: propName,

}
]
],
messages: {
invalidCase: 'Prop "{{name}}" is not in {{caseType}}.'
}
},
create
}

@@ -9,3 +9,3 @@ /**

// eslint-disable-next-line no-invalid-meta, no-invalid-meta-docs-categories
// eslint-disable-next-line internal/no-invalid-meta
module.exports = wrapCoreRule('quote-props', {

@@ -12,0 +12,0 @@ skipDynamicArguments: true,

@@ -19,3 +19,7 @@ /**

fixable: null,
schema: []
schema: [],
messages: {
requireComponentIs:
"Expected '<component>' elements to have 'v-bind:is' attribute."
}
},

@@ -31,4 +35,3 @@ /** @param {RuleContext} context */

loc: node.loc,
message:
"Expected '<component>' elements to have 'v-bind:is' attribute."
messageId: 'requireComponentIs'
})

@@ -35,0 +38,0 @@ }

@@ -54,3 +54,3 @@ /**

},
fixable: null, // or "code" or "whitespace"
fixable: null,
schema: [],

@@ -154,5 +154,5 @@ messages: {

const propName =
prop.propName != null
? prop.propName
: `[${context.getSourceCode().getText(prop.node.key)}]`
prop.propName == null
? `[${context.getSourceCode().getText(prop.node.key)}]`
: prop.propName

@@ -159,0 +159,0 @@ context.report({

@@ -17,3 +17,3 @@ /**

},
fixable: null, // or "code" or "whitespace"
fixable: null,
schema: [

@@ -27,3 +27,7 @@ {

}
]
],
messages: {
expectedDirectExport:
'Expected the component literal to be directly exported.'
}
},

@@ -101,3 +105,3 @@ /** @param {RuleContext} context */

node: node.parent,
message: `Expected the component literal to be directly exported.`
messageId: 'expectedDirectExport'
})

@@ -139,3 +143,3 @@ },

node,
message: `Expected the component literal to be directly exported.`
messageId: 'expectedDirectExport'
})

@@ -142,0 +146,0 @@ }

@@ -15,3 +15,2 @@ /**

meta: {
hasSuggestions: true,
type: 'suggestion',

@@ -24,2 +23,4 @@ docs: {

fixable: null,
hasSuggestions: true,
schema: [],
messages: {

@@ -30,4 +31,3 @@ missing: 'Emit "{{name}}" should define at least its validator function.',

emptyValidation: 'Replace with a validator function with no parameters.'
},
schema: []
}
},

@@ -34,0 +34,0 @@ /** @param {RuleContext} context */

@@ -76,3 +76,2 @@ /**

meta: {
hasSuggestions: true,
type: 'suggestion',

@@ -85,2 +84,3 @@ docs: {

fixable: null,
hasSuggestions: true,
schema: [

@@ -87,0 +87,0 @@ {

@@ -58,3 +58,2 @@ /**

meta: {
hasSuggestions: true,
type: 'suggestion',

@@ -67,2 +66,3 @@ docs: {

fixable: null,
hasSuggestions: true,
schema: [],

@@ -69,0 +69,0 @@ messages: {

@@ -19,3 +19,2 @@ /**

meta: {
hasSuggestions: true,
type: 'suggestion',

@@ -28,2 +27,3 @@ docs: {

fixable: null,
hasSuggestions: true,
schema: [

@@ -30,0 +30,0 @@ {

@@ -54,3 +54,7 @@ /**

hasSuggestions: true,
schema: []
schema: [],
messages: {
missingName: 'Required name property is not set.',
addName: 'Add name property to component.'
}
},

@@ -74,6 +78,6 @@ /** @param {RuleContext} context */

node: component,
message: 'Required name property is not set.',
messageId: 'missingName',
suggest: [
{
desc: 'Add name property to component.',
messageId: 'addName',
fix(fixer) {

@@ -80,0 +84,0 @@ const extension = path.extname(context.getFilename())

@@ -79,14 +79,18 @@ /**

switch (type) {
case 'block':
case 'block': {
messageId = verifyBlock(lastPrecedingComment)
break
case 'line':
}
case 'line': {
messageId = verifyLine(lastPrecedingComment)
break
case 'any':
}
case 'any': {
messageId = verifyAny(lastPrecedingComment)
break
default:
}
default: {
messageId = verifyJSDoc(lastPrecedingComment)
break
}
}

@@ -93,0 +97,0 @@

@@ -14,4 +14,2 @@ /**

const message = 'The "{{name}}" property should be a constructor.'
const forbiddenTypes = new Set([

@@ -42,4 +40,7 @@ 'Literal',

},
fixable: 'code', // or "code" or "whitespace"
schema: []
fixable: 'code',
schema: [],
messages: {
propTypeConstructor: 'The "{{name}}" property should be a constructor.'
}
},

@@ -63,3 +64,3 @@

node: prop,
message,
messageId: 'propTypeConstructor',
data: {

@@ -66,0 +67,0 @@ name: propName

@@ -21,6 +21,7 @@ /**

},
fixable: null, // or "code" or "whitespace"
schema: [
// fill in your schema
]
fixable: null,
schema: [],
messages: {
requireType: 'Prop "{{name}}" should define at least its type.'
}
},

@@ -88,3 +89,3 @@ /** @param {RuleContext} context */

node,
message: 'Prop "{{name}}" should define at least its type.',
messageId: 'requireType',
data: {

@@ -91,0 +92,0 @@ name

@@ -17,4 +17,7 @@ /**

},
fixable: null, // or "code" or "whitespace"
schema: []
fixable: null,
schema: [],
messages: {
expectedReturn: 'Expected to return a value in render function.'
}
},

@@ -37,3 +40,3 @@ /** @param {RuleContext} context */

node: key,
message: 'Expected to return a value in render function.'
messageId: 'expectedReturn'
})

@@ -40,0 +43,0 @@ }

@@ -34,7 +34,7 @@ /**

fixable: null,
schema: [],
messages: {
noType:
'Specify type parameter for `{{name}}` function, otherwise created variable will not be typechecked.'
},
schema: []
}
},

@@ -41,0 +41,0 @@ /** @param {RuleContext} context */

@@ -19,3 +19,7 @@ /**

fixable: null,
schema: []
schema: [],
messages: {
requireKey:
"Elements in iteration expect to have 'v-bind:key' directives."
}
},

@@ -42,4 +46,3 @@ /** @param {RuleContext} context */

loc: element.startTag.loc,
message:
"Elements in iteration expect to have 'v-bind:key' directives."
messageId: 'requireKey'
})

@@ -46,0 +49,0 @@ }

@@ -82,3 +82,7 @@ /**

fixable: null,
schema: []
schema: [],
messages: {
invalidType:
"Type of the default value for '{{name}}' prop must be a {{types}}."
}
},

@@ -236,9 +240,8 @@ /** @param {RuleContext} context */

const propName =
prop.propName != null
? prop.propName
: `[${context.getSourceCode().getText(prop.node.key)}]`
prop.propName == null
? `[${context.getSourceCode().getText(prop.node.key)}]`
: prop.propName
context.report({
node,
message:
"Type of the default value for '{{name}}' prop must be a {{types}}.",
messageId: 'invalidType',
data: {

@@ -287,17 +290,3 @@ name: propName,

if (!defType.function) {
if (
typeNames.has(defType.type) &&
!FUNCTION_VALUE_TYPES.has(defType.type)
) {
continue
}
report(
defExpr,
prop,
[...typeNames].map((type) =>
FUNCTION_VALUE_TYPES.has(type) ? 'Function' : type
)
)
} else {
if (defType.function) {
if (typeNames.has('Function')) {

@@ -318,2 +307,16 @@ continue

}
} else {
if (
typeNames.has(defType.type) &&
!FUNCTION_VALUE_TYPES.has(defType.type)
) {
continue
}
report(
defExpr,
prop,
[...typeNames].map((type) =>
FUNCTION_VALUE_TYPES.has(type) ? 'Function' : type
)
)
}

@@ -320,0 +323,0 @@ }

@@ -22,3 +22,3 @@ /**

},
fixable: null, // or "code" or "whitespace"
fixable: null,
schema: [

@@ -34,3 +34,9 @@ {

}
]
],
messages: {
expectedReturnInFunction:
'Expected to return a value in computed function.',
expectedReturnInProperty:
'Expected to return a value in "{{name}}" computed property.'
}
},

@@ -88,4 +94,3 @@ /** @param {RuleContext} context */

node,
message:
'Expected to return a value in "{{name}}" computed property.',
messageId: 'expectedReturnInProperty',
data: {

@@ -101,3 +106,3 @@ name: cp.key || 'Unknown'

node,
message: 'Expected to return a value in computed function.'
messageId: 'expectedReturnInFunction'
})

@@ -104,0 +109,0 @@ }

@@ -43,4 +43,10 @@ /**

},
fixable: null, // or "code" or "whitespace"
schema: []
fixable: null,
schema: [],
messages: {
expectedTrue:
'Expected to return a true value in "{{name}}" emits validator.',
expectedBoolean:
'Expected to return a boolean value in "{{name}}" emits validator.'
}
},

@@ -131,5 +137,5 @@ /** @param {RuleContext} context */

node,
message: scopeStack.hasReturnValue
? 'Expected to return a true value in "{{name}}" emits validator.'
: 'Expected to return a boolean value in "{{name}}" emits validator.',
messageId: scopeStack.hasReturnValue
? 'expectedTrue'
: 'expectedBoolean',
data: {

@@ -136,0 +142,0 @@ name: emits.emitName || 'Unknown'

@@ -10,2 +10,3 @@ /**

module.exports = {
// eslint-disable-next-line eslint-plugin/prefer-message-ids
meta: {

@@ -12,0 +13,0 @@ type: 'layout',

@@ -22,2 +22,3 @@ /**

module.exports = {
// eslint-disable-next-line eslint-plugin/prefer-message-ids
meta: {

@@ -31,4 +32,4 @@ type: 'problem',

},
deprecated: true,
schema: []
schema: [],
deprecated: true
},

@@ -35,0 +36,0 @@ /**

@@ -8,3 +8,3 @@ /**

// eslint-disable-next-line no-invalid-meta, no-invalid-meta-docs-categories
// eslint-disable-next-line internal/no-invalid-meta
module.exports = wrapCoreRule('space-in-parens', {

@@ -11,0 +11,0 @@ skipDynamicArguments: true,

@@ -8,3 +8,3 @@ /**

// eslint-disable-next-line no-invalid-meta, no-invalid-meta-docs-categories
// eslint-disable-next-line internal/no-invalid-meta
module.exports = wrapCoreRule('space-infix-ops', {

@@ -11,0 +11,0 @@ skipDynamicArguments: true,

@@ -8,3 +8,3 @@ /**

// eslint-disable-next-line no-invalid-meta, no-invalid-meta-docs-categories
// eslint-disable-next-line internal/no-invalid-meta
module.exports = wrapCoreRule('space-unary-ops', {

@@ -11,0 +11,0 @@ skipDynamicArguments: true,

@@ -18,3 +18,6 @@ /**

fixable: 'code',
schema: []
schema: [],
messages: {
shouldBeOrdered: 'Classes should be ordered alphabetically.'
}
},

@@ -48,3 +51,3 @@ /** @param {RuleContext} context */

loc: node.loc,
message: 'Classes should be ordered alphabetically.',
messageId: 'shouldBeOrdered',
fix: (fixer) => fixer.replaceText(value, `"${classListSorted}"`)

@@ -51,0 +54,0 @@ })

@@ -8,3 +8,3 @@ /**

// eslint-disable-next-line no-invalid-meta, no-invalid-meta-docs-categories
// eslint-disable-next-line internal/no-invalid-meta
module.exports = wrapCoreRule('template-curly-spacing', {

@@ -11,0 +11,0 @@ skipDynamicArguments: true,

@@ -23,3 +23,7 @@ /**

}
]
],
messages: {
unexpected: "Unexpected usage of 'this'.",
expected: "Expected 'this'."
}
},

@@ -34,3 +38,3 @@

create(context) {
const options = context.options[0] !== 'always' ? 'never' : 'always'
const options = context.options[0] === 'always' ? 'always' : 'never'
/**

@@ -92,3 +96,3 @@ * @typedef {object} ScopeStack

},
message: "Unexpected usage of 'this'."
messageId: 'unexpected'
})

@@ -118,3 +122,3 @@ }

loc: reference.id.loc,
message: "Expected 'this'.",
messageId: 'expected',
fix(fixer) {

@@ -121,0 +125,0 @@ return fixer.insertTextBefore(reference.id, 'this.')

@@ -171,3 +171,6 @@ /**

fixable: null,
schema: []
schema: [],
messages: {
considerExact: "Consider to use '.exact' modifier."
}
},

@@ -213,3 +216,3 @@

loc: e.node.loc,
message: "Consider to use '.exact' modifier."
messageId: 'considerExact'
})

@@ -216,0 +219,0 @@ }

@@ -19,3 +19,8 @@ /**

fixable: 'code',
schema: [{ enum: ['shorthand', 'longform'] }]
schema: [{ enum: ['shorthand', 'longform'] }],
messages: {
expectedLonghand: "Expected 'v-bind' before ':'.",
unexpectedLonghand: "Unexpected 'v-bind' before ':'.",
expectedLonghandForProp: "Expected 'v-bind:' instead of '.'."
}
},

@@ -37,7 +42,7 @@ /** @param {RuleContext} context */

let message = "Expected 'v-bind' before ':'."
let messageId = 'expectedLonghand'
if (preferShorthand) {
message = "Unexpected 'v-bind' before ':'."
messageId = 'unexpectedLonghand'
} else if (shorthandProp) {
message = "Expected 'v-bind:' instead of '.'."
messageId = 'expectedLonghandForProp'
}

@@ -48,3 +53,3 @@

loc: node.loc,
message,
messageId,
*fix(fixer) {

@@ -51,0 +56,0 @@ if (preferShorthand) {

@@ -21,3 +21,7 @@ /**

fixable: 'code',
schema: [{ enum: ['in', 'of'] }]
schema: [{ enum: ['in', 'of'] }],
messages: {
expected:
"Expected '{{preferredDelimiter}}' instead of '{{usedDelimiter}}' in 'v-for'."
}
},

@@ -52,3 +56,3 @@ /** @param {RuleContext} context */

loc: node.loc,
message: `Expected '{{preferredDelimiter}}' instead of '{{usedDelimiter}}' in 'v-for'.`,
messageId: 'expected',
data: {

@@ -55,0 +59,0 @@ preferredDelimiter,

@@ -8,2 +8,3 @@ 'use strict'

meta: {
type: 'suggestion',
docs: {

@@ -40,3 +41,8 @@ description:

],
type: 'suggestion'
messages: {
// eslint-disable-next-line eslint-plugin/report-message-format
mustBeHyphenated: "v-on event '{{text}}' must be hyphenated.",
// eslint-disable-next-line eslint-plugin/report-message-format
cannotBeHyphenated: "v-on event '{{text}}' can't be hyphenated."
}
},

@@ -69,5 +75,3 @@

loc: node.loc,
message: useHyphenated
? "v-on event '{{text}}' must be hyphenated."
: "v-on event '{{text}}' can't be hyphenated.",
messageId: useHyphenated ? 'mustBeHyphenated' : 'cannotBeHyphenated',
data: {

@@ -74,0 +78,0 @@ text

@@ -86,2 +86,7 @@ /**

],
messages: {
always: "Method calls inside of 'v-on' directives must have parentheses.",
never:
"Method calls without arguments inside of 'v-on' directives must not have parentheses."
},
deprecated: true,

@@ -102,4 +107,3 @@ replacedBy: ['v-on-handler-style']

node,
message:
"Method calls inside of 'v-on' directives must have parentheses."
messageId: 'always'
})

@@ -158,4 +162,3 @@ }

node: expression,
message:
"Method calls without arguments inside of 'v-on' directives must not have parentheses.",
messageId: 'never',
fix: hasComment

@@ -162,0 +165,0 @@ ? null /* The comment is included and cannot be fixed. */

@@ -182,7 +182,9 @@ /**

switch (kind) {
case 'method':
case 'method': {
return verifyCanUseMethodHandlerForInlineHandler(node)
case 'inline-function':
}
case 'inline-function': {
reportCanUseInlineFunctionForInlineHandler(node)
return true
}
}

@@ -200,3 +202,3 @@ return false

case 'inline':
case 'inline-function':
case 'inline-function': {
context.report({

@@ -210,2 +212,3 @@ node,

return true
}
}

@@ -223,7 +226,9 @@ // This path is currently not taken.

switch (kind) {
case 'method':
case 'method': {
return verifyCanUseMethodHandlerForInlineFunction(node)
case 'inline':
}
case 'inline': {
reportCanUseInlineHandlerForInlineFunction(node)
return true
}
}

@@ -536,4 +541,5 @@ return false

}
default:
default: {
return
}
}

@@ -540,0 +546,0 @@ },

@@ -19,3 +19,7 @@ /**

fixable: 'code',
schema: [{ enum: ['shorthand', 'longform'] }]
schema: [{ enum: ['shorthand', 'longform'] }],
messages: {
expectedShorthand: "Expected '@' instead of 'v-on:'.",
expectedLonghand: "Expected 'v-on:' instead of '@'."
}
},

@@ -40,5 +44,3 @@ /** @param {RuleContext} context */

loc: node.loc,
message: preferShorthand
? "Expected '@' instead of 'v-on:'."
: "Expected 'v-on:' instead of '@'.",
messageId: preferShorthand ? 'expectedShorthand' : 'expectedLonghand',
fix: (fixer) =>

@@ -45,0 +47,0 @@ preferShorthand

@@ -144,10 +144,14 @@ /**

switch (expected) {
case 'shorthand':
case 'shorthand': {
return fixer.replaceTextRange(range, `#${argumentText}`)
case 'longform':
}
case 'longform': {
return fixer.replaceTextRange(range, `v-slot:${argumentText}`)
case 'v-slot':
}
case 'v-slot': {
return fixer.replaceTextRange(range, 'v-slot')
default:
}
default: {
return null
}
}

@@ -154,0 +158,0 @@ }

@@ -20,3 +20,6 @@ /**

fixable: null,
schema: []
schema: [],
messages: {
invalidKey: "Invalid key '{{name}}' in model option."
}
},

@@ -42,3 +45,3 @@ /** @param {RuleContext} context */

node: p,
message: "Invalid key '{{name}}' in model option.",
messageId: 'invalidKey',
data: {

@@ -45,0 +48,0 @@ name

@@ -113,3 +113,2 @@ /**

meta: {
hasSuggestions: true,
type: 'problem',

@@ -122,3 +121,13 @@ docs: {

fixable: 'code',
schema: []
hasSuggestions: true,
schema: [],
messages: {
shouldBeFunction: '`nextTick` is a function.',
missingCallbackOrAwait:
'Await the Promise returned by `nextTick` or pass a callback function.',
addAwait: 'Add missing `await` statement.',
tooManyParameters: '`nextTick` expects zero or one parameters.',
eitherAwaitOrCallback:
'Either await the Promise or pass a callback function to `nextTick`.'
}
},

@@ -161,3 +170,3 @@ /** @param {RuleContext} context */

node,
message: '`nextTick` is a function.',
messageId: 'shouldBeFunction',
fix(fixer) {

@@ -174,7 +183,6 @@ return fixer.insertTextAfter(node, '()')

node,
message:
'Await the Promise returned by `nextTick` or pass a callback function.',
messageId: 'missingCallbackOrAwait',
suggest: [
{
desc: 'Add missing `await` statement.',
messageId: 'addAwait',
fix(fixer) {

@@ -193,3 +201,3 @@ return fixer.insertTextBefore(parentNode, 'await ')

node,
message: '`nextTick` expects zero or one parameters.'
messageId: 'tooManyParameters'
})

@@ -202,4 +210,3 @@ return

node,
message:
'Either await the Promise or pass a callback function to `nextTick`.'
messageId: 'eitherAwaitOrCallback'
})

@@ -206,0 +213,0 @@ }

@@ -19,3 +19,8 @@ /**

fixable: null,
schema: []
schema: [],
messages: {
emptySrc:
"The template root with 'src' attribute is required to be empty.",
noChild: 'The template requires child element.'
}
},

@@ -48,4 +53,3 @@ /** @param {RuleContext} context */

loc: element.loc,
message:
"The template root with 'src' attribute is required to be empty."
messageId: 'emptySrc'
})

@@ -57,3 +61,3 @@ }

loc: element.loc,
message: 'The template requires child element.'
messageId: 'noChild'
})

@@ -60,0 +64,0 @@ }

@@ -232,3 +232,2 @@ /**

*/
// eslint-disable-next-line complexity -- ignore
'*[type=/^TS/]'(node) {

@@ -235,0 +234,0 @@ if (!isTypeNode(node)) {

@@ -653,10 +653,10 @@ /**

}
if (!isFunctionalTemplate) {
if (isFunctionalTemplate) {
if (id.name === 'props') {
references.push(extractFromExpression(id, true))
}
} else {
references.push(
extractFromName(id.name, id, () => extractFromExpression(id, true))
)
} else {
if (id.name === 'props') {
references.push(extractFromExpression(id, true))
}
}

@@ -663,0 +663,0 @@ }

@@ -171,3 +171,3 @@ 'use strict'

switch (combinator.trim()) {
case '':
case '': {
// descendant

@@ -186,3 +186,4 @@ return (element, subject) => {

}
case '>':
}
case '>': {
// child

@@ -198,3 +199,4 @@ return (element, subject) => {

}
case '+':
}
case '+': {
// adjacent

@@ -210,3 +212,4 @@ return (element, subject) => {

}
case '~':
}
case '~': {
// sibling

@@ -223,4 +226,6 @@ return (element, subject) => {

}
default:
}
default: {
throw new SelectorError(`Unknown combinator: ${combinator}.`)
}
}

@@ -236,22 +241,31 @@ }

switch (selector.type) {
case 'attribute':
case 'attribute': {
return attributeNodeToVElementMatcher(selector)
case 'class':
}
case 'class': {
return classNameNodeToVElementMatcher(selector)
case 'id':
}
case 'id': {
return identifierNodeToVElementMatcher(selector)
case 'tag':
}
case 'tag': {
return tagNodeToVElementMatcher(selector)
case 'universal':
}
case 'universal': {
return universalNodeToVElementMatcher(selector)
case 'pseudo':
}
case 'pseudo': {
return pseudoNodeToVElementMatcher(selector)
case 'nesting':
}
case 'nesting': {
throw new SelectorError('Unsupported nesting selector.')
case 'string':
}
case 'string': {
throw new SelectorError(`Unknown selector: ${selector.value}.`)
default:
}
default: {
throw new SelectorError(
`Unknown selector: ${/** @type {any}*/ (selector).value}.`
)
}
}

@@ -273,5 +287,6 @@ }

switch (selector.operator) {
case '=':
case '=': {
return buildVElementMatcher(value, (attr, val) => attr === val)
case '~=':
}
case '~=': {
// words

@@ -281,3 +296,4 @@ return buildVElementMatcher(value, (attr, val) =>

)
case '|=':
}
case '|=': {
// immediately followed by hyphen

@@ -288,13 +304,18 @@ return buildVElementMatcher(

)
case '^=':
}
case '^=': {
// prefixed
return buildVElementMatcher(value, (attr, val) => attr.startsWith(val))
case '$=':
}
case '$=': {
// suffixed
return buildVElementMatcher(value, (attr, val) => attr.endsWith(val))
case '*=':
}
case '*=': {
// contains
return buildVElementMatcher(value, (attr, val) => attr.includes(val))
default:
}
default: {
throw new SelectorError(`Unsupported operator: ${selector.operator}.`)
}
}

@@ -388,10 +409,12 @@

case ':is':
case ':where':
case ':where': {
// https://developer.mozilla.org/en-US/docs/Web/CSS/:is
// https://developer.mozilla.org/en-US/docs/Web/CSS/:where
return selectorsToVElementMatcher(selector.nodes)
case ':has':
}
case ':has': {
// https://developer.mozilla.org/en-US/docs/Web/CSS/:has
return pseudoHasSelectorsToVElementMatcher(selector.nodes)
case ':empty':
}
case ':empty': {
// https://developer.mozilla.org/en-US/docs/Web/CSS/:empty

@@ -402,2 +425,3 @@ return (element) =>

)
}
case ':nth-child': {

@@ -415,6 +439,7 @@ // https://developer.mozilla.org/en-US/docs/Web/CSS/:nth-child

}
case ':first-child':
case ':first-child': {
// https://developer.mozilla.org/en-US/docs/Web/CSS/:first-child
return buildPseudoNthVElementMatcher((index) => index === 0)
case ':last-child':
}
case ':last-child': {
// https://developer.mozilla.org/en-US/docs/Web/CSS/:last-child

@@ -424,3 +449,4 @@ return buildPseudoNthVElementMatcher(

)
case ':only-child':
}
case ':only-child': {
// https://developer.mozilla.org/en-US/docs/Web/CSS/:only-child

@@ -430,2 +456,3 @@ return buildPseudoNthVElementMatcher(

)
}
case ':nth-of-type': {

@@ -443,6 +470,7 @@ // https://developer.mozilla.org/en-US/docs/Web/CSS/:nth-of-type

}
case ':first-of-type':
case ':first-of-type': {
// https://developer.mozilla.org/en-US/docs/Web/CSS/:first-of-type
return buildPseudoNthOfTypeVElementMatcher((index) => index === 0)
case ':last-of-type':
}
case ':last-of-type': {
// https://developer.mozilla.org/en-US/docs/Web/CSS/:last-of-type

@@ -452,3 +480,4 @@ return buildPseudoNthOfTypeVElementMatcher(

)
case ':only-of-type':
}
case ':only-of-type': {
// https://developer.mozilla.org/en-US/docs/Web/CSS/:only-of-type

@@ -458,4 +487,6 @@ return buildPseudoNthOfTypeVElementMatcher(

)
default:
}
default: {
throw new SelectorError(`Unsupported pseudo selector: ${pseudo}.`)
}
}

@@ -462,0 +493,0 @@ }

@@ -324,30 +324,41 @@ const { findVariable } = require('@eslint-community/eslint-utils')

case 'TSStringKeyword':
case 'TSTemplateLiteralType':
case 'TSTemplateLiteralType': {
return ['String']
case 'TSNumberKeyword':
}
case 'TSNumberKeyword': {
return ['Number']
case 'TSBooleanKeyword':
}
case 'TSBooleanKeyword': {
return ['Boolean']
case 'TSObjectKeyword':
}
case 'TSObjectKeyword': {
return ['Object']
case 'TSTypeLiteral':
}
case 'TSTypeLiteral': {
return inferTypeLiteralType(node)
case 'TSFunctionType':
}
case 'TSFunctionType': {
return ['Function']
}
case 'TSArrayType':
case 'TSTupleType':
case 'TSTupleType': {
return ['Array']
case 'TSSymbolKeyword':
}
case 'TSSymbolKeyword': {
return ['Symbol']
}
case 'TSLiteralType':
case 'TSLiteralType': {
if (node.literal.type === 'Literal') {
switch (typeof node.literal.value) {
case 'boolean':
case 'boolean': {
return ['Boolean']
case 'string':
}
case 'string': {
return ['String']
}
case 'number':
case 'bigint':
case 'bigint': {
return ['Number']
}
}

@@ -362,3 +373,4 @@ if (node.literal.value instanceof RegExp) {

)
case 'TSTypeReference':
}
case 'TSTypeReference': {
if (node.typeName.type === 'Identifier') {

@@ -396,4 +408,5 @@ const variable = findVariable(context.getScope(), node.typeName.name)

case 'WeakMap':
case 'Date':
case 'Date': {
return [name]
}
}

@@ -409,13 +422,16 @@ }

case 'Required':
case 'InstanceType':
case 'InstanceType': {
return ['Object']
}
case 'Uppercase':
case 'Lowercase':
case 'Capitalize':
case 'Uncapitalize':
case 'Uncapitalize': {
return ['String']
}
case 'Parameters':
case 'ConstructorParameters':
case 'ConstructorParameters': {
return ['Array']
case 'NonNullable':
}
case 'NonNullable': {
if (node.typeParameters && node.typeParameters.params[0]) {

@@ -429,3 +445,4 @@ return inferRuntimeType(

break
case 'Extract':
}
case 'Extract': {
if (node.typeParameters && node.typeParameters.params[1]) {

@@ -439,4 +456,5 @@ return inferRuntimeType(

break
}
case 'Exclude':
case 'OmitThisParameter':
case 'OmitThisParameter': {
if (node.typeParameters && node.typeParameters.params[0]) {

@@ -450,2 +468,3 @@ return inferRuntimeType(

break
}
}

@@ -457,8 +476,10 @@ }

)
}
case 'TSUnionType':
case 'TSIntersectionType':
case 'TSIntersectionType': {
return inferUnionType(node)
}
default:
default: {
return inferRuntimeTypeFromTypeNode(

@@ -468,2 +489,3 @@ context,

)
}
}

@@ -495,7 +517,9 @@

case 'TSCallSignatureDeclaration':
case 'TSConstructSignatureDeclaration':
case 'TSConstructSignatureDeclaration': {
types.add('Function')
break
default:
}
default: {
types.add('Object')
}
}

@@ -516,12 +540,17 @@ }

switch (typeof m.initializer.value) {
case 'string':
case 'string': {
types.add('String')
break
}
case 'number':
case 'bigint': // Now it's a syntax error.
case 'bigint': {
// Now it's a syntax error.
types.add('Number')
break
case 'boolean': // Now it's a syntax error.
}
case 'boolean': {
// Now it's a syntax error.
types.add('Boolean')
break
}
}

@@ -528,0 +557,0 @@ } else {

{
"name": "eslint-plugin-vue",
"version": "9.15.1",
"version": "9.16.0",
"description": "Official ESLint plugin for Vue.js",

@@ -15,4 +15,4 @@ "main": "lib/index.js",

"cover:report": "nyc report --reporter=html",
"lint": "eslint . --rulesdir eslint-internal-rules && markdownlint \"**/*.md\"",
"lint:fix": "eslint . --rulesdir eslint-internal-rules --fix && markdownlint \"**/*.md\" --fix",
"lint": "eslint . && markdownlint \"**/*.md\"",
"lint:fix": "eslint . --fix && markdownlint \"**/*.md\" --fix",
"tsc": "tsc",

@@ -58,40 +58,40 @@ "preversion": "npm test && git add .",

"dependencies": {
"@eslint-community/eslint-utils": "^4.3.0",
"@eslint-community/eslint-utils": "^4.4.0",
"natural-compare": "^1.4.0",
"nth-check": "^2.0.1",
"postcss-selector-parser": "^6.0.9",
"semver": "^7.3.5",
"vue-eslint-parser": "^9.3.0",
"nth-check": "^2.1.1",
"postcss-selector-parser": "^6.0.13",
"semver": "^7.5.4",
"vue-eslint-parser": "^9.3.1",
"xml-name-validator": "^4.0.0"
},
"devDependencies": {
"@ota-meshi/site-kit-eslint-editor-vue": "^0.1.0",
"@types/eslint": "^8.4.2",
"@types/eslint-visitor-keys": "^1.0.0",
"@ota-meshi/site-kit-eslint-editor-vue": "^0.1.2",
"@types/eslint": "^8.44.1",
"@types/eslint-visitor-keys": "^3.3.0",
"@types/natural-compare": "^1.4.1",
"@types/node": "^13.13.5",
"@types/semver": "^7.3.9",
"@types/xml-name-validator": "^4.0.0",
"@types/node": "^14.18.54",
"@types/semver": "^7.5.0",
"@types/xml-name-validator": "^4.0.1",
"@typescript-eslint/parser": "^5.45.0",
"assert": "^2.0.0",
"env-cmd": "^10.1.0",
"esbuild": "^0.15.15",
"eslint": "^8.15.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-eslint-plugin": "^3.5.3",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsonc": "^2.2.1",
"esbuild": "^0.18.17",
"eslint": "^8.45.0",
"eslint-config-prettier": "^8.9.0",
"eslint-plugin-eslint-plugin": "~5.1.1",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jsonc": "^2.9.0",
"eslint-plugin-node-dependencies": ">=0.5.0 <1.0.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-unicorn": "^47.0.0",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-unicorn": "^48.0.1",
"eslint-plugin-vue": "file:.",
"espree": "^9.3.2",
"espree": "^9.6.1",
"events": "^3.3.0",
"markdownlint-cli": "^0.31.1",
"mocha": "^10.0.0",
"markdownlint-cli": "^0.35.0",
"mocha": "^10.2.0",
"nyc": "^15.1.0",
"prettier": "^2.6.2",
"typescript": "^4.9.3",
"vitepress": "^1.0.0-alpha.29"
"prettier": "^3.0.0",
"typescript": "^5.1.6",
"vitepress": "^1.0.0-beta.6"
}
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc