OfficeDev / Office-Addin-Scripts

A set of scripts and packages that are consumed in Office add-ins projects.
MIT License
153 stars 93 forks source link

"eslint-plugin-office-addins" is conflicted with "eslint-config-airbnb-typescript" #780

Closed Emiya0306 closed 12 months ago

Emiya0306 commented 1 year ago

Prerequisites

Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.

Expected behavior

Eslint works well

Current behavior

Eslint crashed~

//
module.exports = {
  extends: [
    'react-app',
    'react-app/jest',
    'airbnb',
    'airbnb-typescript',
    'plugin:office-addins/recommended'
  ],
  plugins: [
    'header',
    'office-addins'
  ],
}

[Error - 17:47:00] Error: Plugin "@typescript-eslint" was conflicted between "packages/excel/.eslintrc.js » plugin:office-addins/recommended" and "packages/excel/.eslintrc.js » eslint-config-airbnb-typescript » /xxx/node_modules/eslint-config-airbnb-typescript/lib/shared.js". at mergePlugins (/xxx/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:598:19) at createConfig (/xxx/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:701:9) at ConfigArray.extractConfig (/xxx/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:877:33) at CLIEngine.isPathIgnored (/xxx/node_modules/eslint/lib/cli-engine/cli-engine.js:990:18) at CLIEngine.executeOnText (/xxx/node_modules/eslint/lib/cli-engine/cli-engine.js:899:38) at ESLint.lintText (/xxx/node_modules/eslint/lib/eslint/eslint.js:592:23) at /Users/xxx/.vscode/extensions/dbaeumer.vscode-eslint-2.4.0/server/out/eslintServer.js:1:24378 at E (/Users/xxx/.vscode/extensions/dbaeumer.vscode-eslint-2.4.0/server/out/eslintServer.js:1:18748) at e.validate (/Users/xxx/.vscode/extensions/dbaeumer.vscode-eslint-2.4.0/server/out/eslintServer.js:1:24337) at /Users/xxx/.vscode/extensions/dbaeumer.vscode-eslint-2.4.0/server/out/eslintServer.js:1:220926

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  1. install eslint-config-airbnb, eslint-config-airbnb-typescript and eslint-plugin-office-addins, you will get this error.

Context

Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.

ndeleuze commented 1 year ago

@Emiya0306 What kind of project are you working with? (Project type? Host application? TypeScript or JavaScript?) Also do you get the above error when running npm install for each of the three dependencies above?

Emiya0306 commented 12 months ago

Oh thanks, I get the root cause!

My old project has already install "@typescript-eslint@^5.5.0", and the version "5.33.0" is locked by yarn.lock file. Then I install "eslint-plugin-office-addins". "eslint-plugin-office-addins" dependence "@typescript-eslint@^5.33.1", and install the version "5.62.0".

So that is the function mergePlugins of /node_modules/@eslint/eslintrc/dist/eslintrc.cjs:601:19 will accept both @5.33.0 and @5.62.0 of "@typescript-eslint". And it will cause problem.

So it is the yarn's problem, not "eslint-plugin-office-addins".

image

Pic 1 My yarn.lock file content of @typescript-eslint

It will cause node_modules has two @typescript-eslint, and mergePlugins will be crashed.

image

Pic 2 Crash in here

image

Pic 3

image

Pic 4 The correct yarn.lock file content of @typescript-eslint