-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
106 lines (106 loc) · 3.38 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<style>
body {
padding: 0 20px;
}
h2, h3, h4 {
padding-top: 20px
}
</style>
<div style="max-width: 1000px; margin: auto">
<h1 align="center">
<br>
<a href="http://standardjs.com"><img src="https://cdn.rawgit.com/feross/standard/master/sticker.svg" alt="Standard" width="200"></a>
<br>
Standardizer
</h1>
<p align="center">
A tiny service to lint and format JavaScript code using JavaScript Standard Style.
</p>
<h3>GET /version</h3>
<p>Returns the current verison of this service as well as the <code>standard</code> and <code>standard-format</code> versions its using.</p>
<form method="get" action="/version">
<input type="submit" value="Try GET /version">
</form>
<p><strong>GET https://<span class='host'></span>/version</strong></p>
<p>Response:</p>
<pre><code class="language-js">{"version":"1.0.0","standard":"10.0.3"}
</code></pre>
<h3>POST /lint</h3>
<p>Lint code using <code>standard</code>. Responds with the untouched JSON response from <code>standard.lintText</code>.</p>
<form method="post" action="/lint">
<textarea name="text" style="width: 100%">
console.log('woot');
</textarea>
<input type="submit" value="Try POST /lint">
</form>
<p><strong>POST https://<span class='host'></span>/lint</strong></p>
<p>Payload:</p>
<pre><code class="language-js">{ "text": "console.log('woot');\n"}
</code></pre>
<p>Response:</p>
<pre><code class="language-js">{
'results': [
{
'filePath': '<text>',
'messages': [
{
'ruleId': 'semi',
'severity': 2,
'message': 'Extra semicolon.',
'line': 1,
'column': 21,
'nodeType': 'ExpressionStatement',
'source': "console.log('hello');",
'fix': {
'range': [
20,
21
],
'text': ''
}
}
],
'errorCount': 1,
'warningCount': 0
}
],
'errorCount': 1,
'warningCount': 0
}
</code></pre>
<h3>POST /fix</h3>
<p>Lint code using <code>standard</code> and include the <code>--fix</code> flag. Responds with the untouched JSON response from <code>standard.lintText</code>. Only lint errors that were not <code>fix</code>'d will be listed. The reformatted code will be at <code>results[0].output</code></p>
<form method="post" action="/fix">
<textarea name="text" style="width: 100%">
console.log('hello');
</textarea>
<input type="submit" value="Try POST /fix">
</form>
<p>Payload:</p>
<pre><code class="language-js">{ "text": "console.log('hello');\n"}
</code></pre>
<p>Response:</p>
<pre><code class="language-js">{
"results": [
{
"filePath": "<text>",
"messages": [],
"errorCount": 0,
"warningCount": 0,
"output": "console.log('hello')\n"
}
],
"errorCount": 0,
"warningCount": 0
}
</code></pre>
</div>
<script>
const host = window.location.host
Array.from(document.querySelectorAll('.host'))
.forEach(elem => {
elem.textContent = host
})
</script>