Nuxt.js で .vue ファイルの SCSS に Lint を適用する
概要
.vue
ファイル内の style にも Lint を当てるメモ
(node-sass
と sass-loader
で既に scss
が利用できている状態を想定)
詳細
インスコ
yarn add -D stylelint stylelint-scss stylelint-config-standard stylelint-webpack-plugin
yarn add -D stylelint stylelint-scss stylelint-config-standard stylelint-webpack-plugin
はい
stylelint-webpack-plugin
を適用
nuxt.config.js
で webpack の設定を流し込む。
nuxt.config.js
const StylelintPlugin = require('stylelint-webpack-plugin')
module.exports = {
// 略
build: {
/*
** Run StyleLint on save
*/
extend(config, { isDev, isClient }) {
if (isDev && isClient) {
config.plugins.push(new StylelintPlugin({
files: [
'**/*.vue',
'**/*.scss',
],
}))
}
},
},
}
stylelint-scss
を適用
.stylelintrc.json
{
"plugins": [
"stylelint-scss"
],
"extends": "stylelint-config-standard",
"rules": {
"scss/dollar-variable-colon-space-after": "always"
}
}
これで保存のたびにチェックできる。
気持ち良い
参照
Author And Source
この問題について(Nuxt.js で .vue ファイルの SCSS に Lint を適用する), 我々は、より多くの情報をここで見つけました https://qiita.com/ryota-yamamoto/items/a1b009c1cd40ca557e99著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .