OfficeDev / OfficeDev/Office-Addin-TaskPane-React

lint:fix not working

Open
#171 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
89
Forks
46
Avg merge
1d 8h
Merged PRs (30d)
3

Description

Prerequisites

  • I am running the latest version of Node and the tools
  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed

Expected behavior

The Office Add-in template's linter should properly run and fix lint issues for TypeScript files.

Current behavior

The linter seems to be primarily configured for JavaScript files and doesn't properly recognize TypeScript files, even though TypeScript-specific configurations are present.
Although it's able to run the lint command, it fails when I try to run it with the --fix flag.

Steps to Reproduce

  1. Create a new Office Add-in project using the Yeoman generator
  2. Run the lint command: npm run lint
  3. Observe it runs successfully
  4. Run the lint command with fix: npm run lint:fix
  5. Observe errors for browser globals in TypeScript files`> my-project@0.0.1 lint:fix
> office-addin-lint fix

Oops! Something went wrong! :(

ESLint: 9.20.1

No files matching the pattern "src/**/*.js" were found.
Please check for typing mistakes in the pattern.

Context

  • Operating System: macOS
  • Node version: 18.x/20.x
  • Office version: Microsoft 365
  • Tool versions:
    • typescript: ^5.4.2
    • office-addin-lint: ^3.0.3
    • eslint-plugin-office-addins: ^3.0.2

Contributor guide

Open the contributing guide

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 with the npm lint and lint:fix scripts and the office-addin-lint configuration, then compare the src/**/*.js pattern with the TypeScript files generated in the template. Reproduce the failure with npm run lint:fix and update the linting setup so TypeScript files are recognized and browser-global errors are handled.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.