mirror of
				https://github.com/NotAShelf/nvf.git
				synced 2025-10-31 11:02:37 +00:00 
			
		
		
		
	Deploy PR #821 preview
This commit is contained in:
		
					parent
					
						
							
								ab644a3f16
							
						
					
				
			
			
				commit
				
					
						0b64a11ebe
					
				
			
		
					 1 changed files with 101 additions and 0 deletions
				
			
		|  | @ -5824,6 +5824,76 @@ boolean</p> | ||||||
| <p><span class="emphasis"><em>Example:</em></span> | <p><span class="emphasis"><em>Example:</em></span> | ||||||
| <code class="literal">true</code></p> | <code class="literal">true</code></p> | ||||||
| 
 | 
 | ||||||
|  | <p><span class="emphasis"><em>Declared by:</em></span></p> | ||||||
|  | <table border="0" summary="Simple list" class="simplelist"> | ||||||
|  | <tr><td> | ||||||
|  | <code class="filename"><a class="filename"  href="https://github.com/NotAShelf/nvf/blob/main/modules/plugins/diagnostics/nvim-lint/nvim-lint.nix" target="_top"> | ||||||
|  | <nvf/modules/plugins/diagnostics/nvim-lint/nvim-lint.nix> | ||||||
|  | </a></code> | ||||||
|  | </td></tr> | ||||||
|  | </table> | ||||||
|  | </dd> | ||||||
|  | <dt> | ||||||
|  |  <span class="term"> | ||||||
|  |  <a id="opt-vim.diagnostics.nvim-lint.lint_function"></a><a class="term" href="options.html#opt-vim.diagnostics.nvim-lint.lint_function"><code class="option">vim.diagnostics.nvim-lint.lint_function</code> | ||||||
|  |   </a> | ||||||
|  |  </span> | ||||||
|  | </dt> | ||||||
|  | <dd> | ||||||
|  | <p>Define the global function nvf_lint which is used by nvf to lint.</p> | ||||||
|  | 
 | ||||||
|  | <p><span class="emphasis"><em>Type:</em></span> | ||||||
|  | luaInline</p> | ||||||
|  | 
 | ||||||
|  | <p><span class="emphasis"><em>Default:</em></span></p><pre><code class="programlisting">{ | ||||||
|  |   _type = "lua-inline"; | ||||||
|  |   expr = '' | ||||||
|  |     function(buf) | ||||||
|  |       local ft = vim.api.nvim_get_option_value("filetype", { buf = buf }) | ||||||
|  |       local linters = require("lint").linters | ||||||
|  |       local linters_from_ft = require("lint").linters_by_ft[ft] | ||||||
|  |      | ||||||
|  |       -- if no linter is configured for this filetype, stops linting | ||||||
|  |       if linters_from_ft == nil then return end | ||||||
|  |      | ||||||
|  |       for _, name in ipairs(linters_from_ft) do | ||||||
|  |         local linter = linters[name] | ||||||
|  |         assert(linter, 'Linter with name `' .. name .. '` not available') | ||||||
|  |      | ||||||
|  |         if type(linter) == "function" then | ||||||
|  |           linter = linter() | ||||||
|  |         end | ||||||
|  |         -- for require("lint").lint() to work, linter.name must be set | ||||||
|  |         linter.name = linter.name or name | ||||||
|  |         local cwd = linter.required_files | ||||||
|  |      | ||||||
|  |         -- if no configuration files are configured, lint | ||||||
|  |         if cwd == nil then | ||||||
|  |           require("lint").lint(linter) | ||||||
|  |         else | ||||||
|  |           -- if configuration files are configured and present in the project, lint | ||||||
|  |           for _, fn in ipairs(cwd) do | ||||||
|  |             local path = vim.fs.joinpath(linter.cwd or vim.fn.getcwd(), fn); | ||||||
|  |             if vim.uv.fs_stat(path) then | ||||||
|  |               require("lint").lint(linter) | ||||||
|  |               break | ||||||
|  |             end | ||||||
|  |           end | ||||||
|  |         end | ||||||
|  |       end | ||||||
|  |     end | ||||||
|  |   ''; | ||||||
|  | } | ||||||
|  | </code></pre> | ||||||
|  | 
 | ||||||
|  | <p><span class="emphasis"><em>Example:</em></span></p><pre><code class="programlisting">mkLuaInline '' | ||||||
|  |   function(buf) | ||||||
|  |     require("lint").try_lint() | ||||||
|  |   end | ||||||
|  | '' | ||||||
|  | 
 | ||||||
|  | </code></pre> | ||||||
|  | 
 | ||||||
| <p><span class="emphasis"><em>Declared by:</em></span></p> | <p><span class="emphasis"><em>Declared by:</em></span></p> | ||||||
| <table border="0" summary="Simple list" class="simplelist"> | <table border="0" summary="Simple list" class="simplelist"> | ||||||
| <tr><td> | <tr><td> | ||||||
|  | @ -6058,6 +6128,37 @@ null or (luaInline)</p> | ||||||
| <p><span class="emphasis"><em>Default:</em></span> | <p><span class="emphasis"><em>Default:</em></span> | ||||||
| <code class="literal">null</code></p> | <code class="literal">null</code></p> | ||||||
| 
 | 
 | ||||||
|  | <p><span class="emphasis"><em>Declared by:</em></span></p> | ||||||
|  | <table border="0" summary="Simple list" class="simplelist"> | ||||||
|  | <tr><td> | ||||||
|  | <code class="filename"><a class="filename"  href="https://github.com/NotAShelf/nvf/blob/main/modules/plugins/diagnostics/nvim-lint/nvim-lint.nix" target="_top"> | ||||||
|  | <nvf/modules/plugins/diagnostics/nvim-lint/nvim-lint.nix> | ||||||
|  | </a></code> | ||||||
|  | </td></tr> | ||||||
|  | </table> | ||||||
|  | </dd> | ||||||
|  | <dt> | ||||||
|  |  <span class="term"> | ||||||
|  |  <a id="opt-vim.diagnostics.nvim-lint.linters._name_.required_files"></a><a class="term" href="options.html#opt-vim.diagnostics.nvim-lint.linters._name_.required_files"><code class="option">vim.diagnostics.nvim-lint.linters.<name>.required_files</code> | ||||||
|  |   </a> | ||||||
|  |  </span> | ||||||
|  | </dt> | ||||||
|  | <dd> | ||||||
|  | <p>Required files to lint. These files must exist relative to the cwd | ||||||
|  | of the linter or else this linter will be skipped</p><div class="note"><h3 class="title">Note</h3><p>This option is an nvf extension that only takes effect if you | ||||||
|  | use the <code class="literal">nvf_lint()</code> lua function.</p><p>See <code class="option">vim.diagnostics.nvim-lint.lint_function</code>.</p></div> | ||||||
|  | 
 | ||||||
|  | <p><span class="emphasis"><em>Type:</em></span> | ||||||
|  | null or (list of string)</p> | ||||||
|  | 
 | ||||||
|  | <p><span class="emphasis"><em>Default:</em></span> | ||||||
|  | <code class="literal">null</code></p> | ||||||
|  | 
 | ||||||
|  | <p><span class="emphasis"><em>Example:</em></span></p><pre><code class="programlisting">[ | ||||||
|  |   "eslint.config.js" | ||||||
|  | ] | ||||||
|  | </code></pre> | ||||||
|  | 
 | ||||||
| <p><span class="emphasis"><em>Declared by:</em></span></p> | <p><span class="emphasis"><em>Declared by:</em></span></p> | ||||||
| <table border="0" summary="Simple list" class="simplelist"> | <table border="0" summary="Simple list" class="simplelist"> | ||||||
| <tr><td> | <tr><td> | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 GitHub Actions
				GitHub Actions