Skip to content

Commit

Permalink
fix(graphcache): Fix untranspiled class field initializer syntax in b…
Browse files Browse the repository at this point in the history
…undle (#3275)
  • Loading branch information
kitten authored Jun 15, 2023
1 parent 9ba4130 commit 997ecf5
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/healthy-chefs-learn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@urql/exchange-graphcache': patch
---

Fix untranspiled class property initializer syntax being leftover in build output. (Regression in #3053)
8 changes: 6 additions & 2 deletions exchanges/graphcache/src/store/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ export class Store<
}
}

keyOfField = keyOfField;
keyOfField(fieldName: string, fieldArgs?: FieldArgs) {
return keyOfField(fieldName, fieldArgs);
}

keyOfEntity(data: Entity) {
// In resolvers and updaters we may have a specific parent
Expand Down Expand Up @@ -148,7 +150,9 @@ export class Store<
return link || null;
}

resolveFieldByKey = this.resolve;
resolveFieldByKey(entity: Entity, field: string, args?: FieldArgs) {
return this.resolve(entity, field, args);
}

invalidate(entity: Entity, field?: string, args?: FieldArgs) {
const entityKey = this.keyOfEntity(entity);
Expand Down
8 changes: 8 additions & 0 deletions scripts/eslint/preset.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ module.exports = {
'@typescript-eslint/array-type': 'off',
'import/no-internal-modules': 'off',

'no-restricted-syntax': [
"error",
{
"selector": "PropertyDefinition[value]",
"message": "Property definitions with value initializers aren’t transpiled"
},
],

'@typescript-eslint/no-unused-vars': ['error', {
argsIgnorePattern: '^_',
}],
Expand Down

0 comments on commit 997ecf5

Please sign in to comment.