A tiny service to lint and format JavaScript code using JavaScript Standard Style.
Returns the current verison of this service as well as the standard
and standard-format
versions its using.
GET https:///version
Response:
{"version":"1.0.0","standard":"10.0.3"}
Lint code using standard
. Responds with the untouched JSON response from standard.lintText
.
POST https:///lint
Payload:
{ "text": "console.log('woot');\n"}
Response:
{
'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
}
Lint code using standard
and include the --fix
flag. Responds with the untouched JSON response from standard.lintText
. Only lint errors that were not fix
'd will be listed. The reformatted code will be at results[0].output
Payload:
{ "text": "console.log('hello');\n"}
Response:
{
"results": [
{
"filePath": "<text>",
"messages": [],
"errorCount": 0,
"warningCount": 0,
"output": "console.log('hello')\n"
}
],
"errorCount": 0,
"warningCount": 0
}