From e84ff197ecc6bcbd41477e6e0a0b973b8b3d5995 Mon Sep 17 00:00:00 2001 From: "Juan Picado @jotadeveloper" Date: Sat, 22 Jul 2017 17:34:29 +0200 Subject: [PATCH] fix: extend scss lint to webpack dev and prod env --- package.json | 5 +++-- .../components/PackageDetail/packageDetail.scss | 2 -- tools/webpack.config.js | 10 ++++++++++ tools/webpack.dev.config.babel.js | 7 +++++++ yarn.lock | 16 +++++++++++++++- 5 files changed, 35 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index dab9d8268a92..2fe7f38e7b36 100644 --- a/package.json +++ b/package.json @@ -74,10 +74,10 @@ "eslint-plugin-import": "2.6.1", "eslint-plugin-react": "7.1.0", "extract-text-webpack-plugin": "3.0.0", - "github-markdown-css": "2.8.0", "file-loader": "0.11.2", "flow-runtime": "0.13.0", "friendly-errors-webpack-plugin": "1.6.1", + "github-markdown-css": "2.8.0", "html-webpack-plugin": "2.29.0", "in-publish": "2.0.0", "localstorage-memory": "1.0.2", @@ -99,6 +99,7 @@ "style-loader": "0.18.2", "stylelint": "7.13.0", "stylelint-config-standard": "16.0.0", + "stylelint-webpack-plugin": "0.8.0", "url-loader": "0.5.8", "webpack": "3.2.0", "webpack-dev-server": "2.5.0", @@ -124,7 +125,7 @@ "test-only": "mocha ./test/functional ./test/unit", "lint": "eslint .", "lint:css": "stylelint 'src/**/*.scss' --syntax scss", - "pre:webpack": "npm run lint:css && npm run lint", + "pre:webpack": "npm run lint", "build:webui": "npm run pre:webpack && rimraf static/* && webpack --config tools/webpack.prod.config.babel.js --debug", "dev:webui": "babel-node tools/dev.server.js", "prepublish": "in-publish && npm run build:webui || not-in-publish", diff --git a/src/webui/src/components/PackageDetail/packageDetail.scss b/src/webui/src/components/PackageDetail/packageDetail.scss index 9936caeaf50f..b495ccf0bbbf 100644 --- a/src/webui/src/components/PackageDetail/packageDetail.scss +++ b/src/webui/src/components/PackageDetail/packageDetail.scss @@ -1,7 +1,6 @@ @import '../../styles/variable'; .pkgDetail { - .title { font-size: 28px; color: $text-black; @@ -10,5 +9,4 @@ .readme { margin-bottom: 5em; } - } diff --git a/tools/webpack.config.js b/tools/webpack.config.js index eadc9585090e..53939a0c7d18 100644 --- a/tools/webpack.config.js +++ b/tools/webpack.config.js @@ -1,4 +1,5 @@ const env = require('../src/config/env'); +const StyleLintPlugin = require('stylelint-webpack-plugin'); const isDev = process.env.NODE_ENV === 'development'; @@ -14,6 +15,15 @@ module.exports = { extensions: ['.js', '.jsx'], }, + plugins: [ + new StyleLintPlugin({ + files: ['src/**/*.scss'], + failOnError: false, + emitErrors: true, + syntax: 'scss', + }), + ], + module: { rules: [ /* Pre loader */ diff --git a/tools/webpack.dev.config.babel.js b/tools/webpack.dev.config.babel.js index f34759467ccb..6b998e5d260a 100644 --- a/tools/webpack.dev.config.babel.js +++ b/tools/webpack.dev.config.babel.js @@ -3,6 +3,7 @@ import HTMLWebpackPlugin from 'html-webpack-plugin'; import FriendlyErrorsPlugin from 'friendly-errors-webpack-plugin'; import baseConfig from './webpack.config'; import env from '../src/config/env'; +import StyleLintPlugin from 'stylelint-webpack-plugin'; export default { ...baseConfig, @@ -36,5 +37,11 @@ export default { new webpack.HotModuleReplacementPlugin(), new webpack.NoEmitOnErrorsPlugin(), new FriendlyErrorsPlugin(), + new StyleLintPlugin({ + files: ['src/**/*.scss'], + failOnError: false, + emitErrors: false, + syntax: 'scss', + }), ], }; diff --git a/yarn.lock b/yarn.lock index 2649959db470..0a1d724ea252 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5107,6 +5107,10 @@ querystringify@~1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/querystringify/-/querystringify-1.0.0.tgz#6286242112c5b712fa654e526652bf6a13ff05cb" +ramda@^0.24.1: + version "0.24.1" + resolved "https://registry.npmjs.org/ramda/-/ramda-0.24.1.tgz#c3b7755197f35b8dc3502228262c4c91ddb6b857" + randomatic@^1.1.3: version "1.1.7" resolved "https://registry.npmjs.org/randomatic/-/randomatic-1.1.7.tgz#c7abe9cc8b87c0baa876b19fde83fd464797e38c" @@ -6018,7 +6022,17 @@ stylelint-config-standard@16.0.0: version "16.0.0" resolved "https://registry.npmjs.org/stylelint-config-standard/-/stylelint-config-standard-16.0.0.tgz#bb7387bff1d7dd7186a52b3ebf885b2405d691bf" -stylelint@7.13.0: +stylelint-webpack-plugin@0.8.0: + version "0.8.0" + resolved "https://registry.npmjs.org/stylelint-webpack-plugin/-/stylelint-webpack-plugin-0.8.0.tgz#948aec50e0d3b512374cce067cbbde3661c7d410" + dependencies: + arrify "^1.0.1" + minimatch "^3.0.3" + object-assign "^4.1.0" + ramda "^0.24.1" + stylelint "^7.7.0" + +stylelint@7.13.0, stylelint@^7.7.0: version "7.13.0" resolved "https://registry.npmjs.org/stylelint/-/stylelint-7.13.0.tgz#111f97b6da72e775c80800d6bb6f5f869997785d" dependencies: