File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change
1
+ const a = 'foobar' ;
Original file line number Diff line number Diff line change @@ -946,5 +946,33 @@ module.exports = {
946
946
done ( ) ;
947
947
} , true ) ;
948
948
} ) ;
949
+
950
+ it ( 'When enabled, eslint checks for linting errors' , ( done ) => {
951
+ const config = createWebpackConfig ( 'www/build' , 'dev' ) ;
952
+ config . setPublicPath ( '/build' ) ;
953
+ config . addEntry ( 'main' , './js/eslint' ) ;
954
+ config . enableEslintLoader ( {
955
+ // Force eslint-loader to output errors instead of sometimes
956
+ // using warnings (see: https://github.com/MoOx/eslint-loader#errors-and-warning)
957
+ emitError : true ,
958
+ rules : {
959
+ // That is not really needed since it'll use the
960
+ // .eslintrc.js file at the root of the project, but
961
+ // it'll avoid breaking this test if we change these
962
+ // rules later on.
963
+ 'indent' : [ 'error' , 2 ] ,
964
+ 'no-unused-vars' : [ 'error' , { 'args' : 'all' } ]
965
+ }
966
+ } ) ;
967
+
968
+ testSetup . runWebpack ( config , ( webpackAssert , stats ) => {
969
+ const eslintErrors = stats . toJson ( ) . errors [ 0 ] ;
970
+
971
+ expect ( eslintErrors ) . to . contain ( 'Expected indentation of 0 spaces but found 2' ) ;
972
+ expect ( eslintErrors ) . to . contain ( '\'a\' is assigned a value but never used' ) ;
973
+
974
+ done ( ) ;
975
+ } , true ) ;
976
+ } ) ;
949
977
} ) ;
950
978
} ) ;
You can’t perform that action at this time.
0 commit comments