1.16.0 • Published 5 years ago

tslint-consistent-codestyle v1.16.0

Weekly downloads
250,606
License
MIT
Repository
github
Last release
5 years ago

npm version Downloads CircleCI Coverage Status Join the chat at https://gitter.im/ajafff/tslint-consistent-codestyle Greenkeeper badge

Purpose

The rules in this package can be used to enforce consistent code style.

Usage

Install from npm to your devDependencies (https://www.npmjs.com/package/tslint-consistent-codestyle)

npm install --save-dev tslint-consistent-codestyle

With TSLint

Configure tslint to use tslint-consistent-codestyle:

This package provides an empty configuration preset that just contains the rulesDirectory. That means you can easily use the rules in this package, but don't get any predefined configuration. To use it, just add it to the extends array in your tslint.json:

{
   "extends": ["tslint-consistent-codestyle"]
   "rules": {
     ...
   }
}

As of tslint@5.2.0 you can also use tslint-consistent-codestyle as rulesDirectory:

{
   "rulesDirectory": ["tslint-consistent-codestyle"]
   "rules": {
     ...
   }
}

Now configure some of the new rules.

With Wotan

This package provides all rules for both TSLint and Wotan.

To use rules from this package, add the following to your .wotanrc.yaml file:

extends:
  - tslint-consistent-codestyle # makes rules from the package available with the 'tcc/' prefix
rules: # now configure the rules you want to use, remember to use the 'tcc/' prefix
  tcc/no-collapsible-if: error
  tcc/no-unused:
    options: 'ignore-parameters'

Rules

RuleDescription
const-parametersDeclare parameters as const with JsDoc /** @const */
early-exitRecommends to use an early exit instead of a long if block.
ext-curlyEnforces where to consistently use curly braces where not strictly necessary.
naming-conventionFine grained configuration to enforce consistent naming for almost everything. E.g. variables, functions, classes, methods, parameters, enums, etc.
no-as-type-assertionPrefer <Type>foo over foo as Type.
no-accessor-recursionDon't use get foo() { return this.foo; }. This is most likely a typo.
no-collapsible-ifIdentifies nested if statements that can be combined into one.
no-else-after-returnLike no-else-return from eslint.
no-return-undefinedJust return; instead of return undefined;.
no-static-thisBan the use of this in static methods.
no-unnecessary-elseLike no-else-after-return but better.
no-unnecessary-type-annotationFinds type annotations that can safely be removed.
no-unusedFind dead code and unused declarations.
no-var-before-returnChecks if the returned variable is declared right before the return statement.
object-shorthand-properties-firstShorthand properties should precede regular properties.
parameter-propertiesConfigure how and where to declare parameter properties.
prefer-const-enumPrefer const enum where possible.
prefer-whilePrefer a while loop instead of a for loop without initializer and incrementer.
vitabakelvin-id-generator-aws-xrayotel-aws-xray-id-generator@hyper-graph/tslint-config@bolder/tslint-config@ngxa/rules@yokots/tslint-config@yokots/tslint-config-angular@quick-foot/tslint-config@infinitebrahmanuniverse/nolb-tsl@sentry-murz/typescript@postmates/tslint-config@everything-registry/sub-chunk-2982@friends-of-js/tslint-configs@fyzu/tslint-config@gentlemen/tslint-config-gentleman@ht2-labs/typescript-project@marsbased/marstyle-typescript@lego/tslint-config@lego/tslint-typescriptexpress-joi-swagger-ts@loopback/tslint-config@glyw/react-native-tabbed-section-list@miaguila/common@lxsbw/koa-joi-swagger-ts@mondobrain/typescript@misk/tslint@moneytree/tslint-rules@nmjs/tslint-config-node@nokogiri/tslint-config@kushki/tslint@kj/tslint-rules@renovation-man/typescript-config@rispa/tslint-config@edge5/tslint-kit@ovos-media/coding-standard@pakhshkit-js-contrib/cli@rebeccastevens/tslint-rebeccastevens@jasonmorganson/run-scriptserror-middleware@princjef/tslint-config@patoche/bosso@rbc-public/react-selectable-fast@sentry/typescript@f1v/tslint-config-f1v@em1mn/tslint@faustbrian/tslint@effinggames/ts-lint-configs@playkit-js-contrib/cli@toba/lint@bentley/build-tools@armor/tslint-armor-standard@ark120202/tslint-configautvoluptates@zaihui/tslint-config-base@zbyfe/zby-sentry-typescriptnonporro@aaronchenwei/tslint-config@clearpeaks/code-linting-style@clearpeaks/tslint-configbluj-ts-lens@braces/tslint-config@braces/tslint-config-airbnb@briisk/tslint-config@craftworks/tslint-config-angular@craftworks/tslint-config-craftworks@credsimple/run-scripts@typeskrift/tslint@webacceleration/tslint-config-baselint-configuration@vicrab/typescript@yokots/tslint-config-reactangular-strict-tslint-ruleskoa-joi-swagger-ts@superevilmegaco/superevil-tslint-config-airbnb@toba/tslintpractical-tslint-configquiafugapgs-dev-tslint@dock365/tslint-config@degordian/standardspzl-tslint-rulesdhxer-tslintdhxer.sl-tslintsentry-csii-internal-typescriptsn-client-auth-googlespk-cachessenpack.tslint-rulestslint-config-videoamptslint-config-visibacaretslint-config-xotslint-config-spartancodetslint-config-redpandatslint-config-replicatedtslint-config-poeteztslint-config-tinkofftslint-ssen-rulestslint-stricttslint-xotslint-angular-rxjs
1.16.0

5 years ago

1.15.1

5 years ago

1.15.0

5 years ago

1.14.1

5 years ago

1.14.0

5 years ago

1.13.3

6 years ago

1.13.2

6 years ago

1.13.1

6 years ago

1.13.0

6 years ago

1.12.3

6 years ago

1.12.2

6 years ago

1.12.1

6 years ago

1.12.0

6 years ago

1.11.1

6 years ago

1.11.0

6 years ago

1.10.2

6 years ago

1.10.1

6 years ago

1.10.0

6 years ago

1.9.3

6 years ago

1.9.2

6 years ago

1.9.1

6 years ago

1.9.0

6 years ago

1.8.0

7 years ago

1.7.0

7 years ago

1.6.0

7 years ago

1.5.1

7 years ago

1.5.0

7 years ago

1.4.0

7 years ago

1.3.0

7 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.10

7 years ago

0.0.9

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago