Socket
Socket
Sign inDemoInstall

eslint-plugin-vuetify

Package Overview
Dependencies
Maintainers
6
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-vuetify - npm Package Compare versions

Comparing version 1.0.0-beta.6 to 1.0.0-beta.7

lib/util/fixers.js

47

lib/rules/grid-unknown-attributes.js
'use strict'
const loadModule = require('../util/load-module')
const { hyphenate, classify, isBuiltinAttribute } = require('../util/helpers')
const { hyphenate, classify, getAttributes } = require('../util/helpers')
const { isGridAttribute } = require('../util/grid-attributes')
const { addClass, removeAttr } = require('../util/fixers')

@@ -38,10 +39,4 @@ const VGrid = {

const attributes = element.startTag.attributes.filter(node => {
if (node.directive && (node.key.name !== 'bind' || !node.key.argument)) return
const name = hyphenate(node.directive ? node.key.argument : node.key.rawName)
return !isBuiltinAttribute(name) &&
!tags[tag].includes(name) &&
!isGridAttribute(tag, name)
const attributes = getAttributes(element).filter(({ name }) => {
return !tags[tag].includes(name) && !isGridAttribute(tag, name)
})

@@ -53,8 +48,9 @@

loc: {
start: attributes[0].loc.start,
end: attributes[attributes.length - 1].loc.end
start: attributes[0].node.loc.start,
end: attributes[attributes.length - 1].node.loc.end
},
message: 'Attributes are no longer converted into classes',
fix (fixer) {
const fixableAttrs = attributes.filter(attr => !attr.directive)
const fixableAttrs = attributes.map(({ node }) => node)
.filter(attr => !attr.directive)

@@ -64,25 +60,6 @@ if (!fixableAttrs.length) return

const className = fixableAttrs.map(node => node.key.rawName).join(' ')
const source = context.getSourceCode().text
const removeAttrs = fixableAttrs.map(node => {
let [start, end] = node.range
// Also remove whitespace after attributes
if (/\s/.test(source[end])) ++end
return fixer.removeRange([start, end])
})
const classNode = element.startTag.attributes.find(attr => attr.key.name === 'class')
if (classNode) {
return [
fixer.replaceText(classNode.value, `"${classNode.value.value} ${className}"`),
...removeAttrs
]
} else {
return [
fixer.insertTextAfter(
context.parserServices.getTemplateBodyTokenStore().getFirstToken(element.startTag),
` class="${className}"`
),
...removeAttrs
]
}
return [
addClass(context, fixer, element, className),
...fixableAttrs.map(removeAttr.bind(this, context, fixer))
]
}

@@ -89,0 +66,0 @@ })

'use strict'
const { classify, getAttributes } = require('../util/helpers')
const { removeAttr } = require('../util/fixers')

@@ -101,9 +102,3 @@ // const spacers = {

fix (fixer) {
if (attr.node.directive) return
const source = context.getSourceCode().text
let [start, end] = attr.node.range
// Also remove whitespace after attributes
if (/\s/.test(source[end])) ++end
return fixer.removeRange([start, end])
if (!attr.node.directive) return removeAttr(context, fixer, attr.node)
}

@@ -110,0 +105,0 @@ })

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

[/^justify-(start|center|end|space-around|space-between)$/, ([align]) => `justify="${align}"`],
[/^justify-between$/, () => 'justify="space-between"'],
[/^(justify-between)$/, () => 'justify="space-between"'],
[/^(row)$/, () => ''],

@@ -55,3 +55,3 @@ [/^(wrap)$/, () => ''],

const tokens = context.parserServices.getTemplateBodyTokenStore()
if (replacements.components.hasOwnProperty(tag)) {
if (Object.prototype.hasOwnProperty.call(replacements.components, tag)) {
const replacement = replacements.components[tag]

@@ -95,3 +95,4 @@ context.report({

}
context.report(Object.assign({}, message, {
context.report({
...message,
node: attr.node,

@@ -102,3 +103,3 @@ fix (fixer) {

}
}))
})
}

@@ -105,0 +106,0 @@ }

'use strict'
function hyphenate (str = '') {
function hyphenate (
/* istanbul ignore next */
str = ''
) {
return str.replace(/\B([A-Z])/g, '-$1').toLowerCase()

@@ -27,9 +30,10 @@ }

const attrs = []
element.startTag.attributes.forEach(node => {
if (node.directive && (node.key.name !== 'bind' || !node.key.argument)) return
if (node.directive && (node.key.name.name !== 'bind' || !node.key.argument)) return
const name = hyphenate(node.directive ? node.key.argument : node.key.rawName)
if (isBuiltinAttribute(name)) return
attrs.push({ name, node })
const name = hyphenate(node.directive ? node.key.argument.name : node.key.rawName)
if (!isBuiltinAttribute(name)) attrs.push({ name, node })
})
return attrs

@@ -36,0 +40,0 @@ }

{
"name": "eslint-plugin-vuetify",
"version": "1.0.0-beta.6",
"version": "1.0.0-beta.7",
"description": "An eslint plugin for Vuetify",
"main": "lib/index.js",

@@ -8,6 +9,13 @@ "author": "Kael Watts-Deuchar <kaelwd@gmail.com>",

"repository": "github:vuetifyjs/eslint-plugin-vuetify",
"husky": {
"hooks": {
"commit-msg": "node scripts/lint-commit-message.js",
"pre-commit": "node scripts/warn-npm-install.js && yarn run lint && yarn run test"
}
},
"scripts": {
"test": "mocha tests --recursive --reporter dot",
"test:coverage": "nyc mocha tests --recursive --reporter dot",
"lint": "eslint ."
"test:ci": "nyc --reporter=lcov mocha tests --recursive --reporter dot",
"lint": "eslint lib tests"
},

@@ -17,34 +25,24 @@ "files": [

],
"homepage": "https://github.com/vuetifyjs/eslint-plugin-vuetify#readme",
"dependencies": {
"eslint-plugin-vue": "^6.0.0",
"eslint-plugin-vue": "^6.2.2",
"requireindex": "^1.2.0"
},
"devDependencies": {
"eslint": "^6.0.1",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.18.0",
"eslint-plugin-node": "^9.1.0",
"eslint": "^7.4.0",
"eslint-config-standard": "^14.1.1",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.0",
"mocha": "^6.1.4",
"nyc": "^14.1.1",
"vue": "^2.6.10",
"vuetify": "^2.1.0"
"eslint-plugin-standard": "^4.0.1",
"husky": "^4.2.5",
"mocha": "^8.0.1",
"nyc": "^15.1.0",
"vue": "^2.6.11",
"vuetify": "^2.3.4"
},
"peerDependencies": {
"eslint": "^6.0.0",
"eslint": "^6.0.0 | ^7.0.0",
"vuetify": "^2.0.0"
},
"release-it": {
"git": {
"commitMessage": "chore: release v%s",
"tagName": "v%s"
},
"npm": {
"publish": true
},
"github": {
"release": true
}
}
}

@@ -17,2 +17,5 @@ # eslint-plugin-vuetify (WIP)

### 💿 Install
You should have [`eslint`](https://eslint.org/docs/user-guide/getting-started) and [`eslint-plugin-vue`](https://eslint.vuejs.org/user-guide/#installation) set up first.
```bash

@@ -27,2 +30,5 @@ yarn add eslint-plugin-vuetify -D

module.exports = {
extends: [
'plugin:vue/base'
],
plugins: [

@@ -29,0 +35,0 @@ 'vuetify'

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