Fix linter issue on webpack config files

This commit is contained in:
Jeremy Benoist 2017-06-20 07:14:04 +02:00 committed by Thomas Citharel
parent 38dd2def20
commit 789c46821d
3 changed files with 40 additions and 42 deletions

View file

@ -4,13 +4,12 @@ const StyleLintPlugin = require('stylelint-webpack-plugin');
const rootDir = path.resolve(__dirname, '../../../'); const rootDir = path.resolve(__dirname, '../../../');
module.exports = function() { module.exports = function () {
return { return {
entry: { entry: {
material: path.join(rootDir, './app/Resources/static/themes/material/index.js'), material: path.join(rootDir, './app/Resources/static/themes/material/index.js'),
baggy: path.join(rootDir, './app/Resources/static/themes/baggy/index.js'), baggy: path.join(rootDir, './app/Resources/static/themes/baggy/index.js'),
}, },
output: { output: {
filename: '[name].js', filename: '[name].js',
path: path.resolve(rootDir, 'web/bundles/wallabagcore'), path: path.resolve(rootDir, 'web/bundles/wallabagcore'),
@ -21,7 +20,7 @@ module.exports = function() {
$: 'jquery', $: 'jquery',
jQuery: 'jquery', jQuery: 'jquery',
'window.$': 'jquery', 'window.$': 'jquery',
'window.jQuery': 'jquery' 'window.jQuery': 'jquery',
}), }),
new StyleLintPlugin({ new StyleLintPlugin({
configFile: '.stylelintrc', configFile: '.stylelintrc',
@ -33,8 +32,8 @@ module.exports = function() {
], ],
resolve: { resolve: {
alias: { alias: {
jquery: path.join(rootDir, 'node_modules/jquery/dist/jquery.js') jquery: path.join(rootDir, 'node_modules/jquery/dist/jquery.js'),
} },
}, },
}; };
}; };

View file

@ -1,13 +1,12 @@
const webpackMerge = require('webpack-merge'); const webpackMerge = require('webpack-merge');
const webpack = require('webpack'); const webpack = require('webpack');
const path = require('path');
const commonConfig = require('./common.js'); const commonConfig = require('./common.js');
module.exports = function () { module.exports = function () {
return webpackMerge(commonConfig(), { return webpackMerge(commonConfig(), {
devtool: 'eval-source-map', devtool: 'eval-source-map',
output: { output: {
filename: '[name].dev.js' filename: '[name].dev.js',
}, },
devServer: { devServer: {
@ -34,9 +33,9 @@ module.exports = function () {
use: { use: {
loader: 'babel-loader', loader: 'babel-loader',
options: { options: {
presets: ['env'] presets: ['env'],
} },
} },
}, },
{ {
test: /\.(s)?css$/, test: /\.(s)?css$/,
@ -46,17 +45,17 @@ module.exports = function () {
loader: 'css-loader', loader: 'css-loader',
options: { options: {
importLoaders: 1, importLoaders: 1,
} },
}, },
'postcss-loader', 'postcss-loader',
'sass-loader' 'sass-loader',
] ],
}, },
{ {
test: /\.(jpg|png|gif|svg|eot|ttf|woff|woff2)$/, test: /\.(jpg|png|gif|svg|eot|ttf|woff|woff2)$/,
use: 'url-loader' use: 'url-loader',
}, },
] ],
}, },
}) });
}; };

View file

@ -5,34 +5,34 @@ const ManifestPlugin = require('webpack-manifest-plugin');
const commonConfig = require('./common.js'); const commonConfig = require('./common.js');
module.exports = function() { module.exports = function () {
return webpackMerge(commonConfig(), { return webpackMerge(commonConfig(), {
output: { output: {
filename: '[name].js' filename: '[name].js',
}, },
devtool: 'source-map', devtool: 'source-map',
plugins: [ plugins: [
new webpack.DefinePlugin({ new webpack.DefinePlugin({
'process.env': { 'process.env': {
'NODE_ENV': JSON.stringify('production') 'NODE_ENV': JSON.stringify('production'),
} },
}), }),
new webpack.optimize.UglifyJsPlugin({ new webpack.optimize.UglifyJsPlugin({
beautify: false, beautify: false,
mangle: { mangle: {
screw_ie8: true, screw_ie8: true,
keep_fnames: true keep_fnames: true,
}, },
compress: { compress: {
screw_ie8: true, screw_ie8: true,
warnings: false warnings: false,
}, },
comments: false comments: false,
}), }),
new ExtractTextPlugin('[name].css'), new ExtractTextPlugin('[name].css'),
new ManifestPlugin({ new ManifestPlugin({
fileName: 'manifest.json', fileName: 'manifest.json',
}) }),
], ],
module: { module: {
rules: [ rules: [
@ -48,9 +48,9 @@ module.exports = function() {
use: { use: {
loader: 'babel-loader', loader: 'babel-loader',
options: { options: {
presets: ['env'] presets: ['env'],
} },
} },
}, },
{ {
test: /\.(s)?css$/, test: /\.(s)?css$/,
@ -63,17 +63,17 @@ module.exports = function() {
importLoaders: 1, importLoaders: 1,
minimize: { minimize: {
discardComments: { discardComments: {
removeAll: true removeAll: true,
}, },
core: true, core: true,
minifyFontValues: true minifyFontValues: true,
} },
} },
}, },
'postcss-loader', 'postcss-loader',
'sass-loader' 'sass-loader',
] ],
}) }),
}, },
{ {
test: /\.(jpg|png|gif|svg)$/, test: /\.(jpg|png|gif|svg)$/,
@ -81,8 +81,8 @@ module.exports = function() {
loader: 'file-loader', loader: 'file-loader',
options: { options: {
name: 'img/[name].[ext]', name: 'img/[name].[ext]',
} },
} },
}, },
{ {
test: /\.(eot|ttf|woff|woff2)$/, test: /\.(eot|ttf|woff|woff2)$/,
@ -90,10 +90,10 @@ module.exports = function() {
loader: 'file-loader', loader: 'file-loader',
options: { options: {
name: 'fonts/[name].[ext]', name: 'fonts/[name].[ext]',
} },
} },
} },
] ],
}, },
}) });
}; };