eslint-plugin-vue
Advanced tools
Comparing version 3.14.0 to 4.0.0-beta.0
@@ -22,3 +22,5 @@ module.exports = { | ||
'vue' | ||
] | ||
], | ||
rules: require('../base-rules.js') | ||
} |
/* | ||
* IMPORTANT! | ||
* This file has been automatically generated, | ||
* in order to update its content execute "npm run update" | ||
*/ | ||
* IMPORTANT! | ||
* This file has been automatically generated, | ||
* in order to update it's content execute "npm run update" | ||
*/ | ||
module.exports = { | ||
"vue/attribute-hyphenation": "off", | ||
"vue/html-end-tags": "off", | ||
"vue/html-indent": "off", | ||
"vue/html-no-self-closing": "off", | ||
"vue/html-quotes": "off", | ||
"vue/html-self-closing": "off", | ||
"vue/attribute-hyphenation": "error", | ||
"vue/html-end-tags": "error", | ||
"vue/html-indent": "error", | ||
"vue/html-quotes": "error", | ||
"vue/html-self-closing": "error", | ||
"vue/jsx-uses-vars": "error", | ||
"vue/max-attributes-per-line": "off", | ||
"vue/mustache-interpolation-spacing": "off", | ||
"vue/name-property-casing": "off", | ||
"vue/no-async-in-computed-properties": "off", | ||
"vue/max-attributes-per-line": "error", | ||
"vue/mustache-interpolation-spacing": "error", | ||
"vue/name-property-casing": "error", | ||
"vue/no-async-in-computed-properties": "error", | ||
"vue/no-confusing-v-for-v-if": "error", | ||
"vue/no-dupe-keys": "off", | ||
"vue/no-duplicate-attributes": "off", | ||
"vue/no-invalid-template-root": "off", | ||
"vue/no-invalid-v-bind": "off", | ||
"vue/no-invalid-v-cloak": "off", | ||
"vue/no-invalid-v-else-if": "off", | ||
"vue/no-invalid-v-else": "off", | ||
"vue/no-invalid-v-for": "off", | ||
"vue/no-invalid-v-html": "off", | ||
"vue/no-invalid-v-if": "off", | ||
"vue/no-invalid-v-model": "off", | ||
"vue/no-invalid-v-on": "off", | ||
"vue/no-invalid-v-once": "off", | ||
"vue/no-invalid-v-pre": "off", | ||
"vue/no-invalid-v-show": "off", | ||
"vue/no-invalid-v-text": "off", | ||
"vue/no-multi-spaces": "off", | ||
"vue/no-dupe-keys": "error", | ||
"vue/no-duplicate-attributes": "error", | ||
"vue/no-multi-spaces": "error", | ||
"vue/no-parsing-error": "error", | ||
"vue/no-reserved-keys": "off", | ||
"vue/no-reservered-keys": "off", | ||
"vue/no-shared-component-data": "off", | ||
"vue/no-side-effects-in-computed-properties": "off", | ||
"vue/no-template-key": "off", | ||
"vue/no-reserved-keys": "error", | ||
"vue/no-shared-component-data": "error", | ||
"vue/no-side-effects-in-computed-properties": "error", | ||
"vue/no-template-key": "error", | ||
"vue/no-textarea-mustache": "error", | ||
"vue/no-unused-vars": "off", | ||
"vue/order-in-components": "off", | ||
"vue/no-unused-vars": "error", | ||
"vue/order-in-components": "error", | ||
"vue/require-component-is": "error", | ||
"vue/require-default-prop": "off", | ||
"vue/require-prop-types": "off", | ||
"vue/require-render-return": "off", | ||
"vue/require-default-prop": "error", | ||
"vue/require-prop-types": "error", | ||
"vue/require-render-return": "error", | ||
"vue/require-v-for-key": "error", | ||
"vue/require-valid-default-prop": "off", | ||
"vue/return-in-computed-property": "off", | ||
"vue/this-in-template": "off", | ||
"vue/v-bind-style": "off", | ||
"vue/v-on-style": "off", | ||
"vue/require-valid-default-prop": "error", | ||
"vue/return-in-computed-property": "error", | ||
"vue/this-in-template": "error", | ||
"vue/v-bind-style": "error", | ||
"vue/v-on-style": "error", | ||
"vue/valid-template-root": "error", | ||
@@ -56,0 +40,0 @@ "vue/valid-v-bind": "error", |
@@ -62,4 +62,3 @@ /** | ||
description: 'enforce attribute naming style in template', | ||
category: 'Stylistic Issues', | ||
recommended: false | ||
category: 'strongly-recommended' | ||
}, | ||
@@ -66,0 +65,0 @@ fixable: 'code', |
@@ -29,4 +29,4 @@ /** | ||
const isVoid = utils.isHtmlVoidElementName(name) | ||
const isSelfClosing = node.startTag.selfClosing | ||
const hasEndTag = node.endTag != null | ||
const isSelfClosing = node.startTag.selfClosing | ||
@@ -42,3 +42,3 @@ if (isVoid && hasEndTag) { | ||
} | ||
if (!isVoid && !(hasEndTag || isSelfClosing)) { | ||
if (!isVoid && !hasEndTag && !isSelfClosing) { | ||
context.report({ | ||
@@ -65,4 +65,3 @@ node: node.startTag, | ||
description: 'enforce end tag style', | ||
category: 'Best Practices', | ||
recommended: false | ||
category: 'strongly-recommended' | ||
}, | ||
@@ -69,0 +68,0 @@ fixable: 'code', |
@@ -33,3 +33,3 @@ /** | ||
indentChar: ' ', | ||
indentSize: 4, | ||
indentSize: 2, | ||
attribute: 1, | ||
@@ -1195,4 +1195,3 @@ closeBracket: 0, | ||
description: 'enforce consistent indentation in `<template>`', | ||
category: 'Stylistic Issues', | ||
recommended: false | ||
category: 'strongly-recommended' | ||
}, | ||
@@ -1199,0 +1198,0 @@ fixable: 'whitespace', |
@@ -55,10 +55,9 @@ /** | ||
description: 'enforce quotes style of HTML attributes', | ||
category: 'Stylistic Issues', | ||
recommended: false | ||
category: 'recommended' | ||
}, | ||
fixable: false, | ||
schema: [ | ||
{ enum: ['double', 'single'] } | ||
{ enum: ['double', 'single'] } | ||
] | ||
} | ||
} |
@@ -36,3 +36,3 @@ /** | ||
return { | ||
[ELEMENT_TYPE.NORMAL]: (options && options.html && options.html.normal) || 'never', | ||
[ELEMENT_TYPE.NORMAL]: (options && options.html && options.html.normal) || 'always', | ||
[ELEMENT_TYPE.VOID]: (options && options.html && options.html.void) || 'never', | ||
@@ -147,4 +147,3 @@ [ELEMENT_TYPE.COMPONENT]: (options && options.html && options.html.component) || 'always', | ||
description: 'enforce self-closing style', | ||
category: 'Stylistic Issues', | ||
recommended: false | ||
category: 'strongly-recommended' | ||
}, | ||
@@ -151,0 +150,0 @@ fixable: 'code', |
@@ -41,4 +41,3 @@ // the following rule is based on yannickcr/eslint-plugin-react | ||
description: 'prevent variables used in JSX to be marked as unused', // eslint-disable-line consistent-docs-description | ||
category: 'Variables', | ||
recommended: true | ||
category: 'base' | ||
}, | ||
@@ -45,0 +44,0 @@ schema: [] |
@@ -16,4 +16,3 @@ /** | ||
description: 'enforce the maximum number of attributes per line', | ||
category: 'Stylistic Issues', | ||
recommended: false | ||
category: 'strongly-recommended' | ||
}, | ||
@@ -102,3 +101,3 @@ fixable: null, | ||
const defaults = { | ||
singleline: 3, | ||
singleline: 1, | ||
multiline: 1, | ||
@@ -105,0 +104,0 @@ allowFirstLine: false |
@@ -21,4 +21,3 @@ /** | ||
description: 'enforce unified spacing in mustache interpolations', | ||
category: 'Stylistic Issues', | ||
recommended: false | ||
category: 'strongly-recommended' | ||
}, | ||
@@ -25,0 +24,0 @@ fixable: 'whitespace', |
@@ -9,2 +9,3 @@ /** | ||
const casing = require('../utils/casing') | ||
const allowedCaseOptions = ['PascalCase', 'kebab-case'] | ||
@@ -17,3 +18,3 @@ // ------------------------------------------------------------------------------ | ||
const options = context.options[0] | ||
const caseType = casing.allowedCaseOptions.indexOf(options) !== -1 ? options : 'PascalCase' | ||
const caseType = allowedCaseOptions.indexOf(options) !== -1 ? options : 'PascalCase' | ||
@@ -53,4 +54,3 @@ // ---------------------------------------------------------------------- | ||
description: 'enforce specific casing for the name property in Vue components', | ||
category: 'Stylistic Issues', | ||
recommended: false | ||
category: 'strongly-recommended' | ||
}, | ||
@@ -60,3 +60,3 @@ fixable: 'code', // or "code" or "whitespace" | ||
{ | ||
enum: casing.allowedCaseOptions | ||
enum: allowedCaseOptions | ||
} | ||
@@ -63,0 +63,0 @@ ] |
@@ -151,4 +151,3 @@ /** | ||
description: 'disallow asynchronous actions in computed properties', | ||
category: 'Best Practices', | ||
recommended: false | ||
category: 'essential' | ||
}, | ||
@@ -155,0 +154,0 @@ fixable: null, |
@@ -64,4 +64,3 @@ /** | ||
description: 'disallow confusing `v-for` and `v-if` on the same element', | ||
category: 'Best Practices', | ||
recommended: true | ||
category: 'recommended' | ||
}, | ||
@@ -68,0 +67,0 @@ fixable: false, |
@@ -50,4 +50,3 @@ /** | ||
description: 'disallow duplication of field names', | ||
category: 'Possible Errors', | ||
recommended: false | ||
category: 'essential' | ||
}, | ||
@@ -54,0 +53,0 @@ fixable: null, // or "code" or "whitespace" |
@@ -92,4 +92,3 @@ /** | ||
description: 'disallow duplication of attributes', | ||
category: 'Best Practices', | ||
recommended: false | ||
category: 'essential' | ||
}, | ||
@@ -96,0 +95,0 @@ fixable: false, |
@@ -15,4 +15,3 @@ /** | ||
description: 'disallow multiple spaces', | ||
category: 'Stylistic Issues', | ||
recommended: false | ||
category: 'strongly-recommended' | ||
}, | ||
@@ -19,0 +18,0 @@ fixable: 'whitespace', // or "code" or "whitespace" |
@@ -13,40 +13,39 @@ /** | ||
// https://html.spec.whatwg.org/multipage/parsing.html#parse-errors | ||
// TODO: Enable all by default. | ||
const DEFAULT_OPTIONS = Object.freeze(Object.assign(Object.create(null), { | ||
'abrupt-closing-of-empty-comment': false, | ||
'absence-of-digits-in-numeric-character-reference': false, | ||
'cdata-in-html-content': false, | ||
'character-reference-outside-unicode-range': false, | ||
'control-character-in-input-stream': false, | ||
'control-character-reference': false, | ||
'eof-before-tag-name': false, | ||
'eof-in-cdata': false, | ||
'eof-in-comment': false, | ||
'eof-in-tag': false, | ||
'incorrectly-closed-comment': false, | ||
'incorrectly-opened-comment': false, | ||
'invalid-first-character-of-tag-name': false, | ||
'missing-attribute-value': false, | ||
'missing-end-tag-name': false, | ||
'missing-semicolon-after-character-reference': false, | ||
'missing-whitespace-between-attributes': false, | ||
'nested-comment': false, | ||
'noncharacter-character-reference': false, | ||
'noncharacter-in-input-stream': false, | ||
'null-character-reference': false, | ||
'surrogate-character-reference': false, | ||
'surrogate-in-input-stream': false, | ||
'unexpected-character-in-attribute-name': false, | ||
'unexpected-character-in-unquoted-attribute-value': false, | ||
'unexpected-equals-sign-before-attribute-name': false, | ||
'unexpected-null-character': false, | ||
'unexpected-question-mark-instead-of-tag-name': false, | ||
'unexpected-solidus-in-tag': false, | ||
'unknown-named-character-reference': false, | ||
'end-tag-with-attributes': false, | ||
'duplicate-attribute': false, | ||
'end-tag-with-trailing-solidus': false, | ||
'abrupt-closing-of-empty-comment': true, | ||
'absence-of-digits-in-numeric-character-reference': true, | ||
'cdata-in-html-content': true, | ||
'character-reference-outside-unicode-range': true, | ||
'control-character-in-input-stream': true, | ||
'control-character-reference': true, | ||
'eof-before-tag-name': true, | ||
'eof-in-cdata': true, | ||
'eof-in-comment': true, | ||
'eof-in-tag': true, | ||
'incorrectly-closed-comment': true, | ||
'incorrectly-opened-comment': true, | ||
'invalid-first-character-of-tag-name': true, | ||
'missing-attribute-value': true, | ||
'missing-end-tag-name': true, | ||
'missing-semicolon-after-character-reference': true, | ||
'missing-whitespace-between-attributes': true, | ||
'nested-comment': true, | ||
'noncharacter-character-reference': true, | ||
'noncharacter-in-input-stream': true, | ||
'null-character-reference': true, | ||
'surrogate-character-reference': true, | ||
'surrogate-in-input-stream': true, | ||
'unexpected-character-in-attribute-name': true, | ||
'unexpected-character-in-unquoted-attribute-value': true, | ||
'unexpected-equals-sign-before-attribute-name': true, | ||
'unexpected-null-character': true, | ||
'unexpected-question-mark-instead-of-tag-name': true, | ||
'unexpected-solidus-in-tag': true, | ||
'unknown-named-character-reference': true, | ||
'end-tag-with-attributes': true, | ||
'duplicate-attribute': true, | ||
'end-tag-with-trailing-solidus': true, | ||
'non-void-html-element-start-tag-with-trailing-solidus': false, | ||
'x-invalid-end-tag': false, | ||
'x-invalid-namespace': false | ||
'x-invalid-end-tag': true, | ||
'x-invalid-namespace': true | ||
})) | ||
@@ -99,4 +98,3 @@ | ||
description: 'disallow parsing errors in `<template>`', | ||
category: 'Possible Errors', | ||
recommended: true | ||
category: 'essential' | ||
}, | ||
@@ -103,0 +101,0 @@ fixable: false, |
@@ -53,4 +53,3 @@ /** | ||
description: 'disallow overwriting reserved keys', | ||
category: 'Possible Errors', | ||
recommended: false | ||
category: 'essential' | ||
}, | ||
@@ -57,0 +56,0 @@ fixable: null, |
@@ -41,4 +41,3 @@ /** | ||
description: "enforce component's data property to be a function", | ||
category: 'Possible Errors', | ||
recommended: false | ||
category: 'essential' | ||
}, | ||
@@ -45,0 +44,0 @@ fixable: null, // or "code" or "whitespace" |
@@ -67,4 +67,3 @@ /** | ||
description: 'disallow side effects in computed properties', | ||
category: 'Best Practices', | ||
recommended: false | ||
category: 'essential' | ||
}, | ||
@@ -71,0 +70,0 @@ fixable: null, |
@@ -47,4 +47,3 @@ /** | ||
description: 'disallow `key` attribute on `<template>`', | ||
category: 'Possible Errors', | ||
recommended: false | ||
category: 'essential' | ||
}, | ||
@@ -51,0 +50,0 @@ fixable: false, |
@@ -49,4 +49,3 @@ /** | ||
description: 'disallow mustaches in `<textarea>`', | ||
category: 'Best Practices', | ||
recommended: true | ||
category: 'essential' | ||
}, | ||
@@ -53,0 +52,0 @@ fixable: false, |
@@ -41,4 +41,3 @@ /** | ||
description: 'disallow unused variable definitions of v-for directives or scope attributes', | ||
category: 'Possible Errors', | ||
recommended: false | ||
category: 'essential' | ||
}, | ||
@@ -45,0 +44,0 @@ fixable: null, |
@@ -10,9 +10,13 @@ /** | ||
const defaultOrder = [ | ||
['name', 'delimiters', 'functional', 'model'], | ||
'el', | ||
'name', | ||
'parent', | ||
'functional', | ||
['delimiters', 'comments'], | ||
['components', 'directives', 'filters'], | ||
['parent', 'mixins', 'extends', 'provide', 'inject'], | ||
'el', | ||
'template', | ||
'props', | ||
'propsData', | ||
'extends', | ||
'mixins', | ||
'inheritAttrs', | ||
'model', | ||
['props', 'propsData'], | ||
'data', | ||
@@ -23,3 +27,3 @@ 'computed', | ||
'methods', | ||
'render', | ||
['template', 'render'], | ||
'renderError' | ||
@@ -101,4 +105,3 @@ ] | ||
description: 'enforce order of properties in components', | ||
category: 'Best Practices', | ||
recommended: false | ||
category: 'recommended' | ||
}, | ||
@@ -105,0 +108,0 @@ fixable: null, |
@@ -47,4 +47,3 @@ /** | ||
description: 'require `v-bind:is` of `<component>` elements', | ||
category: 'Best Practices', | ||
recommended: true | ||
category: 'essential' | ||
}, | ||
@@ -51,0 +50,0 @@ fixable: false, |
@@ -17,4 +17,3 @@ /** | ||
description: 'require default value for props', | ||
category: 'Best Practices', | ||
recommended: false | ||
category: 'strongly-recommended' | ||
}, | ||
@@ -21,0 +20,0 @@ fixable: null, // or "code" or "whitespace" |
@@ -84,4 +84,3 @@ /** | ||
description: 'require type definitions in props', | ||
category: 'Best Practices', | ||
recommended: false | ||
category: 'strongly-recommended' | ||
}, | ||
@@ -88,0 +87,0 @@ fixable: null, // or "code" or "whitespace" |
@@ -47,4 +47,3 @@ /** | ||
description: 'enforce render function to always return value', | ||
category: 'Possible Errors', | ||
recommended: false | ||
category: 'essential' | ||
}, | ||
@@ -51,0 +50,0 @@ fixable: null, // or "code" or "whitespace" |
@@ -62,4 +62,3 @@ /** | ||
description: 'require `v-bind:key` with `v-for` directives', | ||
category: 'Best Practices', | ||
recommended: true | ||
category: 'essential' | ||
}, | ||
@@ -66,0 +65,0 @@ fixable: false, |
@@ -26,4 +26,3 @@ /** | ||
description: 'enforce props default values to be valid', | ||
category: 'Possible Errors', | ||
recommended: false | ||
category: 'essential' | ||
}, | ||
@@ -30,0 +29,0 @@ fixable: null, |
@@ -51,4 +51,3 @@ /** | ||
description: 'enforce that a return statement is present in computed property', | ||
category: 'Possible Errors', | ||
recommended: false | ||
category: 'essential' | ||
}, | ||
@@ -55,0 +54,0 @@ fixable: null, // or "code" or "whitespace" |
@@ -22,4 +22,3 @@ /** | ||
description: 'enforce usage of `this` in template', | ||
category: 'Best Practices', | ||
recommended: false | ||
category: 'recommended' | ||
}, | ||
@@ -26,0 +25,0 @@ fixable: null, |
@@ -56,10 +56,9 @@ /** | ||
description: 'enforce `v-bind` directive style', | ||
category: 'Stylistic Issues', | ||
recommended: false | ||
category: 'strongly-recommended' | ||
}, | ||
fixable: 'code', | ||
schema: [ | ||
{ enum: ['shorthand', 'longform'] } | ||
{ enum: ['shorthand', 'longform'] } | ||
] | ||
} | ||
} |
@@ -57,10 +57,9 @@ /** | ||
description: 'enforce `v-on` directive style', | ||
category: 'Stylistic Issues', | ||
recommended: false | ||
category: 'strongly-recommended' | ||
}, | ||
fixable: 'code', | ||
schema: [ | ||
{ enum: ['shorthand', 'longform'] } | ||
{ enum: ['shorthand', 'longform'] } | ||
] | ||
} | ||
} |
@@ -116,4 +116,3 @@ /** | ||
description: 'enforce valid template root', | ||
category: 'Possible Errors', | ||
recommended: true | ||
category: 'essential' | ||
}, | ||
@@ -120,0 +119,0 @@ fixable: false, |
@@ -60,4 +60,3 @@ /** | ||
description: 'enforce valid `v-bind` directives', | ||
category: 'Possible Errors', | ||
recommended: true | ||
category: 'essential' | ||
}, | ||
@@ -64,0 +63,0 @@ fixable: false, |
@@ -61,4 +61,3 @@ /** | ||
description: 'enforce valid `v-cloak` directives', | ||
category: 'Possible Errors', | ||
recommended: true | ||
category: 'essential' | ||
}, | ||
@@ -65,0 +64,0 @@ fixable: false, |
@@ -84,4 +84,3 @@ /** | ||
description: 'enforce valid `v-else-if` directives', | ||
category: 'Possible Errors', | ||
recommended: true | ||
category: 'essential' | ||
}, | ||
@@ -88,0 +87,0 @@ fixable: false, |
@@ -84,4 +84,3 @@ /** | ||
description: 'enforce valid `v-else` directives', | ||
category: 'Possible Errors', | ||
recommended: true | ||
category: 'essential' | ||
}, | ||
@@ -88,0 +87,0 @@ fixable: false, |
@@ -192,4 +192,3 @@ /** | ||
description: 'enforce valid `v-for` directives', | ||
category: 'Possible Errors', | ||
recommended: true | ||
category: 'essential' | ||
}, | ||
@@ -196,0 +195,0 @@ fixable: false, |
@@ -61,4 +61,3 @@ /** | ||
description: 'enforce valid `v-html` directives', | ||
category: 'Possible Errors', | ||
recommended: true | ||
category: 'essential' | ||
}, | ||
@@ -65,0 +64,0 @@ fixable: false, |
@@ -77,4 +77,3 @@ /** | ||
description: 'enforce valid `v-if` directives', | ||
category: 'Possible Errors', | ||
recommended: true | ||
category: 'essential' | ||
}, | ||
@@ -81,0 +80,0 @@ fixable: false, |
@@ -96,19 +96,10 @@ /** | ||
} | ||
if (name === 'input') { | ||
if (utils.hasDirective(element, 'bind', 'type')) { | ||
context.report({ | ||
node, | ||
loc: node.loc, | ||
message: "'v-model' directives don't support dynamic input types.", | ||
data: { name } | ||
}) | ||
} | ||
if (utils.hasAttribute(element, 'type', 'file')) { | ||
context.report({ | ||
node, | ||
loc: node.loc, | ||
message: "'v-model' directives don't support 'file' input type.", | ||
data: { name } | ||
}) | ||
} | ||
if (name === 'input' && utils.hasAttribute(element, 'type', 'file')) { | ||
context.report({ | ||
node, | ||
loc: node.loc, | ||
message: "'v-model' directives don't support 'file' input type.", | ||
data: { name } | ||
}) | ||
} | ||
@@ -152,3 +143,3 @@ | ||
const id = reference.id | ||
if (id.parent.type === 'MemberExpression') { | ||
if (id.parent.type === 'MemberExpression' || id.parent.type === 'BinaryExpression') { | ||
continue | ||
@@ -180,4 +171,3 @@ } | ||
description: 'enforce valid `v-model` directives', | ||
category: 'Possible Errors', | ||
recommended: true | ||
category: 'essential' | ||
}, | ||
@@ -184,0 +174,0 @@ fixable: false, |
@@ -66,4 +66,3 @@ /** | ||
description: 'enforce valid `v-on` directives', | ||
category: 'Possible Errors', | ||
recommended: true | ||
category: 'essential' | ||
}, | ||
@@ -70,0 +69,0 @@ fixable: false, |
@@ -61,4 +61,3 @@ /** | ||
description: 'enforce valid `v-once` directives', | ||
category: 'Possible Errors', | ||
recommended: true | ||
category: 'essential' | ||
}, | ||
@@ -65,0 +64,0 @@ fixable: false, |
@@ -61,4 +61,3 @@ /** | ||
description: 'enforce valid `v-pre` directives', | ||
category: 'Possible Errors', | ||
recommended: true | ||
category: 'essential' | ||
}, | ||
@@ -65,0 +64,0 @@ fixable: false, |
@@ -61,4 +61,3 @@ /** | ||
description: 'enforce valid `v-show` directives', | ||
category: 'Possible Errors', | ||
recommended: true | ||
category: 'essential' | ||
}, | ||
@@ -65,0 +64,0 @@ fixable: false, |
@@ -61,4 +61,3 @@ /** | ||
description: 'enforce valid `v-text` directives', | ||
category: 'Possible Errors', | ||
recommended: true | ||
category: 'essential' | ||
}, | ||
@@ -65,0 +64,0 @@ fixable: false, |
@@ -24,4 +24,5 @@ const assert = require('assert') | ||
return str | ||
.replace(/(?:^\w|[A-Z]|\b\w)/g, (letter, index) => ( | ||
index === 0 ? letter.toLowerCase() : letter.toUpperCase()) | ||
.replace(/_/g, (_, index) => index === 0 ? _ : '-') | ||
.replace(/(?:^\w|[A-Z]|\b\w)/g, (letter, index) => | ||
index === 0 ? letter.toLowerCase() : letter.toUpperCase() | ||
) | ||
@@ -38,2 +39,3 @@ .replace(invalidChars, '') | ||
return str | ||
.replace(/_/g, (_, index) => index === 0 ? _ : '-') | ||
.replace(/(?:^\w|[A-Z]|\b\w)/g, (letter, index) => letter.toUpperCase()) | ||
@@ -40,0 +42,0 @@ .replace(invalidChars, '') |
{ | ||
"name": "eslint-plugin-vue", | ||
"version": "3.14.0", | ||
"version": "4.0.0-beta.0", | ||
"description": "Official ESLint plugin for Vue.js", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
139
README.md
@@ -37,8 +37,9 @@ # eslint-plugin-vue | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:vue/recommended' // or 'plugin:vue/base' | ||
// add more generic rulesets here, such as: | ||
// 'eslint:recommended', | ||
'plugin:vue/essential' | ||
], | ||
rules: { | ||
// override/add rules' settings here | ||
'vue/valid-v-if': 'error' | ||
// override/add rules settings here, such as: | ||
// 'vue/no-unused-vars': 'error' | ||
} | ||
@@ -79,69 +80,80 @@ } | ||
This plugin provides two predefined configs: | ||
- `plugin:vue/base` - contains necessary settings for this plugin to work properly | ||
- `plugin:vue/recommended` - extends base config with recommended rules (the ones with check mark :white_check_mark: in the table below) | ||
- `plugin:vue/base` - Settings and rules to enable correct ESLint parsing | ||
- `plugin:vue/essential` - Above, plus rules to prevent errors or unintended behavior | ||
- `plugin:vue/strongly-recommended` - Above, plus rules to considerably improve code readability and/or dev experience | ||
- `plugin:vue/recommended` - Above, plus rules to enforce subjective community defaults to ensure consistency | ||
## :bulb: Rules | ||
Rules are grouped by category to help you understand their purpose. | ||
Rules are grouped by priority to help you understand their purpose. The `--fix` option on the command line automatically fixes problems reported by rules which have a wrench :wrench: below. | ||
No rules are enabled by `plugin:vue/base` config. The `plugin:vue/recommended` config enables rules that report common problems, which have a check mark :white_check_mark: below. | ||
<!--RULES_TABLE_START--> | ||
The `--fix` option on the command line automatically fixes problems reported by rules which have a wrench :wrench: below. | ||
### Base Rules (Enabling Correct ESLint Parsing) | ||
<!--RULES_TABLE_START--> | ||
Enforce all the rules in this category, as well as all higher priority rules, with: | ||
### Possible Errors | ||
``` json | ||
"extends": "plugin:vue/base" | ||
``` | ||
| | Rule ID | Description | | ||
|:---|:--------|:------------| | ||
| | [jsx-uses-vars](./docs/rules/jsx-uses-vars.md) | prevent variables used in JSX to be marked as unused | | ||
### Priority A: Essential (Error Prevention) | ||
Enforce all the rules in this category, as well as all higher priority rules, with: | ||
``` json | ||
"extends": "plugin:vue/essential" | ||
``` | ||
| | Rule ID | Description | | ||
|:---|:--------|:------------| | ||
| | [no-async-in-computed-properties](./docs/rules/no-async-in-computed-properties.md) | disallow asynchronous actions in computed properties | | ||
| | [no-dupe-keys](./docs/rules/no-dupe-keys.md) | disallow duplication of field names | | ||
| :white_check_mark: | [no-parsing-error](./docs/rules/no-parsing-error.md) | disallow parsing errors in `<template>` | | ||
| | [no-duplicate-attributes](./docs/rules/no-duplicate-attributes.md) | disallow duplication of attributes | | ||
| | [no-parsing-error](./docs/rules/no-parsing-error.md) | disallow parsing errors in `<template>` | | ||
| | [no-reserved-keys](./docs/rules/no-reserved-keys.md) | disallow overwriting reserved keys | | ||
| | [no-shared-component-data](./docs/rules/no-shared-component-data.md) | enforce component's data property to be a function | | ||
| | [no-side-effects-in-computed-properties](./docs/rules/no-side-effects-in-computed-properties.md) | disallow side effects in computed properties | | ||
| | [no-template-key](./docs/rules/no-template-key.md) | disallow `key` attribute on `<template>` | | ||
| | [no-textarea-mustache](./docs/rules/no-textarea-mustache.md) | disallow mustaches in `<textarea>` | | ||
| | [no-unused-vars](./docs/rules/no-unused-vars.md) | disallow unused variable definitions of v-for directives or scope attributes | | ||
| | [require-component-is](./docs/rules/require-component-is.md) | require `v-bind:is` of `<component>` elements | | ||
| | [require-render-return](./docs/rules/require-render-return.md) | enforce render function to always return value | | ||
| | [require-v-for-key](./docs/rules/require-v-for-key.md) | require `v-bind:key` with `v-for` directives | | ||
| | [require-valid-default-prop](./docs/rules/require-valid-default-prop.md) | enforce props default values to be valid | | ||
| | [return-in-computed-property](./docs/rules/return-in-computed-property.md) | enforce that a return statement is present in computed property | | ||
| :white_check_mark: | [valid-template-root](./docs/rules/valid-template-root.md) | enforce valid template root | | ||
| :white_check_mark: | [valid-v-bind](./docs/rules/valid-v-bind.md) | enforce valid `v-bind` directives | | ||
| :white_check_mark: | [valid-v-cloak](./docs/rules/valid-v-cloak.md) | enforce valid `v-cloak` directives | | ||
| :white_check_mark: | [valid-v-else-if](./docs/rules/valid-v-else-if.md) | enforce valid `v-else-if` directives | | ||
| :white_check_mark: | [valid-v-else](./docs/rules/valid-v-else.md) | enforce valid `v-else` directives | | ||
| :white_check_mark: | [valid-v-for](./docs/rules/valid-v-for.md) | enforce valid `v-for` directives | | ||
| :white_check_mark: | [valid-v-html](./docs/rules/valid-v-html.md) | enforce valid `v-html` directives | | ||
| :white_check_mark: | [valid-v-if](./docs/rules/valid-v-if.md) | enforce valid `v-if` directives | | ||
| :white_check_mark: | [valid-v-model](./docs/rules/valid-v-model.md) | enforce valid `v-model` directives | | ||
| :white_check_mark: | [valid-v-on](./docs/rules/valid-v-on.md) | enforce valid `v-on` directives | | ||
| :white_check_mark: | [valid-v-once](./docs/rules/valid-v-once.md) | enforce valid `v-once` directives | | ||
| :white_check_mark: | [valid-v-pre](./docs/rules/valid-v-pre.md) | enforce valid `v-pre` directives | | ||
| :white_check_mark: | [valid-v-show](./docs/rules/valid-v-show.md) | enforce valid `v-show` directives | | ||
| :white_check_mark: | [valid-v-text](./docs/rules/valid-v-text.md) | enforce valid `v-text` directives | | ||
| | [valid-template-root](./docs/rules/valid-template-root.md) | enforce valid template root | | ||
| | [valid-v-bind](./docs/rules/valid-v-bind.md) | enforce valid `v-bind` directives | | ||
| | [valid-v-cloak](./docs/rules/valid-v-cloak.md) | enforce valid `v-cloak` directives | | ||
| | [valid-v-else-if](./docs/rules/valid-v-else-if.md) | enforce valid `v-else-if` directives | | ||
| | [valid-v-else](./docs/rules/valid-v-else.md) | enforce valid `v-else` directives | | ||
| | [valid-v-for](./docs/rules/valid-v-for.md) | enforce valid `v-for` directives | | ||
| | [valid-v-html](./docs/rules/valid-v-html.md) | enforce valid `v-html` directives | | ||
| | [valid-v-if](./docs/rules/valid-v-if.md) | enforce valid `v-if` directives | | ||
| | [valid-v-model](./docs/rules/valid-v-model.md) | enforce valid `v-model` directives | | ||
| | [valid-v-on](./docs/rules/valid-v-on.md) | enforce valid `v-on` directives | | ||
| | [valid-v-once](./docs/rules/valid-v-once.md) | enforce valid `v-once` directives | | ||
| | [valid-v-pre](./docs/rules/valid-v-pre.md) | enforce valid `v-pre` directives | | ||
| | [valid-v-show](./docs/rules/valid-v-show.md) | enforce valid `v-show` directives | | ||
| | [valid-v-text](./docs/rules/valid-v-text.md) | enforce valid `v-text` directives | | ||
### Best Practices | ||
### Priority B: Strongly Recommended (Improving Readability) | ||
| | Rule ID | Description | | ||
|:---|:--------|:------------| | ||
| :wrench: | [html-end-tags](./docs/rules/html-end-tags.md) | enforce end tag style | | ||
| | [no-async-in-computed-properties](./docs/rules/no-async-in-computed-properties.md) | disallow asynchronous actions in computed properties | | ||
| :white_check_mark: | [no-confusing-v-for-v-if](./docs/rules/no-confusing-v-for-v-if.md) | disallow confusing `v-for` and `v-if` on the same element | | ||
| | [no-duplicate-attributes](./docs/rules/no-duplicate-attributes.md) | disallow duplication of attributes | | ||
| | [no-side-effects-in-computed-properties](./docs/rules/no-side-effects-in-computed-properties.md) | disallow side effects in computed properties | | ||
| :white_check_mark: | [no-textarea-mustache](./docs/rules/no-textarea-mustache.md) | disallow mustaches in `<textarea>` | | ||
| | [order-in-components](./docs/rules/order-in-components.md) | enforce order of properties in components | | ||
| :white_check_mark: | [require-component-is](./docs/rules/require-component-is.md) | require `v-bind:is` of `<component>` elements | | ||
| | [require-default-prop](./docs/rules/require-default-prop.md) | require default value for props | | ||
| | [require-prop-types](./docs/rules/require-prop-types.md) | require type definitions in props | | ||
| :white_check_mark: | [require-v-for-key](./docs/rules/require-v-for-key.md) | require `v-bind:key` with `v-for` directives | | ||
| | [this-in-template](./docs/rules/this-in-template.md) | enforce usage of `this` in template | | ||
Enforce all the rules in this category, as well as all higher priority rules, with: | ||
``` json | ||
"extends": "plugin:vue/strongly-recommended" | ||
``` | ||
### Stylistic Issues | ||
| | Rule ID | Description | | ||
|:---|:--------|:------------| | ||
| :wrench: | [attribute-hyphenation](./docs/rules/attribute-hyphenation.md) | enforce attribute naming style in template | | ||
| :wrench: | [html-end-tags](./docs/rules/html-end-tags.md) | enforce end tag style | | ||
| :wrench: | [html-indent](./docs/rules/html-indent.md) | enforce consistent indentation in `<template>` | | ||
| | [html-quotes](./docs/rules/html-quotes.md) | enforce quotes style of HTML attributes | | ||
| :wrench: | [html-self-closing](./docs/rules/html-self-closing.md) | enforce self-closing style | | ||
@@ -152,2 +164,4 @@ | | [max-attributes-per-line](./docs/rules/max-attributes-per-line.md) | enforce the maximum number of attributes per line | | ||
| :wrench: | [no-multi-spaces](./docs/rules/no-multi-spaces.md) | disallow multiple spaces | | ||
| | [require-default-prop](./docs/rules/require-default-prop.md) | require default value for props | | ||
| | [require-prop-types](./docs/rules/require-prop-types.md) | require type definitions in props | | ||
| :wrench: | [v-bind-style](./docs/rules/v-bind-style.md) | enforce `v-bind` directive style | | ||
@@ -157,32 +171,17 @@ | :wrench: | [v-on-style](./docs/rules/v-on-style.md) | enforce `v-on` directive style | | ||
### Variables | ||
### Priority C: Recommended (Minimizing Arbitrary Choices and Cognitive Overhead) | ||
Enforce all the rules in this category, as well as all higher priority rules, with: | ||
``` json | ||
"extends": "plugin:vue/recommended" | ||
``` | ||
| | Rule ID | Description | | ||
|:---|:--------|:------------| | ||
| :white_check_mark: | [jsx-uses-vars](./docs/rules/jsx-uses-vars.md) | prevent variables used in JSX to be marked as unused | | ||
| | [html-quotes](./docs/rules/html-quotes.md) | enforce quotes style of HTML attributes | | ||
| | [no-confusing-v-for-v-if](./docs/rules/no-confusing-v-for-v-if.md) | disallow confusing `v-for` and `v-if` on the same element | | ||
| | [order-in-components](./docs/rules/order-in-components.md) | enforce order of properties in components | | ||
| | [this-in-template](./docs/rules/this-in-template.md) | enforce usage of `this` in template | | ||
### Deprecated | ||
> - :warning: We're going to remove deprecated rules in the next major release. Please migrate to successor/new rules. | ||
> - :innocent: We don't fix bugs which are in deprecated rules since we don't have enough resources. | ||
| Rule ID | Replaced by | | ||
|:--------|:------------| | ||
| [html-no-self-closing](./docs/rules/html-no-self-closing.md) | [html-self-closing](./docs/rules/html-self-closing.md) | | ||
| [no-invalid-template-root](./docs/rules/no-invalid-template-root.md) | [valid-template-root](./docs/rules/valid-template-root.md) | | ||
| [no-invalid-v-bind](./docs/rules/no-invalid-v-bind.md) | [valid-v-bind](./docs/rules/valid-v-bind.md) | | ||
| [no-invalid-v-cloak](./docs/rules/no-invalid-v-cloak.md) | [valid-v-cloak](./docs/rules/valid-v-cloak.md) | | ||
| [no-invalid-v-else-if](./docs/rules/no-invalid-v-else-if.md) | [valid-v-else-if](./docs/rules/valid-v-else-if.md) | | ||
| [no-invalid-v-else](./docs/rules/no-invalid-v-else.md) | [valid-v-else](./docs/rules/valid-v-else.md) | | ||
| [no-invalid-v-for](./docs/rules/no-invalid-v-for.md) | [valid-v-for](./docs/rules/valid-v-for.md) | | ||
| [no-invalid-v-html](./docs/rules/no-invalid-v-html.md) | [valid-v-html](./docs/rules/valid-v-html.md) | | ||
| [no-invalid-v-if](./docs/rules/no-invalid-v-if.md) | [valid-v-if](./docs/rules/valid-v-if.md) | | ||
| [no-invalid-v-model](./docs/rules/no-invalid-v-model.md) | [valid-v-model](./docs/rules/valid-v-model.md) | | ||
| [no-invalid-v-on](./docs/rules/no-invalid-v-on.md) | [valid-v-on](./docs/rules/valid-v-on.md) | | ||
| [no-invalid-v-once](./docs/rules/no-invalid-v-once.md) | [valid-v-once](./docs/rules/valid-v-once.md) | | ||
| [no-invalid-v-pre](./docs/rules/no-invalid-v-pre.md) | [valid-v-pre](./docs/rules/valid-v-pre.md) | | ||
| [no-invalid-v-show](./docs/rules/no-invalid-v-show.md) | [valid-v-show](./docs/rules/valid-v-show.md) | | ||
| [no-invalid-v-text](./docs/rules/no-invalid-v-text.md) | [valid-v-text](./docs/rules/valid-v-text.md) | | ||
| [no-reservered-keys](./docs/rules/no-reservered-keys.md) | [no-reserved-keys](./docs/rules/no-reserved-keys.md) | | ||
<!--RULES_TABLE_END--> | ||
@@ -189,0 +188,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
194250
65
5337
1
234