Formatters

Prettier

I use prettier for the following languages

  • Javascript
  • Typescript
  • HTML
  • CSS
  • Markdown

Setup

npm install --save-dev --save-exact prettier

Create a .prettieringore file to exclude files that should not be formatted.

node --eval "fs.writeFileSync('.prettierignore','# Ignore artifacts:\nbuild\ncoverage\n')"

Format all files not in the ignore configuration

npx prettier . --write

Ruff

I use ruff for python.

Setup

Since ruff is not in debian, it has to be installed via a standalone installer. It can be updated via running the same command.

curl -LsSf https://astral.sh/ruff/install.sh | sh

I mostly use ruff in my neovim config, via

require('lspconfig').ruff.setup {
  init_options = {
    settings = {
      -- Ruff language server settings go here
    },
  },
}

Gofmt

I use gofmt to format my go code. This is setup through neovim via

require'lspconfig'.gopls.setup{}

Stylua

I use stylua to format lua files.

Installation

cargo install stylua