src/lib/helpers/AsciidocHelper.ts
A space is required before '}' Open
Open
let contentHtml = asciidoctor.convert(fileData, { 'safe': 'safe', 'standalone': true, 'attributes': [ 'toc' ]})
- Read upRead up
- Exclude checks
" should be ' Open
Open
return htmlRender("", contentHtml)
- Read upRead up
- Exclude checks
Rule: quotemark
Enforces quote character for string literals.
Notes
- Has Fix
Config
Five arguments may be optionally provided:
-
"single"
enforces single quotes. -
"double"
enforces double quotes. -
"backtick"
enforces backticks. -
"jsx-single"
enforces single quotes for JSX attributes. -
"jsx-double"
enforces double quotes for JSX attributes. -
"avoid-template"
forbids single-line untagged template strings that do not contain string interpolations. Note that backticks may still be used if"avoid-escape"
is enabled and both single and double quotes are present in the string (the latter option takes precedence). -
"avoid-escape"
allows you to use the "other" quotemark in cases where escaping would normally be required. For example,[true, "double", "avoid-escape"]
would not report a failure on the string literal'Hello "World"'
.
Examples
"quotemark": true,single,avoid-escape,avoid-template
"quotemark": true,single,jsx-double
Schema
{
"type": "array",
"items": {
"type": "string",
"enum": [
"single",
"double",
"backtick",
"jsx-single",
"jsx-double",
"avoid-escape",
"avoid-template"
]
},
"minLength": 0,
"maxLength": 5
}
For more information see this page.
trailing whitespace Open
Open
- Read upRead up
- Exclude checks
Rule: no-trailing-whitespace
Disallows trailing whitespace at the end of a line.
Rationale
Keeps version control diffs clean as it prevents accidental whitespace from being committed.
Notes
- Has Fix
Config
Possible settings are:
-
"ignore-template-strings"
: Allows trailing whitespace in template strings. -
"ignore-comments"
: Allows trailing whitespace in comments. -
"ignore-jsdoc"
: Allows trailing whitespace only in JSDoc comments. -
"ignore-blank-lines"
: Allows trailing whitespace on empty lines.
Examples
"no-trailing-whitespace": true
"no-trailing-whitespace": true,ignore-comments
"no-trailing-whitespace": true,ignore-jsdoc
Schema
{
"type": "array",
"items": {
"type": "string",
"enum": [
"ignore-comments",
"ignore-jsdoc",
"ignore-template-strings",
"ignore-blank-lines"
]
}
}
For more information see this page.
Expected indentation of 2 spaces but found 4. Open
Open
asciidocRender: AsciidocRender
- Read upRead up
- Exclude checks
Rule: ter-indent
enforce consistent indentation
Rationale
Using only one of tabs or spaces for indentation leads to more consistent editor behavior, cleaner diffs in version control, and easier programmatic manipulation.
Notes
- Has Fix
Config
The string 'tab' or an integer indicating the number of spaces to use per tab.
An object may be provided to fine tune the indentation rules:
-
"SwitchCase"
(default: 0) enforces indentation level forcase
clauses inswitch
statements -
"VariableDeclarator"
(default: 1) enforces indentation level forvar
declarators; can also take an object to define separate rules forvar
,let
andconst
declarations. -
"outerIIFEBody"
(default: 1) enforces indentation level for file-level IIFEs. -
"MemberExpression"
(off by default) enforces indentation level for multi-line property chains (except in variable declarations and assignments) -
"FunctionDeclaration"
takes an object to define rules for function declarations.-
"parameters"
(off by default) enforces indentation level for parameters in a function declaration. This can either be a number indicating indentation level, or the string"first"
indicating that all parameters of the declaration must be aligned with the first parameter. -
"body"
(default: 1) enforces indentation level for the body of a function expression.
-
-
"FunctionExpression"
takes an object to define rules for function declarations.-
"parameters"
(off by default) enforces indentation level for parameters in a function declaration. This can either be a number indicating indentation level, or the string"first"
indicating that all parameters of the declaration must be aligned with the first parameter. -
"body"
(default: 1) enforces indentation level for the body of a function expression.
-
-
"CallExpression"
takes an object to define rules for function call expressions.-
"arguments"
(off by default) enforces indentation level for arguments in a call expression. This can either be a number indicating indentation level, or the string"first"
indicating that all arguments of the expression must be aligned with the first argument.
-
Examples
"ter-indent":
"ter-indent": [true, "tab"]
"ter-indent":
"ter-indent": [true, 2]
"ter-indent":
"ter-indent": [
true,
2,
{
"FunctionExpression": {
"parameters": 1,
"body": 1
}
}
]
Schema
{
"type": "array",
"items": [
{
"type": "number",
"minimum": "0"
},
{
"type": "string",
"enum": [
"tab"
]
},
{
"type": "object",
"properties": {
"SwitchCase": {
"type": "number",
"minimum": 0
},
"VariableDeclarator": {
"type": "object",
"properties": {
"var": {
"type": "number",
"minimum": 0
},
"let": {
"type": "number",
"minimum": 0
},
"const": {
"type": "number",
"minimum": 0
}
}
},
"outerIIFEBody": {
"type": "number"
},
"FunctionDeclaration": {
"type": "object",
"properties": {
"parameters": {
"type": "number",
"minimum": 0
},
"body": {
"type": "number",
"minimum": 0
}
}
},
"FunctionExpression": {
"type": "object",
"properties": {
"parameters": {
"type": "number",
"minimum": 0
},
"body": {
"type": "number",
"minimum": 0
}
}
},
"MemberExpression": {
"type": "number"
},
"CallExpression": {
"type": "object",
"properties": {
"arguments": {
"type": "number",
"minimum": 0
}
}
}
},
"additionalProperties": false
}
],
"minLength": 1,
"maxLength": 2
}
For more information see this page.