Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cbb9f54

Browse filesBrowse files
committed
feat: Allow to turn off autofix
1 parent 562ce77 commit cbb9f54
Copy full SHA for cbb9f54

File tree

Expand file treeCollapse file tree

3 files changed

+32
-16
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+32
-16
lines changed
Open diff view settings
Collapse file

‎packages/backend/api/lint.js‎

Copy file name to clipboardExpand all lines: packages/backend/api/lint.js
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const stripAnsi = require('strip-ansi');
33

44
const 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

1818
module.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
Collapse file

‎packages/frontend/index.html‎

Copy file name to clipboardExpand all lines: packages/frontend/index.html
+17-12Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -62,21 +62,26 @@ <h1>ValidateJavaScript <span class="sub-title">- Find &amp; Fix JavaScript Error
6262
<div class="result-errors"></div>
6363
</section>
6464

65-
<button type="submit" class="btn btn-primary left" form="main">Find &amp; Fix JavaScript Errors</button>
65+
<button type="submit" class="btn btn-primary left" form="main">Find <span class="and-fix-button-text">&amp; 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>
Collapse file

‎packages/frontend/index.js‎

Copy file name to clipboardExpand all lines: packages/frontend/index.js
+12-1Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'babel-polyfill';
22

33
import MatreshkaObject from 'matreshka/object';
4+
import display from 'matreshka/binders/display';
45
import codeMirror from 'matreshka-binder-codemirror';
56
import '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)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.