Socket
Socket
Sign inDemoInstall

eslint-plugin-vue

Package Overview
Dependencies
Maintainers
3
Versions
170
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 4.0.0-beta.0 to 4.0.0-beta.1

19

lib/rules/html-end-tags.js

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

function create (context) {
let hasInvalidEOF = false
return utils.defineTemplateBodyVisitor(context, {
VElement (node) {
if (hasInvalidEOF) {
return
}
const name = node.name

@@ -33,11 +39,2 @@ const isVoid = utils.isHtmlVoidElementName(name)

if (isVoid && hasEndTag) {
context.report({
node: node.endTag,
loc: node.endTag.loc,
message: "'<{{name}}>' should not have end tag.",
data: { name },
fix: (fixer) => fixer.remove(node.endTag)
})
}
if (!isVoid && !hasEndTag && !isSelfClosing) {

@@ -53,2 +50,6 @@ context.report({

}
}, {
Program (node) {
hasInvalidEOF = utils.hasInvalidEOF(node)
}
})

@@ -55,0 +56,0 @@ }

@@ -29,7 +29,15 @@ /**

const quoteName = double ? 'double quotes' : 'single quotes'
const quotePattern = double ? /"/g : /'/g
const quoteEscaped = double ? '&quot;' : '&apos;'
let hasInvalidEOF
return utils.defineTemplateBodyVisitor(context, {
'VAttribute[value!=null]' (node) {
if (hasInvalidEOF) {
return
}
const text = sourceCode.getText(node.value)
const firstChar = text[0]
if (firstChar !== quoteChar) {

@@ -40,6 +48,16 @@ context.report({

message: 'Expected to be enclosed by {{kind}}.',
data: { kind: quoteName }
data: { kind: quoteName },
fix (fixer) {
const contentText = (firstChar === "'" || firstChar === '"') ? text.slice(1, -1) : text
const replacement = quoteChar + contentText.replace(quotePattern, quoteEscaped) + quoteChar
return fixer.replaceText(node.value, replacement)
}
})
}
}
}, {
Program (node) {
hasInvalidEOF = utils.hasInvalidEOF(node)
}
})

@@ -59,3 +77,3 @@ }

},
fixable: false,
fixable: 'code',
schema: [

@@ -62,0 +80,0 @@ { enum: ['double', 'single'] }

@@ -91,5 +91,10 @@ /**

const options = parseOptions(context.options[0])
let hasInvalidEOF = false
return utils.defineTemplateBodyVisitor(context, {
'VElement' (node) {
if (hasInvalidEOF) {
return
}
const elementType = getElementType(node)

@@ -135,2 +140,6 @@ const mode = options[elementType]

}
}, {
Program (node) {
hasInvalidEOF = utils.hasInvalidEOF(node)
}
})

@@ -137,0 +146,0 @@ }

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

'native', 'once', 'left', 'right', 'middle', 'passive', 'esc', 'tab',
'enter', 'space', 'up', 'left', 'right', 'down', 'delete'
'enter', 'space', 'up', 'left', 'right', 'down', 'delete', 'exact'
])

@@ -24,0 +24,0 @@ const VERB_MODIFIERS = new Set([

@@ -604,3 +604,16 @@ /**

return node.loc.start.line === node.loc.end.line
},
/**
* Check whether the templateBody of the program has invalid EOF or not.
* @param {Program} node The program node to check.
* @returns {boolean} `true` if it has invalid EOF.
*/
hasInvalidEOF (node) {
const body = node.templateBody
if (body == null || body.errors == null) {
return
}
return body.errors.some(error => typeof error.code === 'string' && error.code.startsWith('eof-'))
}
}
{
"name": "eslint-plugin-vue",
"version": "4.0.0-beta.0",
"version": "4.0.0-beta.1",
"description": "Official ESLint plugin for Vue.js",

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

@@ -9,10 +9,16 @@ # eslint-plugin-vue

## :exclamation: Attention - this is documentation for beta `3.0.0` :exclamation:
## :exclamation: Attention - this is documentation for version `4.x` :exclamation:
This branch contains `eslint-plugin-vue@beta` which is pre-released `3.0`, but it's not the default version that you get with `npm install eslint-plugin-vue`. In order to install this you need to specify either `"eslint-plugin-vue": "beta"` in `package.json` or do `npm install eslint-plugin-vue@beta`.
This branch contains `eslint-plugin-vue@next` which is a pre-released `4.0`, but it's not the default version that you get with `npm install eslint-plugin-vue`. In order to install this you need to specify either `"eslint-plugin-vue": "next"` in `package.json` or do `npm install eslint-plugin-vue@next`.
Please try it and report any issues that you might experience.
Please try it and report any issues that you might have encountered.
If you want to check previous releases [go here](https://github.com/vuejs/eslint-plugin-vue/releases).
## :art: Playground on the Web
You can try this plugin on the Web.
- https://mysticatea.github.io/vue-eslint-demo/
## :grey_exclamation: Requirements

@@ -26,3 +32,3 @@

```bash
npm install --save-dev eslint eslint-plugin-vue@beta
npm install --save-dev eslint eslint-plugin-vue@next
```

@@ -211,2 +217,11 @@

### Can my javascript code have increased indentation?
It depends on the version of eslint you're using.
[indent](https://eslint.org/docs/rules/indent) rule in `eslint@3.x` makes it possible, but if you use `eslint@4.x` be aware that this rule has been rewritten and is more strict now, thus it doesn't allow to have increased initial indentation.
You can however use [indent-legacy](https://eslint.org/docs/rules/indent-legacy) rule instead.
More informations [here](https://eslint.org/docs/user-guide/migrating-to-4.0.0#indent-rewrite).
## :anchor: Semantic Versioning Policy

@@ -213,0 +228,0 @@

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc