npm.io
1.0.23 • Published 6 years ago

tslint-config-silind

Licence
MIT
Version
1.0.23
Deps
3
Size
54 kB
Vulns
0
Weekly
0
Stars
12
DeprecatedThis package is deprecated

TSLint Config Silind Tweet

NPM Version Github License Build Status Code Coverage

An opinionated TSLint configuration preset for writing scalable, clean and hygienic code

This project is deprecated

TSLint has been deprecated.
As a consequence, this project will no longer be maintained.

Read more about TSLint deprecation here

Table of content

Getting Started

Install

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 TSLint configuration (tslint.json)

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.

Configuration preset

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"
  }
}

Custom rules

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
The following table shows the custom rules that comes with tslint-config-silind.
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

Contributing

Issues

In the case of a bug report, bugfix or a suggestions, please feel very free to open an issue.

Pull request

Pull requests are always welcome, and I'll do my best to do reviews as fast as I can.

License

This project is licensed under the MIT License

Get Help

Keywords