Skip to content

Commit

Permalink
Fix crash for toLocaleString() in vue/no-unused-properties rule (#1421
Browse files Browse the repository at this point in the history
)
  • Loading branch information
ota-meshi committed Jan 22, 2021
1 parent 6894340 commit 2d290b2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rules/no-unused-properties.js
Expand Up @@ -168,7 +168,7 @@ class UsedProperties {
*/
constructor(option) {
/** @type {Record<string, UsedPropertiesTracker[]>} */
this.map = {}
this.map = Object.create(null)
/** @type {CallAndParamIndex[]} */
this.calls = []
this.unknown = (option && option.unknown) || false
Expand Down
17 changes: 17 additions & 0 deletions tests/lib/rules/no-unused-properties.js
Expand Up @@ -1411,6 +1411,23 @@ tester.run('no-unused-properties', rule, {
</script>
`,
options: deepDataOptions
},
{
filename: 'test.vue',
code: `
<template>
<div> {{ obj.num.toLocaleString() }} </div>
</template>
<script>
export default {
data () {
return {
obj: { num: 42 }
}
}
}
</script>`,
options: deepDataOptions
}
],

Expand Down

0 comments on commit 2d290b2

Please sign in to comment.