Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eslint-plugin-office-addins: load-object-before-read doesn't understand ClientResult #877

Open
yoonbuck opened this issue Jul 23, 2024 · 0 comments

Comments

@yoonbuck
Copy link

yoonbuck commented Jul 23, 2024

Expected behavior

When using a ClientResult, calling load is not required (in fact there is no load()) – instead context.sync() is sufficient to make its value available.

The load-object-before-read rule should understand this exception and not show an error in this situation.

Current behavior

The load-object-before-read rule shows an error where value is accessed on a ClientResult, even after awaiting context.sync().

Note that the code works fine in Office, this is only an error in the linter.

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  1. Attempt to use a ClientResult's value after awaiting context.sync() (example code below)

Context

Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.

  • Operating System: macOS 14.5
  • Node version: v22.4.1
  • Office version: Microsoft Excel Version 16.87 (24071426)
  • Tool version: [email protected]

Failure Logs

A simple test case based on the example on the documentation page for ClientResult:

const tableCount = context.workbook.tables.getCount();

// This sync call implicitly loads tableCount.value.
// Any other ClientResult values are loaded too.
await context.sync();

console.log(tableCount.value); // eslint error: An explicit load call on 'tableCount' for property 'value' needs to be made before the property can be read.
image

Seems to be the same issue as someone is experiencing here: https://stackoverflow.com/questions/78191843/do-we-need-to-call-load-before-reading-ooxml-of-an-api-object

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant