Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 98dbf8a

Browse files
Add Vue.extend support, add missing info about Vue.mixin check in readme
1 parent 750d3b8 commit 98dbf8a

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

‎README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ module.exports = {
4848
All component-related rules are being applied to code that passes any of the following checks:
4949

5050
* `Vue.component()` expression
51+
* `Vue.extend()` expression
52+
* `Vue.mixin()` expression
5153
* `export default {}` in `.vue` or `.jsx` file
5254

5355
If you however want to take advantage of our rules in any of your custom objects that are Vue components, you might need to use special comment `// @vue/component` that marks object in the next line as a Vue component in any file, e.g.:

‎lib/utils/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ module.exports = {
384384
callee.object.type === 'Identifier' &&
385385
callee.object.name === 'Vue' &&
386386
callee.property.type === 'Identifier' &&
387-
(callee.property.name==='component'||callee.property.name==='mixin') &&
387+
['component','mixin','extend'].indexOf(callee.property.name)>-1 &&
388388
node.arguments.length &&
389389
node.arguments.slice(-1)[0].type === 'ObjectExpression'
390390

‎tests/lib/utils/vue-component.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,12 @@ function invalidTests (ext) {
126126
parserOptions,
127127
errors: [makeError(1)]
128128
},
129+
{
130+
filename: `test.${ext}`,
131+
code: `Vue.extend({})`,
132+
parserOptions,
133+
errors: [makeError(1)]
134+
},
129135
{
130136
filename: `test.${ext}`,
131137
code: `

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /