Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@brandingbrand/fscodestyle

Package Overview
Dependencies
Maintainers
34
Versions
510
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@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.

  • 0.2.0-alpha.0df49d9f
  • npm
  • Socket score

Version published
Weekly downloads
255
decreased by-70.07%
Maintainers
34
Weekly downloads
 
Created
Source

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

NameDescriptionPackage
arrow-parensArrow functions with multiple arguments must use parentheses; single arguments must not.tslint
no-unnecessary-type-assertionWarn if a type assertion is not necessary for an expressiontslint
typedefRequires type definitions to exist. Checks function return types, parameters, and member variable declarations.tslint
typedef-whitespaceRequires no space to exist to the left of the colon in a type definitiontslint
await-promiseWarns if an awaited value is not a promise.tslint
no-floating-promisesRequires promises returned by functions to be handled appropriately.tslint
no-inferred-empty-object-typeDisallow type inference of {} (empty object type) at function and constructor call sitestslint
no-unbound-methodDisallow use of an unbound class method as a callbacktslint
no-unused-variableDisallows unused imports, variables, functions, and private class memberstslint
use-default-type-parameterWarns if an explicitly specified type argument is the default for that type parameter.tslint
no-mergeable-namespaceDisallows mergeable namespaces in the same file.tslint
array-typeEnforces use of T[] for array typestslint
no-boolean-literal-compareWarns on comparison to a boolean literal, as in x === true.tslint
type-literal-delimiterChecks that type literal members are separated by semicolons. Enforces a trailing semicolon for multiline type literals.tslint
trailing-commaDisallow trailing commastslint
no-constant-conditionDisallow use of constant expressions in conditionstslint
cyclomatic-complexityAllow maximum cyclomatic complexity of 10tslint
switch-defaultRequire default case in switch statementstslint
triple-equalsRequire use of === and !==tslint
guard-for-inMake sure for-in loops have an if statementtslint
no-switch-case-fall-throughDisallow fallthrough of case statementstslint
no-magic-numbersDisallow use of magic numbers except -1, 0, 1, 2, 100, 1000tslint
no-duplicate-variableDisallow declaring the same variable more than oncetslint
no-use-before-declareDisallow use of variables before they are definedtslint
variable-nameRequire camel-cace namestslint
linebreak-styleEnforce Unix-style linebreakstslint
no-consecutive-blank-linesDisallow more than two consecutive blank linestslint
no-trailing-spacesDisallow trailing whitespace at end of linestslint
one-variable-per-declarationRequire no more than one variable declaration per functiontslint
object-literal-key-quotesRequire quotes around object literal property names as neededtslint
quotemarkRequire single quotes for string literaltslint
semicolonRequire semicolonstslint
comment-formatRequire that single-line comments begin with a space after the //tslint
no-control-regexDisallow control characters in regular expressions (recommended)tslint-eslint-rules
no-duplicate-caseDisallow duplicate case labels in a switch statementtslint-eslint-rules
no-empty-character-classDisallow the use of empty character classes in regular expressionstslint-eslint-rules
no-ex-assignDisallow assigning to the expection in a catch blocktslint-eslint-rules
no-extra-semiDisallow unnecessary semicolonstslint-eslint-rules
no-inner-declarationsDisallow function declarations in nested blockstslint-eslint-rules
no-invalid-regexpDisallow invalid regular expression strings in the RegExp constructortslint-eslint-rules
ter-no-irregular-whitespaceDisallow irregular whitespacetslint-eslint-rules
no-regex-spacesDisallow multiple spaces in a regular expression literaltslint-eslint-rules
no-unexpected-multilineDisallow code that looks like two expressions but is actually onetslint-eslint-rules
valid-jsdocEnforce valid JSDoc commentstslint-eslint-rules
valid-typeofEnsure that the results of typeof are compared against a valid stringtslint-eslint-rules
no-multi-spacesDisallow use of multiple spacestslint-eslint-rules
handle-callback-errEnforce error handling in callbackstslint-eslint-rules
array-bracket-spacingDisallow after and before array bracketstslint-eslint-rules
block-spacingRequire spacies inside of single line blockstslint-eslint-rules
brace-styleRequire "one true brace style" in which the opening brace of a block is placed on the same line as its statement or declarationtslint-eslint-rules
ter-func-call-spacingRequire spacing between function identifiers and their incovationstslint-eslint-rules
ter-indentEnforce consistent indentation: 2 spacestslint-eslint-rules
ter-max-lenEnforce max line length of 100tslint-eslint-rules

FAQs

Package last updated on 30 Jun 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc