Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[minor] Update to flat eslint config files per requirements of eslint v9 #917

Merged
merged 19 commits into from
Jan 29, 2025

Conversation

millerds
Copy link
Contributor

Change Description:
Recent change to the repo updated to eslint v9 which requires using eslint.config.mjs (aka flat config) instead of .eslintrc.json configuration files. This also triggered some formatting changes to various code files in the different packages.

Note . . . there are many changed files, but functionally there should be no change except for the office-addin-lint package using the new config files in its cli and the eslint-plugin-office-addin exporting the new config style.

  1. Do these changes impact command syntax of any of the packages? (e.g., add/remove command, add/remove a command parameter, or update required parameters)
    No.

  2. Do these changes impact documentation? (e.g., a tutorial on https://learn.microsoft.com/office/dev/add-ins/overview/office-add-ins)
    Maybe. I'm not sure how much the documentation talks about linting configuration.

If you answered yes to any of these please do the following:
> Include 'Rick-Kirkham' in the review
> Make sure the README file is correct

Validation/testing performed:
Ran automated tests and used locally created packages on test add-in project to confirm usability.

@millerds millerds requested a review from a team as a code owner January 24, 2025 22:40
@AlexJerabek
Copy link

@millerds, we talk about the Office JS linter here: https://learn.microsoft.com/en-us/office/dev/add-ins/overview/set-up-your-dev-environment?tabs=yeomangenerator#install-and-use-the-office-javascript-linter. Does this mean we'll need to change the instructions around editing .eslintrc.json?

@millerds
Copy link
Contributor Author

@millerds, we talk about the Office JS linter here: https://learn.microsoft.com/en-us/office/dev/add-ins/overview/set-up-your-dev-environment?tabs=yeomangenerator#install-and-use-the-office-javascript-linter. Does this mean we'll need to change the instructions around editing .eslintrc.json?

Yes . . . the new version of the lint package will use eslint v9 and will require a eslint.config.js file (or .mjs if they want to use modern syntax) with a different syntax. The new js file will look something like this:

const officeAddins = require("eslint-plugin-office-addins");
const officeAddins = require("eslint-plugin-office-addins");
const tsParser = require("@typescript-eslint/parser"); // for typescript
const tseslint = require("typescript-eslint"); // for typescript

export default [
  ...tseslint.configs.recommended, // for typescript
  ...officeAddins.configs.recommended,
  {
    plugins: {
      "office-addins": officeAddins,
    },
    languageOptions: {
      parser: tsParser, // for typescript
    },
  },
];

@AlexJerabek
Copy link

Thanks @millerds! I created a PR to update the docs based on this work: OfficeDev/office-js-docs-pr#5006. Please let me know if I misinterpreted something.

@millerds millerds merged commit d3376cc into master Jan 29, 2025
5 checks passed
@millerds millerds deleted the user/millerds/update-eslint-config branch March 3, 2025 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants