-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: use utils.cosmiconfig for eslint and prettier
- Loading branch information
Showing
8 changed files
with
36 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
local u = require("null-ls.utils") | ||
|
||
-- Create the default root_pattern for tools using cosmiconfig. | ||
-- https://github.com/cosmiconfig/cosmiconfig#usage-for-end-users | ||
---@param module_name string The module name. | ||
return function(module_name) | ||
local patterns = { | ||
"package.json", | ||
".{NAME}rc", | ||
".{NAME}rc.json", | ||
".{NAME}rc.yaml", | ||
".{NAME}rc.yml", | ||
".{NAME}rc.js", | ||
".{NAME}rc.ts", | ||
".{NAME}rc.cjs", | ||
"{NAME}.config.js", | ||
"{NAME}.config.ts", | ||
"{NAME}.config.mjs", | ||
"{NAME}.config.cjs", | ||
} | ||
for i, v in ipairs(patterns) do | ||
patterns[i] = string.gsub(v, "{NAME}", module_name) | ||
end | ||
|
||
return u.root_pattern(table.unpack(patterns)) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters