Skip to content

Commit 98dbf8a

Browse files
committed
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

Diff for: README.md

+2
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.:

Diff for: lib/utils/index.js

+1-1
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

Diff for: tests/lib/utils/vue-component.js

+6
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)