You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

eslint-plugin-vue

Package Overview
Dependencies
Maintainers
5
Versions
180
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-vue - npm Package Compare versions

Comparing version

to
10.1.0

lib/rules/define-props-destructuring.js

1

lib/index.js

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

'define-props-declaration': require('./rules/define-props-declaration'),
'define-props-destructuring': require('./rules/define-props-destructuring'),
'dot-location': require('./rules/dot-location'),

@@ -63,0 +64,0 @@ 'dot-notation': require('./rules/dot-notation'),

@@ -152,14 +152,30 @@ /**

/** @type {string[]} */
const allowlist = opts.allowlist || DEFAULT_ALLOWLIST
const rawAllowlist = opts.allowlist || DEFAULT_ALLOWLIST
const attributes = parseTargetAttrs(opts.attributes || DEFAULT_ATTRIBUTES)
const directives = opts.directives || DEFAULT_DIRECTIVES
const allowlistRe = new RegExp(
allowlist
.map((w) => regexp.escape(w))
.sort((a, b) => b.length - a.length)
.join('|'),
'gu'
)
/** @type {string[]} */
const stringAllowlist = []
/** @type {RegExp[]} */
const regexAllowlist = []
for (const item of rawAllowlist) {
if (regexp.isRegExp(item)) {
regexAllowlist.push(regexp.toRegExp(item))
} else {
stringAllowlist.push(item)
}
}
const allowlistRe =
stringAllowlist.length > 0
? new RegExp(
stringAllowlist
.map((w) => regexp.escape(w))
.sort((a, b) => b.length - a.length)
.join('|'),
'gu'
)
: null
/** @type {ElementStack | null} */

@@ -172,3 +188,17 @@ let elementStack = null

function getBareString(str) {
return str.trim().replace(allowlistRe, '').trim()
let result = str.trim()
if (allowlistRe) {
result = result.replace(allowlistRe, '')
}
for (const regex of regexAllowlist) {
const flags = regex.flags.includes('g')
? regex.flags
: `${regex.flags}g`
const globalRegex = new RegExp(regex.source, flags)
result = result.replace(globalRegex, '')
}
return result.trim()
}

@@ -175,0 +205,0 @@

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

/**
* Get all comments that need to be reported
* @param {(HTMLComment | HTMLBogusComment | Comment)[]} comments
* @param {Range[]} elementRanges
* @returns {(HTMLComment | HTMLBogusComment | Comment)[]}
*/
function getReportComments(comments, elementRanges) {
return comments.filter(
(comment) =>
!elementRanges.some(
(range) => range[0] <= comment.range[0] && comment.range[1] <= range[1]
)
)
}
module.exports = {

@@ -19,4 +34,15 @@ meta: {

fixable: null,
schema: [],
schema: [
{
type: 'object',
properties: {
disallowComments: {
type: 'boolean'
}
},
additionalProperties: false
}
],
messages: {
commentRoot: 'The template root disallows comments.',
multipleRoot: 'The template root requires exactly one element.',

@@ -33,2 +59,4 @@ textRoot: 'The template root requires an element rather than texts.',

create(context) {
const options = context.options[0] || {}
const disallowComments = options.disallowComments
const sourceCode = context.getSourceCode()

@@ -43,2 +71,14 @@

const comments = element.comments
const elementRanges = element.children.map((child) => child.range)
if (disallowComments && comments.length > 0) {
for (const comment of getReportComments(comments, elementRanges)) {
context.report({
node: comment,
loc: comment.loc,
messageId: 'commentRoot'
})
}
}
const rootElements = []

@@ -45,0 +85,0 @@ let extraText = null

2

package.json
{
"name": "eslint-plugin-vue",
"version": "10.0.1",
"version": "10.1.0",
"description": "Official ESLint plugin for Vue.js",

@@ -5,0 +5,0 @@ "main": "lib/index.js",