Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,12 @@ module.exports = {
const isAppVueComponent = isObjectArgument(node)
return isAppVueComponent
}
if (callee.name === 'defineComponent') {
// for Vue.js 3.x
// defineComponent({})
const isDestructedVueComponent = isObjectArgument(node)
return isDestructedVueComponent
}
}
}

Expand Down
38 changes: 38 additions & 0 deletions tests/lib/rules/no-dupe-keys.js
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,44 @@ ruleTester.run('no-dupe-keys', rule, {
message: 'Duplicated key \'bar\'.',
line: 7
}]
},
{
filename: 'test.js',
code: `
defineComponent({
foo: {
bar: String
},
data: {
bar: null
},
})
`,
options: [{ groups: ['foo'] }],
parserOptions: { ecmaVersion: 6 },
errors: [{
message: 'Duplicated key \'bar\'.',
line: 7
}]
},
{
filename: 'test.js',
code: `
export default defineComponent({
foo: {
bar: String
},
data: {
bar: null
},
})
`,
options: [{ groups: ['foo'] }],
parserOptions: { ecmaVersion: 6, sourceType: 'module' },
errors: [{
message: 'Duplicated key \'bar\'.',
line: 7
}]
}
]
})
6 changes: 6 additions & 0 deletions tests/lib/utils/vue-component.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,12 @@ function invalidTests (ext) {
`,
parserOptions,
errors: (ext === 'js' ? [] : [makeError(2)]).concat([makeError(8)])
},
{
filename: `test.${ext}`,
code: `export default defineComponent({})`,
parserOptions,
errors: [makeError(1)]
}
]
}
Expand Down