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

[all hosts] (Developer Experience) Adjust lint configuration for eslint v9 #5006

Merged
merged 2 commits into from
Feb 12, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 20 additions & 12 deletions docs/overview/set-up-your-dev-environment.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Set up your development environment
description: Set up your developer environment to build Office Add-ins.
ms.date: 12/12/2024
ms.date: 01/27/2025
ms.topic: install-set-up-deploy
ms.localizationpriority: medium
---
Expand Down Expand Up @@ -70,17 +70,25 @@ If you created your project manually, install and configure the linter with the
npm install eslint-plugin-office-addins --save-dev
```

1. In the root of the project, create a text file named **.eslintrc.json**, if there isn't one already there. Be sure it has properties named `plugins` and `extends`, both of type array. The `plugins` array should include `"office-addins"` and the `extends` array should include `"plugin:office-addins/recommended"`. The following is a simple example. Your **.eslintrc.json** file may have additional properties and additional members of the two arrays.

```json
{
"plugins": [
"office-addins"
],
"extends": [
"plugin:office-addins/recommended"
]
}
1. In the root of the project, create a text file named **eslint.config.js** (or **.mjs**), if there isn't one already there. Be sure to inherit the recommended configuration for `eslint-plugin-office-addins`. The `plugins` array should include `eslint-plugin-office-addins`. The following is a simple example that includes settings for TypeScript. Your **eslint.config.js** file may have additional properties and configurations.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically plugins is not an array anymore . . . it is an object.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Corrected.

```js
const officeAddins = require("eslint-plugin-office-addins");
const tsParser = require("@typescript-eslint/parser");
const tsEsLint = require("typescript-eslint");

export default [
...tsEsLint.configs.recommended,
...officeAddins.configs.recommended,
{
plugins: {
"office-addins": officeAddins,
},
languageOptions: {
parser: tsParser,
},
},
];
```

1. In the root of the project, open the **package.json** file and be sure that the `scripts` array has the following member.
Expand Down