forcedotcom / cli

Salesforce CLI
https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/
BSD 3-Clause "New" or "Revised" License
493 stars 78 forks source link

Unable to update to ESLint 9 as @lwc/eslint-plugin-lwc don't support it. #2986

Closed PawelWozniak closed 2 months ago

PawelWozniak commented 2 months ago

Summary

I am keeping npm modules updated in my project but have stuck with ESLint 8.57.0 as @lwc/eslint-plugin-lwc don't support version 9.

Steps To Reproduce

In the project folder context type in CLI npm outdated

Package  Current  Wanted  Latest  Location             Depended by
eslint    8.57.0  8.57.0   9.9.0  node_modules/eslint  MyProject

then npm upgrade gives this result:

npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: salesforce-app@1.0.0
npm error Found: eslint@9.9.0
npm error node_modules/eslint
npm error   dev eslint@"^9.9.0" from the root project
npm error   peer eslint@"^7.5.0 || ^8.0.0 || ^9.0.0" from @babel/eslint-parser@7.25.1
npm error   node_modules/@babel/eslint-parser
npm error     dev @babel/eslint-parser@"^7.25.1" from the root project
npm error     peer @babel/eslint-parser@"^7" from @lwc/eslint-plugin-lwc@1.8.2
npm error     node_modules/@lwc/eslint-plugin-lwc
npm error       dev @lwc/eslint-plugin-lwc@"^1.8.2" from the root project
npm error
npm error Could not resolve dependency:
npm error peer eslint@"^7 || ^8" from @lwc/eslint-plugin-lwc@1.8.2
npm error node_modules/@lwc/eslint-plugin-lwc
npm error   dev @lwc/eslint-plugin-lwc@"^1.8.2" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
npm error
npm error
npm error For a full report see:
npm error -----\npm-cache\_logs\2024-08-19T12_34_58_143Z-eresolve-report.txt
npm error A complete log of this run can be found in: -----\npm-cache\_logs\2024-08-19T12_34_58_143Z-debug-0.log

It seems that lwc/eslint-plugin-lwc is not supporting version 9 of ESLint.

In the context of upcoming typescript support, I would like to have the latest version installed and supported. https://developer.salesforce.com/docs/platform/lwc/guide/ts.html

Expected result

It is possible to install the latest ESLint.

Actual result

Unable to update ESLint due to dependency issues.

System Information

Windows 11, powershell 7.4.4

{
  "architecture": "win32-x64",
  "cliVersion": "@salesforce/cli/2.54.6",
  "nodeVersion": "node-v20.16.0",
  "osVersion": "Windows_NT 10.0.22631",
  "rootPath": "C:\\Users\\pwozn\\AppData\\Local\\sf\\client\\2.54.6-b1d011f",
  "shell": "powershell",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 3.2.0 (core)",
    "@oclif/plugin-commands 4.0.10 (core)",
    "@oclif/plugin-help 6.2.8 (core)",
    "@oclif/plugin-not-found 3.2.15 (core)",
    "@oclif/plugin-plugins 5.4.2 (core)",
    "@oclif/plugin-search 1.2.5 (core)",
    "@oclif/plugin-update 4.5.2 (core)",
    "@oclif/plugin-version 2.2.10 (core)",
    "@oclif/plugin-warn-if-update-available 3.1.11 (core)",
    "@oclif/plugin-which 3.2.10 (core)",
    "@salesforce/cli 2.54.6 (core)",
    "apex 3.3.4 (core)",
    "auth 3.6.44 (core)",
    "data 3.5.14 (core)",
    "deploy-retrieve 3.9.25 (core)",
    "info 3.3.26 (core)",
    "limits 3.3.22 (core)",
    "marketplace 1.2.22 (core)",
    "org 4.4.5 (core)",
    "packaging 2.7.4 (core)",
    "schema 3.3.22 (core)",
    "settings 2.3.11 (core)",
    "sobject 1.4.26 (core)",
    "source 3.5.11 (core)",
    "telemetry 3.6.4 (core)",
    "templates 56.3.8 (core)",
    "trust 3.7.19 (core)",
    "user 3.5.22 (core)",
    "@salesforce/sfdx-scanner 4.4.0 (user) published 19 days ago (Tue Jul 30 2024)",
    "sfdmu 4.35.1 (user) published 0 days ago (Sun Aug 18 2024)",
    "sfdx-git-delta 5.42.0 (user) published 13 days ago (Mon Aug 05 2024)"
  ]
}

Additional information

github-actions[bot] commented 2 months ago

Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.

iowillhoit commented 2 months ago

Hello @PawelWozniak, the Salesforce CLI team does not own the @lwc/eslint-plugin-lwc package. It looks like that team is aware of the issue and has it on their roadmap. Feel free to comment on this existing issue: https://github.com/salesforce/eslint-config-lwc/issues/128

theperiscope commented 3 weeks ago

Hello, I think this is also a CLI issue as it is the CLI that creates ESLint ^9.9.1 dependency for a new standard project. I've been having lots of issues issues with template setup lately, need to run npm install --legacy-peer-deps also due to ESLint 9 issue.

SF CLI version: latest, 2.59.6 from 2024-09-25

sf project generate --name test1 --template standard --output-dir .\
npm install 
npm install --legacy-peer-deps

package.json

{
  "name": "salesforce-app",
  "private": true,
  "version": "1.0.0",
  "description": "Salesforce App",
  "scripts": {
    "lint": "eslint **/{aura,lwc}/**/*.js",
    "test": "npm run test:unit",
    "test:unit": "sfdx-lwc-jest",
    "test:unit:watch": "sfdx-lwc-jest --watch",
    "test:unit:debug": "sfdx-lwc-jest --debug",
    "test:unit:coverage": "sfdx-lwc-jest --coverage",
    "prettier": "prettier --write \"**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}\"",
    "prettier:verify": "prettier --check \"**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}\"",
    "postinstall": "husky install",
    "precommit": "lint-staged"
  },
  "devDependencies": {
    "@lwc/eslint-plugin-lwc": "^1.1.2",
    "@prettier/plugin-xml": "^3.2.2",
    "@salesforce/eslint-config-lwc": "^3.2.3",
    "@salesforce/eslint-plugin-aura": "^2.0.0",
    "@salesforce/eslint-plugin-lightning": "^1.0.0",
    "@salesforce/sfdx-lwc-jest": "^5.1.0",
    "eslint": "^9.9.1",
    "eslint-plugin-import": "^2.25.4",
    "eslint-plugin-jest": "^28.8.1",
    "husky": "^9.1.5",
    "lint-staged": "^15.1.0",
    "prettier": "^3.1.0",
    "prettier-plugin-apex": "^2.0.1"
  },
  "lint-staged": {
    "**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}": [
      "prettier --write"
    ],
    "**/{aura,lwc}/**/*.js": [
      "eslint"
    ]
  }
}