You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
eslint-plugin-office-addins 5.x: /* global Office */ comments fail no-redeclare in the recommended config #1023
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
A file with a /* global Office ... */ comment, as the OfficeDev templates write them, lints cleanly with configs.recommended and with office-addin-lint check.
Current behavior
Since 5.0.0 the recommended config declares Office, Excel, Word and the other Office.js namespaces in languageOptions.globals (main.ts#L42-L51), added for #999. It also spreads @eslint/js recommended (main.ts#L24), which turns on no-redeclare. That rule's builtinGlobals option is true by default, and with it the rule reports a /* global */ comment for a name that is already a configured global.
The templates have such a comment in their task pane and command files, e.g. Office-Addin-TaskPane src/taskpane/excel.ts#L6 (/* global console, document, Excel, Office */), Office-Addin-TaskPane-JS src/commands/commands.js#L6 and Office-Addin-TaskPane-React src/taskpane/outlook.ts#L1. They still pin eslint-plugin-office-addins ^4.0.10 and office-addin-lint ^3.0.10, so npm run lint starts failing on each of those files once they move to the current majors. In an Outlook add-in I work on, the update to office-addin-lint 4.0.1 and eslint-plugin-office-addins 5.0.1 gave 19 no-redeclare errors, one per file with such a comment.
src/taskpane.ts
1:11 error 'Office' is already defined as a built-in global variable no-redeclare
✖ 1 problem (1 error, 0 warnings)
configs.recommended used directly gives the same error under ESLint 9.39.5 and 10.12.0. With eslint-plugin-office-addins 4.0.10 the same file has no errors.
Context
Operating System: macOS
Node version: 26.0.0
Office version: n/a
Tool version: eslint-plugin-office-addins 5.0.1, office-addin-lint 4.0.1, eslint 9.39.5 and 10.12.0
Failure Logs
See above. Setting "no-redeclare": ["error", { builtinGlobals: false }] in the recommended config keeps the globals from #999, accepts the comments and still reports a variable declared twice; I have a PR ready.
Activity