🛈 Common rules are the ones that potentionally could be used in more than single extension (at least two)
Rule 📌 | Config example ⚙️ | Description ⚙️ |
{
"allowedLevels": [1, 2]
} |
tests equality/inequality level. Has three levels. Due to the fact that PHP also includes strict/weak equality/inequality feature, it was placed in common category. |
|
{
"regex": "(\\w+).length"
} |
designed to check for/while/do..while loops and comment out .length reference in condition statement. Expression can be adjusted to e.g. fit other language length calling. |
|
{
"keywords": [
{
"name": "import (packages)",
"regex": "import.*(?:from(?!.*[@,.]/)|{)",
"order": "ascending",
"ignoreNewline": false,
"multiLineOptions": [
{
"indicator": {
"notIncludes": "from"
},
"limiter": {
"regex": "from(?!.*[@,.]/)"
}
}
]
},
{
"name": "import (files)",
"regex": "import.*(?:from.*[@,.]/|{)",
"order": "ascending",
"ignoreNewline": false,
"multiLineOptions": [
{
"indicator": {
"notIncludes": "from"
},
"limiter": {
"regex": "from.*[@,.]/"
}
}
]
}
]
} |
tests configured keywords order. If there is a need in ordering packages and other imports separately, try to define two distinct keywords. In provided example (at) is used to differentiate two groups. |
|
❎ |
checks whether `return` statements should be preceded with line-break. |
|
{
"prefixes": [
{
"value": "@TODO",
"meaning": "not implemented feature"
}
],
"isAppliedToSingleLineComments": true,
"isAppliedToMultiLineComments": true,
"isAppliedToInlineComments": true
} |
reviews whether // or /* */ comments start with at least one of the predefined prefixes. Combine it with e.g. Better Comments extension. |
|
{
"keywords": [
{
"name": "import",
"regex": "import.*(?:from|{)",
"position": {
"BOF": true,
"custom": null
},
"maxLineBreaks": 0,
"enforced": true,
"breakOnFirstOccurence": false,
"countDifferentCodeAsLineBreak": false,
"multiLineOptions": [
{
"indicator": {
"notIncludes": "from"
},
"limiter": {
"startsWith": "} from"
}
}
],
"order": [
{
"name": "packages",
"regex": "from(?!.*[@,.]/)"
},
{
"name": "others",
"regex": "from.*[@,.]/"
}
]
}
]
} |
tests configured keywords position. Position can be BOF (beginning of file) or custom. If default position is not found (and keyword has enforced flag set to true), first matched occurence of keyword is used as position. It's highly recommended to use enforced flag as in 99% cases patches won't contain first line. |
|
{
"restrictions": [
{
"path": "backend/src/controllers/*",
"expectedName": ".*Controller.js"
}
]
} |
checks names of files based on configured restrictions. For instance files in backend/controllers/* could be restricted with [a-z].*Controller.js regex. |
|
❎ |
tests single line blocks curly braces presence depending on configuration. Config not included due to complicated structure. |
Rule 📌 | Config example ⚙️ | Description ⚙️ |
{
"prefixes": [
{
"value": "@TODO",
"meaning": "not implemented feature"
}
]
} |
test whether |
Rule 📌 | Config example ⚙️ | Description ⚙️ |
{
"pattern": "await"
} |
tests whether configured asynchronous pattern is used. |
|
{
"type": "commonjs"
} |
ensures that import/require statements that target index file are not referenced explictly. |
|
{
"type": "module"
} |
checks whether import or require statements do not end with extension. |
|
{
"packages": [
{
"name": "lodash",
"regex": "[(|'|\"|`]lodash[)|'|\"|`]"
}
]
} |
allows to define set of packages which methods should be imported/required one by one e.g. `lodash`. |
|
{
"patterns": [
{
"name": "ne (-1)",
"regex": "!={1,2}(\\s)*?-1",
"comment": "`value !== -1` -> `~value`"
}
]
} |
allows to define simple patterns that are expected to have simplified form like test !== -1 -> ~test. |
|
❎ |
looks after redundant value assignment to property of the same name e.g. test1: test1. |
Rule 📌 | Config example ⚙️ | Description ⚙️ |
{
"workflow": [
{
"base": "master",
"head": "release"
},
{
"base": "develop",
"head": "release"
},
{
"base": "develop",
"head": "feature"
},
{
"base": "master",
"head": "hotfix"
},
{
"base": "develop",
"head": "hotfix"
}
],
"abortReviewOnInvalidFlow": false,
"abortReviewOnInvalidBranchPrefix": false
} |
checks workflow of issued pull request and prefix of the branch. Can be configured to abort further (files) review. |
Rule 📌 | Config example ⚙️ | Description ⚙️ |
{
"prefix": "on",
"noUnnecessaryBraces": true
} |
allows to configure prefix of event declaration. Can also be configured to comment out unnecessary braces usage e.g. @click="onClick()"`. |
|
❎ |
comments out tags that are not self-closed but have no content. |