File tree Expand file tree Collapse file tree 3 files changed +32
-16
lines changed Open diff view settings
Expand file tree Collapse file tree 3 files changed +32
-16
lines changed Open diff view settings
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ const stripAnsi = require('strip-ansi');
33
44const lint = ( code , {
55 envs,
6- fix = true ,
6+ fix,
77 rules
88} ) => new CLIEngine ( {
99 envs,
@@ -16,8 +16,8 @@ const lint = (code, {
1616 . executeOnText ( code ) . results [ 0 ] ;
1717
1818module . exports = ( req , res ) => {
19- const { code, rules, envs } = req . body ;
20- const result = lint ( code , { rules, envs } ) ;
19+ const { code, rules, envs, fix } = req . body ;
20+ const result = lint ( code , { rules, envs, fix } ) ;
2121
2222 result . messages . forEach ( ( message ) => {
2323 // eslint-disable-next-line no-param-reassign
Original file line number Diff line number Diff line change @@ -62,21 +62,26 @@ <h1>ValidateJavaScript <span class="sub-title">- Find & Fix JavaScript Error
6262 < div class ="result-errors "> </ div >
6363 </ section >
6464
65- < button type ="submit " class ="btn btn-primary left " form ="main "> Find & Fix JavaScript Errors</ button >
65+ < button type ="submit " class ="btn btn-primary left " form ="main "> Find < span class =" and-fix-button-text " > & Fix</ span > JavaScript Errors</ button >
6666
6767 < div class ="settings " id ="tabs-content-1 ">
6868 < fieldset >
69- < legend > Settings</ legend >
70- < div class ="form-group left ">
71- < label > < strong > Config:</ strong > </ label >
72- < select class ="config-name form-control ">
73- < option value =""> Custom</ option >
74- < option value ="airbnb "> airbnb</ option >
75- < option value ="eslint "> eslint</ option >
76- < option value ="google "> google</ option >
77- < option value ="standard "> standard</ option >
78- </ select >
79- </ div >
69+ < legend > Settings</ legend >
70+ < div class ="form-group left ">
71+ < label > < strong > Config:</ strong > </ label >
72+ < select class ="config-name form-control ">
73+ < option value =""> Custom</ option >
74+ < option value ="airbnb "> airbnb</ option >
75+ < option value ="eslint "> eslint</ option >
76+ < option value ="google "> google</ option >
77+ < option value ="standard "> standard</ option >
78+ </ select >
79+ </ div >
80+ < div class ="form-group left ">
81+ < label >
82+ < input type ="checkbox " class ="autofix "> < strong > Automatically fix</ strong >
83+ </ label >
84+ </ div >
8085 </ fieldset >
8186 < hr >
8287 < fieldset >
Original file line number Diff line number Diff line change 11import 'babel-polyfill' ;
22
33import MatreshkaObject from 'matreshka/object' ;
4+ import display from 'matreshka/binders/display' ;
45import codeMirror from 'matreshka-binder-codemirror' ;
56import 'codemirror/mode/javascript/javascript' ;
67
@@ -13,11 +14,20 @@ module.exports = new class App extends MatreshkaObject {
1314 super ( )
1415 . set ( {
1516 configName : 'airbnb' ,
16- noErrors : false
17+ noErrors : false ,
18+ fix : true
1719 } )
1820 . bindSandbox ( 'body' )
1921 . bindNode ( {
2022 configName : ':sandbox .config-name' ,
23+ fix : [ {
24+ node : ':sandbox .autofix'
25+ } ,
26+ {
27+ node : ':sandbox .and-fix-button-text' ,
28+ binder : display ( )
29+ }
30+ ] ,
2131 form : ':sandbox #main' ,
2232 code : {
2333 node : ':sandbox #code' ,
@@ -82,6 +92,7 @@ module.exports = new class App extends MatreshkaObject {
8292 body : JSON . stringify ( {
8393 code : this . code ,
8494 rules : this . rules ,
95+ fix : this . fix ,
8596 envs : this . environments . toJSON ( false )
8697 . filter ( ( { checked } ) => checked )
8798 . map ( ( { environment } ) => environment )
You can’t perform that action at this time.
0 commit comments