nx icon indicating copy to clipboard operation
nx copied to clipboard

@nx/eslint Unknown options: reportUnusedDisableDirectives after upgrading to eslint 8.56.0

Open broksonic21 opened this issue 1 year ago • 5 comments

Current Behavior

 >  NX   Invalid Options:

   - Unknown options: reportUnusedDisableDirectives
   - 'reportUnusedDisableDirectives' has been removed. Please use the 'overrideConfig.linterOptions.reportUnusedDisableDirectives' option instead.

Error: Invalid Options:
- Unknown options: reportUnusedDisableDirectives
- 'reportUnusedDisableDirectives' has been removed. Please use the 'overrideConfig.linterOptions.reportUnusedDisableDirectives' option instead.
    at processOptions (/Users/REDACTED/REDACTED/node_modules/eslint/lib/eslint/eslint-helpers.js:783:15)
    at new FlatESLint (/Users/REDACTED/REDACTED/node_modules/eslint/lib/eslint/flat-eslint.js:556:34)
    at resolveAndInstantiateESLint (/Users/REDACTED/REDACTED/node_modules/@nx/eslint/src/executors/lint/utility/eslint-utils.js:65:20)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async run (/Users/REDACTED/REDACTED/node_modules/@nx/eslint/src/executors/lint/lint.impl.js:47:32)

Expected Behavior

@nx/eslint 17.2.8 and eslint 8.56.0 work same after upgrading.

GitHub Repo

No response

Steps to Reproduce

have on a private repo right now, will look into a public one

Nx Report

>  NX   Report complete - copy this into the issue template

   Node   : 20.10.0
   OS     : darwin-arm64
   npm    : 10.2.5

   nx             : 17.2.8
   @nx/js         : 17.2.8
   @nx/jest       : 17.2.8
   @nx/linter     : 17.2.8
   @nx/eslint     : 17.2.8
   @nx/workspace  : 17.2.8
   @nx/devkit     : 17.2.8
   @nrwl/tao      : 17.2.8
   typescript     : 5.3.3
   ---------------------------------------
   Community plugins:
   nx-stylelint : 17.1.0

Failure Logs

>  NX   Invalid Options:

   - Unknown options: reportUnusedDisableDirectives
   - 'reportUnusedDisableDirectives' has been removed. Please use the 'overrideConfig.linterOptions.reportUnusedDisableDirectives' option instead.

Error: Invalid Options:
- Unknown options: reportUnusedDisableDirectives
- 'reportUnusedDisableDirectives' has been removed. Please use the 'overrideConfig.linterOptions.reportUnusedDisableDirectives' option instead.
    at processOptions (/Users/REDACTED/REDACTED/node_modules/eslint/lib/eslint/eslint-helpers.js:783:15)
    at new FlatESLint (/Users/REDACTED/REDACTED/node_modules/eslint/lib/eslint/flat-eslint.js:556:34)
    at resolveAndInstantiateESLint (/Users/REDACTED/REDACTED/node_modules/@nx/eslint/src/executors/lint/utility/eslint-utils.js:65:20)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async run (/Users/REDACTED/REDACTED/node_modules/@nx/eslint/src/executors/lint/lint.impl.js:47:32)

Package Manager Version

No response

Operating System

  • [X] macOS
  • [ ] Linux
  • [ ] Windows
  • [ ] Other (Please specify)

Additional Information

only happens after upgrading to eslint 8.56.0 using flag config

broksonic21 avatar Dec 28 '23 20:12 broksonic21

Seeing this issue as well. Seems to be happening due to the option here - https://github.com/nrwl/nx/blob/master/packages/eslint/src/executors/lint/utility/eslint-utils.ts#L52-L53

AdarshKonchady avatar Dec 29 '23 17:12 AdarshKonchady

Until this issue has been resolved, does anyone know of a workaround? Is there a way to remove this option in our ESLint configuration files or something?

ShaneYu avatar Jan 25 '24 13:01 ShaneYu

Until this issue has been resolved, does anyone know of a workaround? Is there a way to remove this option in our ESLint configuration files or something?

Downgrade ESLint to 8.55.X.

arklanq avatar Jan 25 '24 14:01 arklanq

If you want to be on the latest eslint 8.56.0 version till there's a Nx fix for this, I was able to get it to work by using eslint directly in Nx project.json "lint" instead of using @nx/linter:

"lint": {
      "executor": "nx:run-commands",
      "options": {
        "commands": ["pnpm eslint packages/PACKAGE_NAME"],
        "parallel": false
      }
    },

AdarshKonchady avatar Jan 25 '24 22:01 AdarshKonchady

If you want to be on the latest eslint 8.56.0 version till there's a Nx fix for this, I was able to get it to work by using eslint directly in Nx project.json "lint" instead of using @nx/linter:

This would be the proper workaround to do it outside of @nx/eslint plugin:

"lint": {
  "command": "eslint .", // lint everything at the current working directory
  "options": {
    "cwd": "{projectRoot}", // this tells the above command to run in your project's folder
  }
}

meeroslav avatar Jan 30 '24 12:01 meeroslav

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

github-actions[bot] avatar Mar 04 '24 00:03 github-actions[bot]