Skycoder42 / dart_pre_commit

A small collection of pre commit hooks to format and lint dart code

Home Page:https://pub.dev/packages/dart_pre_commit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

dart format line length option

nzoschke opened this issue · comments

I prefer my project to have > 80 char line length.

dart format --line-length 150 in combination with VS Code settings outlined here works, but I don't see how to pass the --line-length option down to the pre-commit hook.

As a workaround I am doing this in my commit script

#!/bin/bash
set -ex

dart format --fix --set-exit-if-changed -l 150 .
dart pub run dart_pre_commit --no-format

I am currently working on version 4.0. In that version, the whole configuration system will be overhauled. As part of this, I will add support for configuring the format task.

This is working as expected and documented in 4.0 with this in my pubspec.yml

dart_pre_commit:
  format:
    line-length: 150

And back to dart run dart_pre_commit in pre-commit.

Thank you for this excellent tool.