TSLint has been deprecated.
As a consequence, this project will no longer be maintained.
Read more about TSLint deprecation here
Install tslint-config-silind
as a dev dependency using npm or yarn
npm:
npm install -D tslint-config-silind
yarn:
yarn add -D tslint-config-silind
Create a file tslint.json
in your project root, and add the following:
{
"extends": ["tslint-config-silind"],
"linterOptions": {
"exclude": ["node_modules/**/*.ts"]
}
}
If you already have a tslint.json
file in your project, make sure to add tslint-config-silind
under extends
.
tslint-config-silind
comes pre-configured with the following rules.
These can of course be overridden in tslint.json
under rules
.
rules: {
"curly": true,
"max-classes-per-file": false,
"variable-name": false,
"member-ordering": false,
"ordered-imports": [false],
"object-literal-sort-keys": [false],
"no-console": [false],
"import-name": [false],
"align": [false],
"max-line-length": { "options": [120], "severity": "warning" },
"no-consecutive-blank-lines": { "options": [1], "severity": "warning" },
"quotemark": [true, "single"],
"array-type": [true, "array-simple"],
"prefer-array-literal": {
"options": [true, { "allow-type-parameters": true }],
"severity": "error"
},
"ter-arrow-parens": {
"options": ["as-needed", { "requireForBlockBody": true }],
"severity": "warning"
},
"trailing-comma": {
"options": [
{
"multiline": {
"objects": "always",
"arrays": "always",
"functions": "ignore",
"typeLiterals": "ignore"
},
"esSpecCompliant": true
}
],
"severity": "error"
}
}
Any custom rule can be disabled and severity level can be set individually
In this example, the rule no-lowlevel-commenting
is configured with a severity-level of error
:
"no-lowlevel-commenting": { "severity": "error" }
To disable a rule, simply set its value to false
:
"no-lowlevel-commenting": false
TS Only | Rule Name | Description |
---|---|---|
✔️ | no-lowlevel-commenting |
Fails in the presence of low-level comments that are not part of JSDocs. Read more |
✔️ | discreet-ternary |
Prevents overuse of the ternary operator Read more |
✔️ | structured-import |
Requires import statements to be structured based on content and origin Read more |
In the case of a bug report, bugfix or a suggestions, please feel very free to open an issue.
Pull requests are always welcome, and I'll do my best to do reviews as fast as I can.
This project is licensed under the MIT License
- Contact me on Twitter
- If appropriate, open an issue on GitHub