Skip to content

Commit 5ca8f11

Browse files
committed
fix: Proxy can't forward private fields
1 parent 9eb12a0 commit 5ca8f11

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

src/configs.ts

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,28 +24,24 @@ function toArray<T>(value: T | T[]): T[] {
2424

2525
export class TsEslintConfigForVue {
2626
// the name property is here to provide better error messages when ESLint throws an error
27-
name: string
28-
29-
#configName: ExtendableConfigName
27+
configName: ExtendableConfigName
3028

3129
constructor(configName: ExtendableConfigName) {
32-
this.#configName = configName
33-
34-
this.name = `vueTsConfigs.${configName}`
30+
this.configName = configName
3531
}
3632

3733
needsTypeChecking(): boolean {
38-
if (this.#configName === 'disableTypeChecked') {
34+
if (this.configName === 'disableTypeChecked') {
3935
return false
4036
}
41-
if (this.#configName === 'all') {
37+
if (this.configName === 'all') {
4238
return true
4339
}
44-
return this.#configName.includes('TypeChecked')
40+
return this.configName.includes('TypeChecked')
4541
}
4642

4743
toConfigArray(): FlatConfig.ConfigArray {
48-
return toArray(tseslint.configs[this.#configName])
44+
return toArray(tseslint.configs[this.configName])
4945
.flat()
5046
.map(config =>
5147
config.files && config.files.includes('**/*.ts')
@@ -68,7 +64,18 @@ export const vueTsConfigs = Object.fromEntries(
6864
// `defineConfigWithVueTs()`
6965
// We throw an error here to provide a better error message to the user.
7066
ownKeys() {
71-
throw new Error('Please wrap the config object with `defineConfigWithVueTs()`')
67+
throw new Error(
68+
'Please wrap the config object with `defineConfigWithVueTs()`',
69+
)
70+
},
71+
72+
get(target, prop) {
73+
// for clearer error messages on where the config is coming from
74+
if (prop === 'name') {
75+
return `vueTsConfigs.${Reflect.get(target, 'configName')}`
76+
}
77+
78+
return Reflect.get(target, prop)
7279
},
7380
}),
7481
]),

0 commit comments

Comments
 (0)