OfficeDev / OfficeDev/Office-Addin-Scripts

load-object-before-read false positive on complex load path

Open
#985 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs triage
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.

  1. If I write this JS code :
  const selection = context.document.getSelection();
  selection.load('parentContentControlOrNullObject/cannotEdit');
  await context.sync();

  const parentContentControl = selection.parentContentControlOrNullObject;
  1. 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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.