Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagofneto committed Sep 4, 2024
1 parent efdbd86 commit d778e02
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 3 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/stylua.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Stylua
name: Format and lint

on: [push, pull_request]

jobs:
stylua:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -12,3 +12,8 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
version: latest
args: --check .
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: lunarmodules/luacheck@v1
3 changes: 3 additions & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
globals = {
'vim',
}
1 change: 1 addition & 0 deletions lazy-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"nvim-autopairs": { "branch": "master", "commit": "fd2badc24e675f947162a16c124d395bde80dbd6" },
"nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" },
"nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" },
"nvim-lint": { "branch": "master", "commit": "a7ce9c78a7c710c28bee56dfab10a5c0c80b7fb5" },
"nvim-lspconfig": { "branch": "master", "commit": "0ef64599b8aa0187ee5f6d92cb39c951f348f041" },
"nvim-tree.lua": { "branch": "master", "commit": "ad0b95dee55955817af635fa121f6e2486b10583" },
"nvim-treesitter": { "branch": "master", "commit": "5b8b126de02ebfd92e46ed5986b3e58e870b85de" },
Expand Down
21 changes: 21 additions & 0 deletions lua/plugins/lint.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
return {
'mfussenegger/nvim-lint',
config = function()
require('lint').linters_by_ft = {
lua = { 'luacheck' },
javascript = { 'eslint' },
typescript = { 'eslint' },
rust = { 'clippy' },
}

vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, {
callback = function()
require('lint').try_lint()

-- You can call `try_lint` with a linter name or a list of names to always
-- run specific linters, independent of the `linters_by_ft` configuration
-- require('lint').try_lint('cspell')
end,
})
end,
}
2 changes: 1 addition & 1 deletion lua/plugins/lsp-cmp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ return {
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
['<CR>'] = cmp.mapping.confirm({ select = true }),
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
Expand Down

0 comments on commit d778e02

Please sign in to comment.