generator-office icon indicating copy to clipboard operation
generator-office copied to clipboard

TaskPane Outlook JS App npm run lint fails

Open GrumpyAL opened this issue 9 months ago • 2 comments

Expected behavior

When running npm run lint on a freshly generated add-in, the linting runs successfully.

Current behavior

After generating a fresh TaskPane Outlook JavaScript add-in and running npm run lint an error is encountered. When I started opening this bug, the error was

error Parsing error: Cannot read file '[path]\tsconfig.json'

However, after trying different node versions and generating new add-ins I was unable to reproduce because I got this error instead ESLint couldn't find the plugin "eslint-plugin-office-addins". (The package "eslint-plugin-office-addins" was not found when loaded as a Node module from the directory "[path]\node_modules\office-addin-lint\lib".)

It turns out, that the package office-addin-lint was updated a day ago to 2.3.1 and is what produces the new error. If you install back to 2.3.0, then you get the first error about missing the tsconfig file.

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  1. Use the generator to make a new add-in with the following settings:
  • TaskPane
  • Outlook
  • JavaScript
  1. Open VSCode and run npm run lint in the terminal.
  2. Observe one of two errors depending on the version of office-addin-lint.
  3. Install the other version and repeat.

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: Windows
  • Node version: Tried various, currently 20.1.2.
  • Office version: n/a but 2403
  • Tool version: 5.0.0 (installed again and confirmed updating it didn't fix the issue).

GrumpyAL avatar Apr 24 '24 20:04 GrumpyAL

Hi @GrumpyAL, thanks for reporting this! I see this issue as well. @millerds, can you please help with this issue? Thanks!

davidchesnut avatar Apr 25 '24 16:04 davidchesnut

This seems to have been broken with an update to our lint rules package. A fix needs to be made.

millerds avatar Apr 25 '24 20:04 millerds

@millerds (and @GrumpyAL ) doing a bit more research on the linting here I notice the template uses .eslintrc.json to configure the linter. This is deprecated according to linter docs: https://eslint.org/docs/latest/use/configure/configuration-files I renamed to eslint.config.js and then pasted in quick start config from here and that fixed this error: https://eslint.org/docs/latest/use/getting-started

Cheers, David

davidchesnut avatar May 28 '24 21:05 davidchesnut

That page doesn't say itself that the file .eslintrc.json is depricated . . . but it does link to older documentation that suggests it is (https://eslint.org/docs/latest/use/configure/configuration-files-deprecated).

However . . . 2 things

  • deprecated in this case doesn't mean unsupported . . . just that it's going away (and new versions of eslint prefer other files). This suggests the templates (and possibly script code) could be updated to a current version of eslint and changed to use a new file format for long term compatibility
  • There certainly was a bug in the script package that I fixed (just forgot to come back to this post to say so) that has nothing to do with the config file.

Current version of the linter rules should work better.

millerds avatar May 28 '24 21:05 millerds