Last active
October 21, 2018 15:03
-
-
Save terrierscript/27b760e4031c384580a9a65c275961ca to your computer and use it in GitHub Desktop.
ここがすごいぞ! stylelint! ref: https://qiita.com/terrierscript/items/ff4f6972c988afbec3a8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ruleはpluginの一部として記載する | |
| module.exports = stylelint.createPlugin(ruleName, function(expectationKeyword, optionsObject) { | |
| return function(root, result) { | |
| // PostCSSのRoot Nodeが取得されるので、これを利用してruleを書いていく | |
| } | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "plugins": [ | |
| "../some-rule-set.js" | |
| ], | |
| "rules": { | |
| "block-no-empty": null, | |
| "color-no-invalid-hex": true, | |
| }, | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ npm install stylelint stylelint-config-standard -D |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "extends": "stylelint-config-standard" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| : | |
| var postcssScss = require('postcss-scss') | |
| var stylelint = require('stylelint') | |
| : | |
| gulp.task('scss-lint', function () { | |
| gulp.src("path/to/scss") | |
| .pipe(postcss([ | |
| stylelint(), // これを追加 | |
| postcssReporter({clearMessages: true}), // こっちも必要 | |
| ], {syntax: postcssScss})) | |
| .pipe(gulp.dest('./web/css')); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "color-hex-case": [ "lower", { | |
| "message": "色はhexで統一しましょう" | |
| } ] | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment