Skip to content

Commit

Permalink
Fix false positive for script setup in vue/no-expose-after-await ru…
Browse files Browse the repository at this point in the history
…le (#1896)
  • Loading branch information
ota-meshi committed May 18, 2022
1 parent 1d2318e commit 5a5c6e8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/rules/no-expose-after-await.js
Expand Up @@ -167,9 +167,10 @@ module.exports = {
setupScopes.set(node, {
afterAwait: false,
range: scriptSetup.range,
isExposeReferenceId: (_id, callNode) =>
isExposeReferenceId: (id, callNode) =>
callNode.parent.type === 'ExpressionStatement' &&
callNode.parent.parent === node,
callNode.parent.parent === node &&
id.name === 'defineExpose',
isContextReferenceId: () => false
})
}
Expand Down
11 changes: 11 additions & 0 deletions tests/lib/rules/no-expose-after-await.js
Expand Up @@ -117,6 +117,17 @@ tester.run('no-expose-after-await', rule, {
</script>
`,
parserOptions: { ecmaVersion: 2022 }
},
{
filename: 'test.vue',
code: `
<script setup>
import { onMounted } from 'vue';
await doSomething()
onMounted(() => {})
</script>
`,
parserOptions: { ecmaVersion: 2022 }
}
],
invalid: [
Expand Down

0 comments on commit 5a5c6e8

Please sign in to comment.