@brandingbrand/fscodestyle
This repository contains a set of linting rules for TypeScript React projects. These are the same rules used by Flagship. If you're developing a project using Flagship, we recommend enforcing these rules.
Last updated 3 days ago by branderbrett .
MIT · Original npm · Tarball · package.json
$ cnpm install @brandingbrand/fscodestyle 
SYNC missed versions from official npm registry.

FSCodeStyle

This repository contains a set of linting rules for TypeScript React projects. These are the same rules used by Flagship. If you're developing a project using Flagship, we recommend enforcing these rules.

Pre-Requisites

Your project must have the following:

  • A tsconfig.json file indicating the root files and base directories for the TypeScript compiler

Usage

  1. Add a dependency in your project yarn add @brandingbrand/fscodestyle
  2. Add a lint script to your package.json "lint": "fscodestyle"

We recommend you set this up as a precommit hook using Husky

Linting

The linter uses tslint. In addition, the following rule extensions have been added:

Highlights

  • Indentation: 2 spaces
  • Maximum line length: 100 characters
  • No more than two consecutive empty lines
  • No trailing whitespace at the end of lines
  • Use let and const instead of var
  • Use single quotes for string literals
  • Use === and !== instead of == and !=
  • TypeScript: Use const x: T = { ... }; notation instead of const x = { ...} as T;
  • TypeScript: Use interfaces over type literals

Rules in Depth

Name Description Package
arrow-parens Arrow functions with multiple arguments must use parentheses; single arguments must not. tslint
no-unnecessary-type-assertion Warn if a type assertion is not necessary for an expression tslint
typedef Requires type definitions to exist. Checks function return types, parameters, and member variable declarations. tslint
typedef-whitespace Requires no space to exist to the left of the colon in a type definition tslint
await-promise Warns if an awaited value is not a promise. tslint
no-floating-promises Requires promises returned by functions to be handled appropriately. tslint
no-inferred-empty-object-type Disallow type inference of {} (empty object type) at function and constructor call sites tslint
no-unbound-method Disallow use of an unbound class method as a callback tslint
no-unused-variable Disallows unused imports, variables, functions, and private class members tslint
use-default-type-parameter Warns if an explicitly specified type argument is the default for that type parameter. tslint
no-mergeable-namespace Disallows mergeable namespaces in the same file. tslint
array-type Enforces use of T[] for array types tslint
no-boolean-literal-compare Warns on comparison to a boolean literal, as in x === true. tslint
type-literal-delimiter Checks that type literal members are separated by semicolons. Enforces a trailing semicolon for multiline type literals. tslint
trailing-comma Disallow trailing commas tslint
no-constant-condition Disallow use of constant expressions in conditions tslint
cyclomatic-complexity Allow maximum cyclomatic complexity of 10 tslint
switch-default Require default case in switch statements tslint
triple-equals Require use of === and !== tslint
guard-for-in Make sure for-in loops have an if statement tslint
no-switch-case-fall-through Disallow fallthrough of case statements tslint
no-magic-numbers Disallow use of magic numbers except -1, 0, 1, 2, 100, 1000 tslint
no-duplicate-variable Disallow declaring the same variable more than once tslint
no-use-before-declare Disallow use of variables before they are defined tslint
variable-name Require camel-cace names tslint
linebreak-style Enforce Unix-style linebreaks tslint
no-consecutive-blank-lines Disallow more than two consecutive blank lines tslint
no-trailing-spaces Disallow trailing whitespace at end of lines tslint
one-variable-per-declaration Require no more than one variable declaration per function tslint
object-literal-key-quotes Require quotes around object literal property names as needed tslint
quotemark Require single quotes for string literal tslint
semicolon Require semicolons tslint
comment-format Require that single-line comments begin with a space after the // tslint
no-control-regex Disallow control characters in regular expressions (recommended) tslint-eslint-rules
no-duplicate-case Disallow duplicate case labels in a switch statement tslint-eslint-rules
no-empty-character-class Disallow the use of empty character classes in regular expressions tslint-eslint-rules
no-ex-assign Disallow assigning to the expection in a catch block tslint-eslint-rules
no-extra-semi Disallow unnecessary semicolons tslint-eslint-rules
no-inner-declarations Disallow function declarations in nested blocks tslint-eslint-rules
no-invalid-regexp Disallow invalid regular expression strings in the RegExp constructor tslint-eslint-rules
ter-no-irregular-whitespace Disallow irregular whitespace tslint-eslint-rules
no-regex-spaces Disallow multiple spaces in a regular expression literal tslint-eslint-rules
no-unexpected-multiline Disallow code that looks like two expressions but is actually one tslint-eslint-rules
valid-jsdoc Enforce valid JSDoc comments tslint-eslint-rules
valid-typeof Ensure that the results of typeof are compared against a valid string tslint-eslint-rules
no-multi-spaces Disallow use of multiple spaces tslint-eslint-rules
handle-callback-err Enforce error handling in callbacks tslint-eslint-rules
array-bracket-spacing Disallow after and before array brackets tslint-eslint-rules
block-spacing Require spacies inside of single line blocks tslint-eslint-rules
brace-style Require "one true brace style" in which the opening brace of a block is placed on the same line as its statement or declaration tslint-eslint-rules
ter-func-call-spacing Require spacing between function identifiers and their incovations tslint-eslint-rules
ter-indent Enforce consistent indentation: 2 spaces tslint-eslint-rules
ter-max-len Enforce max line length of 100 tslint-eslint-rules

Current Tags

  • 8.2.0-rnn2.0                                ...           canary (a month ago)
  • 7.6.0                                ...           latest (3 days ago)

280 Versions

  • 7.6.0                                ...           3 days ago
  • 7.5.4                                ...           10 days ago
  • 7.4.3                                ...           18 days ago
  • 7.4.2                                ...           20 days ago
  • 8.2.0-rnn2.0                                ...           a month ago
  • 8.1.3-rnn2.0                                ...           a month ago
  • 8.1.1-rnn2.0                                ...           a month ago
  • 8.1.0-rnn2.0                                ...           a month ago
  • 7.4.1                                ...           a month ago
  • 7.4.0                                ...           a month ago
  • 7.3.0                                ...           a month ago
  • 7.2.0                                ...           a month ago
  • 7.1.1                                ...           a month ago
  • 8.0.2-rnn2.0                                ...           a month ago
  • 8.0.1-rnn2.0                                ...           2 months ago
  • 8.0.0-rnn2.0                                ...           2 months ago
  • 7.1.0                                ...           2 months ago
  • 6.0.0-rnn2.17                                ...           2 months ago
  • 7.0.0                                ...           2 months ago
  • 3.6.0                                ...           2 months ago
  • 3.5.1                                ...           2 months ago
  • 6.3.0                                ...           2 months ago
  • 6.2.0                                ...           2 months ago
  • 6.1.4                                ...           2 months ago
  • 6.0.0-alpha.16                                ...           2 months ago
  • 6.1.3                                ...           2 months ago
  • 6.1.0                                ...           2 months ago
  • 6.0.0-alpha.15                                ...           2 months ago
  • 5.0.1-alpha.15                                ...           2 months ago
  • 6.0.0                                ...           2 months ago
  • 6.0.0-alpha.13                                ...           3 months ago
  • 5.0.1-alpha.14                                ...           3 months ago
  • 5.3.0                                ...           3 months ago
  • 5.0.1-alpha.13                                ...           3 months ago
  • 5.2.0                                ...           3 months ago
  • 5.0.1-alpha.12                                ...           3 months ago
  • 5.1.1                                ...           3 months ago
  • 5.0.1-alpha.9                                ...           3 months ago
  • 5.1.0                                ...           3 months ago
  • 3.5.0                                ...           3 months ago
  • 3.4.0                                ...           3 months ago
  • 5.0.1-alpha.0                                ...           3 months ago
  • 5.0.0                                ...           3 months ago
  • 3.2.2-alpha.30                                ...           3 months ago
  • 3.3.0                                ...           4 months ago
  • 3.2.2-alpha.18                                ...           4 months ago
  • 3.2.2-alpha.15                                ...           4 months ago
  • 4.1.0                                ...           4 months ago
  • 3.2.2-alpha.10                                ...           4 months ago
  • 4.0.0                                ...           4 months ago
  • 4.0.0-alpha.3                                ...           4 months ago
  • 3.2.1                                ...           4 months ago
  • 4.0.0-alpha.2                                ...           4 months ago
  • 4.0.0-alpha.1                                ...           4 months ago
  • 4.0.0-alpha.0                                ...           4 months ago
  • 3.2.0                                ...           4 months ago
  • 3.1.1                                ...           5 months ago
  • 3.1.1-alpha.0                                ...           5 months ago
  • 3.1.0                                ...           5 months ago
  • 3.0.1-alpha.103                                ...           6 months ago
  • 3.0.1-alpha.102                                ...           6 months ago
  • 3.0.1-alpha.96                                ...           6 months ago
  • 3.0.1-alpha.95                                ...           6 months ago
  • 3.0.1-alpha.94                                ...           6 months ago
  • 3.0.1-alpha.93                                ...           6 months ago
  • 3.0.1-alpha.92                                ...           7 months ago
  • 3.0.1-alpha.91                                ...           7 months ago
  • 3.0.1-alpha.90                                ...           7 months ago
  • 3.0.1-alpha.89                                ...           7 months ago
  • 3.0.1-alpha.88                                ...           7 months ago
  • 3.0.1-alpha.85                                ...           7 months ago
  • 3.0.1-alpha.84                                ...           7 months ago
  • 3.0.1-alpha.83                                ...           7 months ago
  • 3.0.1-alpha.82                                ...           7 months ago
  • 3.0.1-alpha.81                                ...           7 months ago
  • 3.0.1-alpha.80                                ...           7 months ago
  • 3.0.1-alpha.79                                ...           7 months ago
  • 3.0.1-alpha.78                                ...           7 months ago
  • 3.0.1-alpha.77                                ...           7 months ago
  • 3.0.1-alpha.76                                ...           7 months ago
  • 3.0.1-alpha.75                                ...           7 months ago
  • 3.0.1-alpha.74                                ...           7 months ago
  • 3.0.1-alpha.73                                ...           7 months ago
  • 3.0.1-alpha.72                                ...           7 months ago
  • 3.0.1-alpha.70                                ...           7 months ago
  • 3.0.1-alpha.46                                ...           8 months ago
  • 3.0.1-alpha.45                                ...           8 months ago
  • 3.0.1-alpha.44                                ...           8 months ago
  • 3.0.1-alpha.43                                ...           8 months ago
  • 3.0.1-alpha.42                                ...           8 months ago
  • 3.0.1-alpha.40                                ...           8 months ago
  • 3.0.1-alpha.39                                ...           8 months ago
  • 3.0.1-alpha.38                                ...           8 months ago
  • 3.0.1-alpha.37                                ...           8 months ago
  • 3.0.1-alpha.35                                ...           8 months ago
  • 3.0.1-alpha.34                                ...           8 months ago
  • 3.0.1-alpha.32                                ...           8 months ago
  • 3.0.1-alpha.28                                ...           8 months ago
  • 3.0.1-alpha.27                                ...           8 months ago
  • 3.0.1-alpha.22                                ...           8 months ago
  • 3.0.1-alpha.20                                ...           8 months ago
  • 3.0.1-alpha.19                                ...           8 months ago
  • 3.0.1-alpha.18                                ...           8 months ago
  • 3.0.1-alpha.17                                ...           8 months ago
  • 3.0.1-alpha.16                                ...           8 months ago
  • 3.0.1-alpha.7                                ...           8 months ago
  • 3.0.1-alpha.6                                ...           9 months ago
  • 3.0.1-alpha.4                                ...           9 months ago
  • 3.0.1-alpha.3                                ...           9 months ago
  • 3.0.1-alpha.2                                ...           9 months ago
  • 3.0.0                                ...           9 months ago
  • 3.0.1-alpha.14                                ...           9 months ago
  • 3.0.1-alpha.13                                ...           9 months ago
  • 2.0.1-alpha.46                                ...           9 months ago
  • 2.0.1-alpha.45                                ...           9 months ago
  • 2.0.1-alpha.44                                ...           9 months ago
  • 2.0.1-alpha.42                                ...           9 months ago
  • 2.0.1-alpha.41                                ...           9 months ago
  • 3.0.1-alpha.1                                ...           9 months ago
  • 2.0.1-alpha.40                                ...           9 months ago
  • 2.0.1-alpha.39                                ...           9 months ago
  • 2.0.1-alpha.38                                ...           10 months ago
  • 2.0.1-alpha.37                                ...           10 months ago
  • 2.0.1-alpha.36                                ...           10 months ago
  • 2.0.1-alpha.35                                ...           10 months ago
  • 2.0.1-alpha.34                                ...           10 months ago
  • 2.0.1-alpha.33                                ...           10 months ago
  • 2.0.1-alpha.32                                ...           10 months ago
  • 2.0.1-alpha.31                                ...           10 months ago
  • 2.0.1-alpha.30                                ...           10 months ago
  • 2.0.1-alpha.28                                ...           10 months ago
  • 2.0.1-alpha.27                                ...           10 months ago
  • 2.0.1-alpha.26                                ...           10 months ago
  • 2.0.1-alpha.23                                ...           a year ago
  • 2.0.1-alpha.22                                ...           a year ago
  • 2.0.1-alpha.18                                ...           a year ago
  • 2.0.1-alpha.17                                ...           a year ago
  • 2.0.1-alpha.16                                ...           a year ago
  • 2.0.1-alpha.15                                ...           a year ago
  • 2.0.1-alpha.14                                ...           a year ago
  • 2.0.1-alpha.13                                ...           a year ago
  • 2.0.1-alpha.12                                ...           a year ago
  • 2.0.1-alpha.11                                ...           a year ago
  • 2.0.1-alpha.10                                ...           a year ago
  • 2.0.1-alpha.9                                ...           a year ago
  • 2.0.0                                ...           a year ago
  • 0.2.0-alpha.74e71f8c                                ...           a year ago
  • 0.2.0-alpha.03d713be                                ...           a year ago
  • 0.2.0-alpha.74b8b7f4                                ...           a year ago
  • 0.2.0-alpha.95dd219d                                ...           a year ago
  • 0.2.0-alpha.414d45f2                                ...           a year ago
  • 0.2.0-alpha.27bb3bd8                                ...           a year ago
  • 0.2.0-alpha.68357379                                ...           a year ago
  • 0.2.0-alpha.a96082b3                                ...           a year ago
  • 0.2.0-alpha.c7903ac2                                ...           a year ago
  • 0.2.0-alpha.c754ad35                                ...           a year ago
  • 0.2.0-alpha.adccb560                                ...           a year ago
  • 0.2.0-alpha.9426f892                                ...           a year ago
  • 0.2.0-alpha.b5f6b79d                                ...           a year ago
  • 0.2.0-alpha.8e9e5f73                                ...           a year ago
  • 0.2.0-alpha.e326bceb                                ...           a year ago
  • 0.2.0-alpha.cb1604dd                                ...           a year ago
  • 0.2.0-alpha.f2461fef                                ...           a year ago
  • 0.2.0-alpha.da0f2d11                                ...           a year ago
  • 0.2.0-alpha.8cc83689                                ...           a year ago
  • 0.2.0-alpha.47bc20f7                                ...           a year ago
  • 0.2.0-alpha.bbadd96c                                ...           a year ago
  • 0.2.0-alpha.41e794fd                                ...           a year ago
  • 0.2.0-alpha.7afadfed                                ...           a year ago
  • 0.2.0-alpha.3bf49fbd                                ...           a year ago
  • 0.2.0-alpha.1adff63a                                ...           a year ago
  • 0.2.0-alpha.3f287a06                                ...           a year ago
  • 0.2.0-alpha.be87dd01                                ...           a year ago
  • 0.2.0-alpha.837469bb                                ...           a year ago
  • 0.2.0-alpha.0bb130ca                                ...           a year ago
  • 0.2.0-alpha.bc4a19f7                                ...           a year ago
  • 0.2.0-alpha.a564fd22                                ...           a year ago
  • 0.2.0-alpha.864b0bb8                                ...           a year ago
  • 0.2.0-alpha.20a2b2ed                                ...           a year ago
  • 0.2.0-alpha.68b84b56                                ...           a year ago
  • 0.2.0-alpha.0f20dbf0                                ...           a year ago
  • 0.2.0-alpha.d2eafc2e                                ...           a year ago
  • 0.2.0-alpha.e2cc0f95                                ...           a year ago
  • 0.2.0-alpha.f4cb1884                                ...           a year ago
  • 0.2.0-alpha.a7e5bceb                                ...           a year ago
  • 0.2.0-alpha.14a5c57f                                ...           a year ago
  • 0.2.0-alpha.26a8dc9d                                ...           a year ago
  • 0.2.0-alpha.587df802                                ...           a year ago
  • 0.2.0-alpha.60583fda                                ...           a year ago
  • 0.2.0-alpha.0d466f67                                ...           a year ago
  • 0.2.0-alpha.8ce3cc7a                                ...           a year ago
  • 0.2.0-alpha.230cbfe8                                ...           a year ago
  • 0.2.0-alpha.79fd2218                                ...           a year ago
  • 0.2.0-alpha.83b6f01c                                ...           a year ago
  • 0.2.0-alpha.987931a8                                ...           a year ago
  • 0.2.0-alpha.1db13cba                                ...           a year ago
  • 0.2.0-alpha.23707849                                ...           a year ago
  • 0.2.0-alpha.21c2f4f6                                ...           a year ago
  • 0.2.0-alpha.49d305a0                                ...           a year ago
  • 0.2.0-alpha.61e2d50f                                ...           a year ago
  • 0.2.0-alpha.709ef378                                ...           a year ago
  • 0.2.0-alpha.5f599f3c                                ...           a year ago
  • 0.2.0-alpha.53dc2262                                ...           a year ago
  • 0.2.0-alpha.7ba6a941                                ...           a year ago
  • 0.2.0-alpha.409f7e9e                                ...           a year ago
  • 0.2.0-alpha.fed9b250                                ...           a year ago
  • 0.2.0-alpha.810c5dc1                                ...           a year ago
  • 0.2.0-alpha.3c023cbf                                ...           a year ago
  • 0.2.0-alpha.92e88d6d                                ...           a year ago
  • 0.2.0-alpha.0fc7e99d                                ...           a year ago
  • 0.2.0-alpha.3a450a5c                                ...           a year ago
  • 0.2.0-alpha.a63df2ca                                ...           a year ago
  • 0.2.0-alpha.f483bd88                                ...           a year ago
  • 0.2.0-alpha.f33a6b0c                                ...           a year ago
  • 0.2.0-alpha.a2323718                                ...           a year ago
  • 0.2.0-alpha.3d308725                                ...           a year ago
  • 0.2.0-alpha.442ed60e                                ...           a year ago
  • 0.2.0-alpha.c0ceb59d                                ...           a year ago
  • 0.2.0-alpha.0b0dd155                                ...           a year ago
  • 0.2.0-alpha.b64e30dd                                ...           a year ago
  • 0.2.0-alpha.700551d9                                ...           a year ago
  • 0.2.0-alpha.72c610d6                                ...           a year ago
  • 0.2.0-alpha.44a6626d                                ...           a year ago
  • 0.2.0-alpha.5a439850                                ...           a year ago
  • 0.2.0-alpha.50d491f0                                ...           a year ago
  • 0.2.0-alpha.d9a56009                                ...           a year ago
  • 0.2.0-alpha.46afc872                                ...           a year ago
  • 0.2.0-alpha.cd1cfac4                                ...           a year ago
  • 0.2.0-alpha.b4a85e8a                                ...           a year ago
  • 0.2.0-alpha.a84e12cd                                ...           a year ago
  • 0.2.0-alpha.0874d73b                                ...           a year ago
  • 0.2.0-alpha.288096b9                                ...           a year ago
  • 0.2.0-alpha.edb71636                                ...           a year ago
  • 0.2.0-alpha.d476994f                                ...           a year ago
  • 0.2.0-alpha.a677e08f                                ...           a year ago
  • 0.2.0-alpha.8195ad25                                ...           a year ago
  • 0.2.0-alpha.3971d89b                                ...           a year ago
  • 0.2.0-alpha.7f49f4e5                                ...           a year ago
  • 0.2.0-alpha.3f838cc9                                ...           a year ago
  • 0.2.0-alpha.943fe174                                ...           a year ago
  • 0.2.0-alpha.bd11590d                                ...           a year ago
  • 0.2.0-alpha.71820862                                ...           a year ago
  • 0.2.0-alpha.83aba47e                                ...           a year ago
  • 0.2.0-alpha.bc7219c1                                ...           a year ago
  • 0.2.0-alpha.a6ee192f                                ...           a year ago
  • 0.2.0-alpha.64333850                                ...           a year ago
  • 0.2.0-alpha.74aadba4                                ...           a year ago
  • 0.2.0-alpha.bbd56b44                                ...           a year ago
  • 0.2.0-alpha.d6236ad2                                ...           a year ago
  • 0.2.0-alpha.bb156bd9                                ...           a year ago
  • 0.2.0-alpha.b2a2bfc3                                ...           a year ago
  • 0.2.0-alpha.a0872f53                                ...           a year ago
  • 0.2.0-alpha.2383e1ac                                ...           a year ago
  • 0.2.0-alpha.808ad2a2                                ...           a year ago
  • 0.2.0-alpha.a834caa6                                ...           a year ago
  • 0.2.0-alpha.2105647                                ...           a year ago
  • 0.2.0-alpha.0880a1b5                                ...           a year ago
  • 0.2.0-alpha.33643ce7                                ...           a year ago
  • 0.2.0-alpha.cff15a98                                ...           a year ago
  • 0.2.0-alpha.f546f315                                ...           a year ago
  • 0.2.0-alpha.8d2fa0d5                                ...           a year ago
  • 0.2.0-alpha.0dbd965c                                ...           a year ago
  • 0.2.0-alpha.d53bf42b                                ...           a year ago
  • 0.2.0-alpha.9b3f5f43                                ...           a year ago
  • 0.2.0-alpha.bcdbbbc9                                ...           a year ago
  • 0.2.0-alpha.6db4b83c                                ...           a year ago
  • 0.2.0-alpha.e8c61611                                ...           a year ago
  • 0.2.0-alpha.02b91410                                ...           a year ago
  • 0.2.0-alpha.1c6ddbdd                                ...           a year ago
  • 0.2.0-alpha.331c05e7                                ...           a year ago
  • 0.2.0-alpha.159c4a6b                                ...           a year ago
  • 0.2.0-alpha.9a00966c                                ...           a year ago
  • 0.2.0-alpha.fad0a274                                ...           a year ago
  • 0.2.0-alpha.b606797b                                ...           a year ago
  • 0.2.0-alpha.eec415ab                                ...           a year ago
  • 0.2.0-alpha.0df49d9f                                ...           a year ago
  • 0.2.0-alpha.01da8a20                                ...           a year ago
  • 0.2.0-alpha.039a84f6                                ...           a year ago
  • 0.1.0                                ...           a year ago
  • 0.1.0-alpha.8204c6aa                                ...           a year ago

Copyright 2014 - 2016 © taobao.org |