Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document how to use glob filters to only run linters on a subset of a filetype #663

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,28 @@ end
```


## Only run linters on certain glob patterns

You might want to only run linters like [`actionlint`][actionlint] on a
subset of files in a given filetype. In this case, you can use
`vim.filetype.add()` to create a new combined filetype, and then you can use
`lint.linters_by_ft` to associate that filetype with a given linter:

```lua
vim.filetype.add({
pattern = {
[".*/.github/workflows/.*%.yml"] = "yaml.ghaction",
[".*/.github/workflows/.*%.yaml"] = "yaml.ghaction",
},
})

local lint = require("lint")
lint.linters_by_ft = {
ghaction = {"actionlint"},
}
```


## Alternatives

- [Ale][1]
Expand Down