nx-console icon indicating copy to clipboard operation
nx-console copied to clipboard

feat: Implemented eslint problem matcher

Open work933k opened this issue 1 year ago • 3 comments

I propose to have NX-console-extension to support the VSCode problemmatcher functionality for eslint-tasks.

work933k avatar Feb 20 '24 14:02 work933k

Thanks so much for submitting this PR! I'll look into it and give it a try :)

MaxKless avatar Feb 26 '24 11:02 MaxKless

☁️ Nx Cloud Report

CI is running/has finished running commands for commit b66c7ea44a7b65066c7c3c8a5f69053644c1b23d. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 4 targets

Sent with 💌 from NxCloud.

nx-cloud[bot] avatar Feb 26 '24 11:02 nx-cloud[bot]

Hey :) Am I missing something or are a lot of the places where we could be running tasks from still not integrated here? We are still not passing problem matchers anywhere except the sidebar when using CliTaskProvider.instance.executeTask.

MaxKless avatar Jun 12 '24 11:06 MaxKless

I wanted to get this PR going again. I thought i had everything working and was finishing up. But then i noticed that when clicking on some "problems", VSCode complained about some files to not exist. As it seems i got the output from NX-cache which was put there by you (?).
You probably have your development files in "/home/workflows/workspace/..." while i use a different root-folder... This should be a very common issue with NX-tasks which output absolute-filepaths (in contrary to relative paths).

I triggered affected lint via the NX-console and got this output:

Executing task: yarn nx affected --target=lint --output-style=stream 
...
NX   Successfully ran target lint for 10 projects
Nx read the output from the cache instead of running the command for 10 out of 10 tasks.

A lint-result was:

/home/sanders/nx-console2/libs/vscode/tasks/src/lib/cli-task-provider.ts
   6:52  warning  'window' is defined but never used  @typescript-eslint/no-unused-vars
  69:7   warning  Forbidden non-null assertion        @typescript-eslint/no-non-null-assertion

✖ 2 problems (0 errors, 2 warnings)

/home/workflows/workspace/libs/language-server/utils/src/lib/runtime.ts
   4:16  warning  'configureHttpRequests' is defined but never used                             @typescript-eslint/no-unused-vars
  17:29  warning  '_encoding' is defined but never used. Allowed unused args must match /^_$/u  @typescript-eslint/no-unused-vars

✖ 2 problems (0 errors, 2 warnings)

Notice the different paths? I could probably try to see if there is a ESLint-reporter/format which outputs relative-filepaths.

Weird right? Any thoughts?

I've found the following related content:

  • https://github.com/eslint/eslint/issues/13376
  • https://eslint.org/docs/latest/use/formatters/#stylish
  • https://github.com/nrwl/nx/issues/7692#issuecomment-967212634
  • https://www.npmjs.com/package/eslint-formatter-json-relative
  • "Processing Task Output with Problem Matchers" https://vscode-docs.readthedocs.io/en/stable/editor/tasks/
  • https://github.com/fregante/eslint-formatters?tab=readme-ov-file
  • https://github.com/nrwl/nx/blob/2c0994ac87cc7d292ae5d9afa2950956b110606a/packages/eslint/src/executors/lint/schema.d.ts#L32

GrumpyMeow avatar Oct 02 '24 17:10 GrumpyMeow