Skip to content

Commit

Permalink
standard: use binary from node_modules/.bin if present
Browse files Browse the repository at this point in the history
  • Loading branch information
AbelAnaya authored Dec 19, 2024
1 parent 29e6300 commit ab8d060
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lua/lint/linters/standardjs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
-- Parsing Error
-- /home/jorge/code/index.js:2:13: Parsing error: Unexpected token 1 (null)

local binary_name = "standard"
local pattern = "[^:]+:(%d+):(%d+):([^%.]+%.?)%s%(([%a-]+)%)%s?%(?(%a*)%)?"
local groups = { 'lnum', 'col', 'message', 'code', 'severity' }
local severities = {
Expand All @@ -18,7 +19,10 @@ local severities = {
}

return {
cmd = 'standard',
cmd = function()
local local_binary = vim.fn.fnamemodify('./node_modules/.bin/' .. binary_name, ':p')
return vim.loop.fs_stat(local_binary) and local_binary or binary_name
end,
stdin = true,
args = { "--stdin" },
ignore_exitcode = true,
Expand Down

0 comments on commit ab8d060

Please sign in to comment.