Skip to content

Commit 8cf5d3b

Browse files
committed
update
1 parent ca0ec69 commit 8cf5d3b

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

lib/rules/define-props-destructuring.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module.exports = {
1414
categories: undefined,
1515
url: 'https://eslint.vuejs.org/rules/define-props-destructuring.html'
1616
},
17-
fixable: undefined,
17+
fixable: null,
1818
schema: [
1919
{
2020
type: 'object',
@@ -39,7 +39,12 @@ module.exports = {
3939

4040
return utils.compositingVisitors(
4141
utils.defineScriptSetupVisitor(context, {
42-
onDefinePropsEnter(node) {
42+
onDefinePropsEnter(node, props) {
43+
const hasNoArgs = props.filter((prop) => prop.propName).length === 0
44+
if (hasNoArgs) {
45+
return
46+
}
47+
4348
const hasDestructure = utils.isUsingPropsDestructure(node)
4449
const hasWithDefaults = utils.hasWithDefaults(node)
4550

tests/lib/rules/define-props-destructuring.js

+8
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ const tester = new RuleTester({
1717

1818
tester.run('define-props-destructuring', rule, {
1919
valid: [
20+
{
21+
filename: 'test.vue',
22+
code: `
23+
<script setup>
24+
const props = defineProps()
25+
</script>
26+
`
27+
},
2028
{
2129
filename: 'test.vue',
2230
code: `

0 commit comments

Comments
 (0)