liquidev / lintplus

An improved linting plugin for the lite text editor.
59 stars 7 forks source link

npm and other commands from Windows #37

Open andreivinca opened 4 months ago

andreivinca commented 4 months ago

Executing npm modules as separate processes on Windows requires including their file extensions. For example, "eslint" should be "eslint.cmd".

The solution would look like this:

function lint.command(cmd)

   vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
  if PLATFORM == "Windows" then
    table.insert(cmd, 1, "/C")
    table.insert(cmd, 1, "cmd.exe")
  end
   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  return function (filename)
    return map(cmd, function (k, v)
      if type(k) == "number" and v == lint.filename then
        return filename
      end
      return v
    end)
  end
end

However, I believe encapsulating all Windows commands after "cmd.exe /C" without offering an option within the linter script to bypass this encapsulation isn't the most effective approach. Additionally, there's currently no way to send something like 'windows_skip_cmd' flag to customize the command's construction, without breaking changes.