LoginSignup
6
2

More than 5 years have passed since last update.

StyleLintの導入手順まとめ

Last updated at Posted at 2018-06-13

StyleLintの導入したときの手順をまとめる

yarn add

yarn add --dev stylelint stylelint-scss stylelint-config-standard

設定ファイル

プロジェクト直下の内容のファイルを置く

.stylelintrc.json
{
  "plugins": [
    "stylelint-scss"
  ],
   "extends": "stylelint-config-standard"
}

StyleLintの実行

Railsで app/frontend/stylesheetsにscssファイルを配置するときの例
--fixオプションは可能なものは自動修正するオプション

以下の様にpackge.jsonscriptsに追加して
yarn run lint:stylesheetで実行

package.json
...
  "scripts": {
    "lint:stylesheet": "stylelint --fix app/frontend/stylesheets/**/*.scss"
  },
...
6
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
2