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

"About to lint" but nothing happens #11

Open
Fuzzyma opened this issue May 12, 2021 · 9 comments
Open

"About to lint" but nothing happens #11

Fuzzyma opened this issue May 12, 2021 · 9 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@Fuzzyma
Copy link

Fuzzyma commented May 12, 2021

I am saving the file I want to format and the debug logs reacts with:

About to lint by:

              Linter: "eslint"
   Current Directory: "D:\Repositories\edge\Orion\Main\Source\Cloud\AdminPortal\"
        Command line: "D:\Repositories\edge\Orion\Main\Source\Cloud\AdminPortal\Areas\STO\node_modules\.bin\eslint.cmd"
           Arguments: ""Areas\STO\Components\assemblies\assemblies.js" -f json"

But nothing happens.

  • Where is the output of the result?
  • Is it also formatting? Shouldnt it add a --fix flag for formatting?
  • Is there any kind of confirmation that it worked in the debug log? It looks like its just stuck at this message forever
@Fuzzyma Fuzzyma changed the title "Attempt to lint" but nothing happens "About to lint" but nothing happens May 12, 2021
@glat
Copy link
Owner

glat commented Jun 24, 2021

There's a bug in latest stylelint releases (see stylelint/stylelint#5122)
I'm about to publish a fix.
Stylelint does not works now passing relative file paths.

@glat
Copy link
Owner

glat commented Jun 24, 2021

Sorry. You'r using eslint. After the "About to lint by" message what do you get in debug windows?
Even I've to investigate if this behaviour is common to eslint and stylelint due to a common used bugged package.
Are you getting "Error: No files matching the pattern ......." ?

@glat
Copy link
Owner

glat commented Jun 24, 2021

Just uploaded a bugfix. Please upgrade to 1.0.44 release and check if it works. It's a bugfix per "Error: no files matching the pattern ...." bug of stylelint.

@Fuzzyma
Copy link
Author

Fuzzyma commented Jun 24, 2021

There was no further output. I tried to add eslint as formatted as well but this also didn't work. I have to retest

@Fuzzyma
Copy link
Author

Fuzzyma commented Jun 24, 2021

So linting seems to work now. It correctly underlines the errors in the code. However, formating goes horribly wrong. It replaces the whole content of the file with the output of eslint. However, the output is json and only contains the linted file (beside info about errors and stuff). So eslint needs special handling for this I guess? This is the config I used:

{
  "eslintfix": {
    "enabled": true,
    "additionalArguments": "--fix-dry-run",
    "fileExtensions": "js",
    "executable": "eslint.cmd",
    "arguments": "\"{filePath}\" -f json",
    "stdInArguments": "--stdin --stdin-filename=\"{filePath}\" -f json",
    "installationType": "local",
    "toolType": "formatter",
    "ruleHelpUrl": "https://eslint.org/docs/rules/{ruleId}",
    "resultsSelector": "$[0].messages",
    "sourceSelector": "source",
    "lineSelector": "line",
    "columnSelector": "column",
    "endLineSelector": "endLine",
    "endColumnSelector": "endColumn",
    "isFatalSelector": "isFatal",
    "messageSelector": "message",
    "ruleIdSelector": "ruleId",
    "ruleHelpUrlSelector": "",
    "severitySelector": "severity"
  },
  "eslint": {
    "enabled": true,
    "fileExtensions": "js"
  }
}

@glat
Copy link
Owner

glat commented Jun 24, 2021

As I wrote in other issue fix is not supported. Multilinter takes only care to get warnings and errors. So, remove the additionalArguments. Furthermore you've no changes about the base sconfig (which is inherited), so you need only the standard config which is:

{
"eslint": {
"enabled": true,
"fileExtensions": "js"
}
}

If you fill in two linters (eslintfix AND eslint), that it's called twice if you've multiple linters enabled in VS options. So it slows down the editor.

@glat glat added bug Something isn't working enhancement New feature or request labels Jun 24, 2021
@Fuzzyma
Copy link
Author

Fuzzyma commented Jun 24, 2021

I added eslintfix as formatter and not as linter. Why are you able to define formatters in the config if you cant use them? or is this specific to eslint? Btw: I was able to make eslintfix work through a macro on my end. So if you need help hit me up

@glat
Copy link
Owner

glat commented Jun 24, 2021

Ah! You're right, but about formatters see readme:

v1.0.42: Implemented formatters. Preconfigured are Prettier and Beautify. Can be present some bugs.

I never tested eslint as a formatter. I'll add into to do list.

@Fuzzyma
Copy link
Author

Fuzzyma commented Jun 24, 2021

Its pretty easy. You get the json output from eslint and you just take the "output" property of the json and replace the whole file with it. And yeah, you have to use "--fix-dry-run" instead of "--fix" when using stdin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants