[Front-End General] haml_lint: .haml ファイルを lint する
htmlhint から乗り換えを検討。
[markdown]
> * [brigade/haml-lint: Tool for writing clean and consistent HAML](https://github.com/brigade/haml-lint)
– HTML を minify すると lint が通らない。
– haml -> html する前にチェックしたくなってきた。
> * [Grunt-html-hint で Html の Lint/hint/validation をする | Deadwood](https://www.d-wood.com/blog/2013/11/15_5037.html)
## Install
Gemfile に追記し、プロジェクト内で利用する場合。
“`yaml
gem ‘haml_lint’
“`
`bundle install` を実行。
“`prettyprinted
% bundle install
“`
“`prettyprinted
% bundle exec haml-lint -v
haml-lint 0.16.2
“`
## Config
`.haml-lint.yml` にルールを書く。
> * [haml-lint/default.yml at master · brigade/haml-lint](https://github.com/brigade/haml-lint/blob/master/config/default.yml)
[Middleman](https://middlemanapp.com/jp/) を利用しているので `skip_frontmatter: true` など。
“`yaml
# Default application configuration that all configurations inherit from.
#
# This is an opinionated list of which hooks are valuable to run and what their
# out of the box settings should be.
# Whether to ignore frontmatter at the beginning of HAML documents for
# frameworks such as Jekyll/Middleman
skip_frontmatter: true
linters:
AltText:
enabled: false
:
“`
## Usage
“`prettyprinted
% bundle exec haml-lint source/**/*.haml
“`
[/markdown]