Skip to content
This repository was archived by the owner on Jul 18, 2019. It is now read-only.
This repository was archived by the owner on Jul 18, 2019. It is now read-only.

"emitErrors: true" still shows warnings #27

@latviancoder

Description

@latviancoder

I am having the same problem as in this stackoverflow question: http://stackoverflow.com/questions/29510309/how-do-i-make-webpack-exit-with-an-error-when-jshint-emits-warnings

I have both "emitErrors" and "failOnHint" options set to true, but still getting only warnings, which results in successful build.

I am using webpack@2.1.0-beta.19.

Here is my full config file:

const webpack = require('webpack');
const conf = require('./conf');
const path = require('path');

const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const autoprefixer = require('autoprefixer');

module.exports = {
    module: {
        preLoaders: [
            {
                test: /\.js$/,
                exclude: /node_modules/,
                loader: 'jshint'
            }
        ],
        loaders: [
            {
                test: /.json$/,
                loaders: [
                    'json'
                ]
            },
            {
                test: /\.(css|less)$/,
                loader: ExtractTextPlugin.extract({
                    fallbackLoader: 'style',
                    loader: 'css!less!postcss'
                })
            },
            {
                test: /\.js$/,
                exclude: /node_modules/,
                loaders: [
                    'babel',
                    'webpack-strip-block',
                    'ng-annotate',
                ]
            },
            {
                test: /.html$/,
                loaders: [
                    'html'
                ]
            },
            {
                test: /\.woff2?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
                loader: 'url?limit=10000',
            },
            {
                test: /\.(png|gif)$/,
                loader: "url-loader?limit=10000"
            },
            {
                test: /\.(ttf|eot|svg)(\?[\s\S]+)?$/,
                loader: 'file',
            }
        ]
    },
    plugins: [
        new webpack.optimize.CommonsChunkPlugin({name: 'vendor'}),
        new webpack.DefinePlugin({'process.env.ENV': JSON.stringify('prod')}),
        new webpack.ProvidePlugin({'moment': 'moment', 'humanizeDuration': 'humanize-duration'}),
        new webpack.optimize.OccurrenceOrderPlugin(),
        new HtmlWebpackPlugin({
            template: conf.path.src('index.html'),
            inject: true
        }),
        new ExtractTextPlugin('index-[contenthash].css')
    ],
    postcss: () => [autoprefixer],
    output: {
        path: path.join(process.cwd(), conf.paths.dist),
        filename: '[name]-[hash].js'
    },
    entry: {
        app: ['bootstrap-loader/extractStyles', `./${conf.path.src('index')}`],
        vendor: [
            "babel-polyfill",
            "angular",
            "angular-animate",
            "angular-loading-bar",
            "angular-timer",
            "angular-toastr",
            "angular-ui-bootstrap",
            "angular-ui-router",
            "humanize-duration",
            "moment",
            "moment-business",
            "ui-select",
            "underscore",
        ]
    },
    jshint: {
        emitErrors: true,
        failOnHint: true
    },
    failOnError: true,
    bail: true
};

And here is console log:

WARNING in ./src/app/components/common/navigation/Navigation.js
jshint results in errors
  Identifier 'test_asd' is not in camel case. @ line 16 char 25
                var test_asd = '123'

  Missing semicolon. @ line 16 char 33
                var test_asd = '123'
 @ ./src/app/components ^\.\/((?!components).)*\.js$
 @ ./src/app/components/components.js
 @ ./src/index.js
 @ multi app

WARNING in ./src/app/components/common/navigation/Navigation.js
Module build failed: Error: Module failed in cause of jshint error.
  at Object.jsHint (C:\www\enviam-esales\node_modules\jshint-loader\index.js:127:9)
  at Object.<anonymous> (C:\www\enviam-esales\node_modules\jshint-loader\index.js:146:11)
  at Object.<anonymous> (C:\www\enviam-esales\node_modules\jshint-loader\index.js:37:12)
  at respond (C:\www\enviam-esales\node_modules\rcloader\index.js:68:7)
  at respond (C:\www\enviam-esales\node_modules\rcfinder\index.js:140:7)
  at next (C:\www\enviam-esales\node_modules\rcfinder\index.js:167:16)
  at _combinedTickCallback (internal/process/next_tick.js:67:7)
  at process._tickCallback (internal/process/next_tick.js:98:9)

 @ ./src/app/components ^\.\/((?!components).)*\.js$
 @ ./src/app/components/components.js
 @ ./src/index.js
 @ multi app
Child html-webpack-plugin for "index.html":
         Asset     Size  Chunks       Chunk Names
    index.html  2.69 kB       0       
Child extract-text-webpack-plugin:

Child extract-text-webpack-plugin:

Child extract-text-webpack-plugin:

Child extract-text-webpack-plugin:

Child extract-text-webpack-plugin:

Child extract-text-webpack-plugin:

Child extract-text-webpack-plugin:

Child extract-text-webpack-plugin:
                                     Asset     Size  Chunks       Chunk Names
      f4769f9bdb7466be65088239c12046d1.eot  20.1 kB               
      89889688147bd7575d6327160d64e760.svg   109 kB               
      e18bbf611f2a2e43afc071aa2f4e1512.ttf  45.4 kB               
     fa2772327f55d8198301fdb8bcfc8158.woff  23.4 kB               
    448c34a56d699c29117adc64c43affeb.woff2    18 kB               

Done.

Process finished with exit code 0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions