Skip to content

Commit 622ac26

Browse files
authored
Allow asyncData in vue/no-dupe-keys (#1735)
1 parent 10dd1a9 commit 622ac26

File tree

2 files changed

+19
-31
lines changed

2 files changed

+19
-31
lines changed

lib/rules/no-dupe-keys.js

+1-8
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,7 @@ const utils = require('../utils')
1414
// Rule Definition
1515
// ------------------------------------------------------------------------------
1616
/** @type {GroupName[]} */
17-
const GROUP_NAMES = [
18-
'props',
19-
'computed',
20-
'data',
21-
'asyncData',
22-
'methods',
23-
'setup'
24-
]
17+
const GROUP_NAMES = ['props', 'computed', 'data', 'methods', 'setup']
2518

2619
module.exports = {
2720
meta: {

tests/lib/rules/no-dupe-keys.js

+18-23
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,24 @@ ruleTester.run('no-dupe-keys', rule, {
380380
}
381381
}
382382
`
383+
},
384+
{
385+
// https://github.com/vuejs/eslint-plugin-vue/issues/1687
386+
filename: 'test.vue',
387+
code: `
388+
export default {
389+
asyncData() {
390+
return {
391+
foo: 1
392+
}
393+
},
394+
data() {
395+
return {
396+
foo: 2
397+
}
398+
},
399+
}
400+
`
383401
}
384402
],
385403

@@ -709,29 +727,6 @@ ruleTester.run('no-dupe-keys', rule, {
709727
}
710728
]
711729
},
712-
{
713-
filename: 'test.vue',
714-
code: `
715-
export default {
716-
asyncData() {
717-
return {
718-
foo: 1
719-
}
720-
},
721-
data() {
722-
return {
723-
foo: 2
724-
}
725-
},
726-
}
727-
`,
728-
errors: [
729-
{
730-
message: "Duplicated key 'foo'.",
731-
line: 10
732-
}
733-
]
734-
},
735730
{
736731
filename: 'test.js',
737732
code: `

0 commit comments

Comments
 (0)