Skip to content

Commit eb16e2d

Browse files
committed
Fix crash for toLocaleString() in vue/no-unused-properties rule
1 parent 3168819 commit eb16e2d

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

lib/rules/no-unused-properties.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ class UsedProperties {
168168
*/
169169
constructor(option) {
170170
/** @type {Record<string, UsedPropertiesTracker[]>} */
171-
this.map = {}
171+
this.map = Object.create(null)
172172
/** @type {CallAndParamIndex[]} */
173173
this.calls = []
174174
this.unknown = (option && option.unknown) || false

tests/lib/rules/no-unused-properties.js

+17
Original file line numberDiff line numberDiff line change
@@ -1411,6 +1411,23 @@ tester.run('no-unused-properties', rule, {
14111411
</script>
14121412
`,
14131413
options: deepDataOptions
1414+
},
1415+
{
1416+
filename: 'test.vue',
1417+
code: `
1418+
<template>
1419+
<div> {{ obj.num.toLocaleString() }} </div>
1420+
</template>
1421+
<script>
1422+
export default {
1423+
data () {
1424+
return {
1425+
obj: { num: 42 }
1426+
}
1427+
}
1428+
}
1429+
</script>`,
1430+
options: deepDataOptions
14141431
}
14151432
],
14161433

0 commit comments

Comments
 (0)