tamayika / vscode-any-lint

VSCode Any Lint allows you to lint any files with any command line tools
Other
4 stars 2 forks source link

diagnostic > run fails with "The "options.cwd" property must be of type string or an instance of Buffer or URL. Received an instance of Promise" #19

Closed mgzenitech closed 1 month ago

mgzenitech commented 1 month ago
          {
            "args": [
              "run",
              "dotenv-linter",
              "fix",
              "-q",
              "${file}"
            ],
            "binPath": "`poetry`",
            "cwd": "${workspaceFolder}",
            "lintAfterRun": "true",
            "title": "`Fix all fixable problems`",
            "type": "run"
          }

(that's same as running dotenv-linter fix -q ${file})

When clicking on this action I get this: Screenshot from 2024-07-18 12-55-46

tamayika commented 1 month ago

Thanks for the report. Please wait for the next release.

mgzenitech commented 1 month ago

@tamayika I think something's still off...

          {
            "args": [
              "`run`",
              "`dotenv-linter`",
              "`fix`",
              "`-q`"
              // "${file}"
            ],
            "binPath": "`poetry`",
            // "cwd": "${workspaceFolder}",
            "lintAfterRun": "true",
            "title": "`Fix all fixable problems`",
            "type": "run"
          }

When I uncomment any line with ${} any-lint would stop showing anything related to actions. Could there be a bug somewhere in there?

tamayika commented 1 month ago

In run action, you must use js expression. So, ${file} is making syntax error as js expression.

          {
            "args": [
              "`run`",
              "`dotenv-linter`",
              "`fix`",
              "`-q`",
              "$.file"
            ],
            "binPath": "`poetry`",
            "cwd": "$.workspaceFolder",
            "lintAfterRun": "true",
            "title": "`Fix all fixable problems`",
            "type": "run"
          }
mgzenitech commented 1 month ago

In run action, you must use js expression. So, ${file} is making syntax error as js expression.

          {
            "args": [
              "`run`",
              "`dotenv-linter`",
              "`fix`",
              "`-q`",
              "$.file"
            ],
            "binPath": "`poetry`",
            "cwd": "$.workspaceFolder",
            "lintAfterRun": "true",
            "title": "`Fix all fixable problems`",
            "type": "run"
          }

May I suggest normalizing same options?

Right now we have this:

  "any-lint.linters": [
    {
      "args": [
        "run",
        "dotenv-linter",
        "-q",
        "${file}"
      ],
      "binPath": "poetry",
      "cwd": "${workspaceFolder}",
      ...
    }
]

vs

      "diagnostic": {
        "actions": [
          {
            "args": [
              "`run`",
              "`dotenv-linter`",
              "`fix`",
              "`-q`",
              "`--no-backup`",
              "$.file"
            ],
            "binPath": "`poetry`",
            "cwd": "$.workspaceFolder",
            ...
          }
       ]
    }

If parsing with js is needed then probably also the non diagnostic action options should also follow same format? :)

tamayika commented 1 month ago

No, configuration of linter execution does not need dynamic evaluation because it is before linter execution. It should be the same as vscode standard configuration.