OfficeDev / OfficeDev/Office-Addin-Scripts
load-object-before-read false positive on complex load path
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 194
- Forks
- 117
- Avg merge
- 1d 32m
- Merged PRs (30d)
- 2
Description
Expected behavior
No linting error
Current behavior
An explicit load call on 'selection' for property 'parentContentControlOrNullObject' needs to be made before the property can be read office-addins/load-object-before-read
Steps to Reproduce
Please provide detailed steps for reproducing the issue.
- If I write this JS code :
const selection = context.document.getSelection();
selection.load('parentContentControlOrNullObject/cannotEdit');
await context.sync();
const parentContentControl = selection.parentContentControlOrNullObject;
- I get a linting error that parentContentControlOrNullObject need to be loaded
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 26.2
- Node version: 24
- Office version: latest
- eslint-plugin-office-addins: 4.0.7
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the office-addins/load-object-before-read rule and reproduce the JavaScript example from the issue. Trace how the rule handles the slash-separated load path, then verify that the property access no longer produces a false positive while the lint check still catches genuinely unloaded properties.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- eslint, typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 57/100