a zip code crypto-currency system good for red ONLY

README.md 40KB

Build Status Downloads per Month NPM Version ZenHub Shields.io License

ESLint rules for TSLint

Improve your TSLint with the missing ESLint Rules

You want to code in TypeScript but miss all the rules available in ESLint?

Now you can combine both worlds by using this TSLint plugin!

Usage

Install from NPM to your Dev Dependencies

npm install --save-dev tslint-eslint-rules

Configure TSLint to use tslint-eslint-rules:

In your tslint.json file, extend this package, e.g:

{
  "extends": [
    "tslint-eslint-rules"
  ],
  "rules": {
    "no-constant-condition": true
  }
}

You can also extend other tslint config packages to combine this plugin with other community custom rules.

Configure your rules

In your tslint.json file, insert the rules as described below.

Rules (copied from the ESLint website)

The following tables shows all the existing ESLint rules and the similar rules available in TSLint. Please refer to the following icons as they provide the status of the rule.

Icon Description
:no_entry_sign: The rule is not applicable to Typescript.
:ballot_box_with_check: The rule is provided natively by TSLint.
:white_check_mark: The rule is available via tslint-eslint-rules.
:x: The rule is currently unavailable.

Possible Errors

The following rules point out areas where you might have made mistakes.

:grey_question: ESLint TSLint Description
:ballot_box_with_check: comma-dangle trailing-comma disallow or enforce trailing commas (recommended)
:ballot_box_with_check: no-cond-assign no-conditional-assignment disallow assignment in conditional expressions (recommended)
:ballot_box_with_check: no-console no-console disallow use of console in the node environment (recommended)
:white_check_mark: no-constant-condition no-constant-condition disallow use of constant expressions in conditions (recommended)
:white_check_mark: no-control-regex no-control-regex disallow control characters in regular expressions (recommended)
:ballot_box_with_check: no-debugger no-debugger disallow use of debugger (recommended)
:no_entry_sign: no-dupe-args Not applicable disallow duplicate arguments in functions (recommended)
:no_entry_sign: no-dupe-keys Not applicable disallow duplicate keys when creating object literals (recommended)
:white_check_mark: no-duplicate-case no-duplicate-case disallow a duplicate case label. (recommended)
:ballot_box_with_check: no-empty no-empty disallow empty statements (recommended)
:white_check_mark: no-empty-character-class no-empty-character-class disallow the use of empty character classes in regular expressions (recommended)
:white_check_mark: no-ex-assign no-ex-assign disallow assigning to the exception in a catch block (recommended)
:white_check_mark: no-extra-boolean-cast no-extra-boolean-cast disallow double-negation boolean casts in a boolean context (recommended)
:x: no-extra-parens no-extra-parens disallow unnecessary parentheses
:white_check_mark: no-extra-semi no-extra-semi disallow unnecessary semicolons (recommended)
:no_entry_sign: no-func-assign Not applicable disallow overwriting functions written as function declarations (recommended)
:white_check_mark: no-inner-declarations no-inner-declarations disallow function or variable declarations in nested blocks (recommended)
:white_check_mark: no-invalid-regexp no-invalid-regexp disallow invalid regular expression strings in the RegExp constructor (recommended)
:white_check_mark: no-irregular-whitespace ter-no-irregular-whitespace disallow irregular whitespace (recommended)
:no_entry_sign: no-negated-in-lhs Not applicable disallow negation of the left operand of an in expression (recommended)
:no_entry_sign: no-obj-calls Not applicable disallow the use of object properties of the global object (Math and JSON) as functions (recommended)
:white_check_mark: no-regex-spaces no-regex-spaces disallow multiple spaces in a regular expression literal (recommended)
:white_check_mark: no-sparse-arrays ter-no-sparse-arrays disallow sparse arrays (recommended)
:white_check_mark: no-unexpected-multiline no-unexpected-multiline Avoid code that looks like two expressions but is actually one
:no_entry_sign: no-unreachable Not applicable disallow unreachable statements after a return, throw, continue, or break statement (recommended)
:ballot_box_with_check: no-unsafe-finally no-unsafe-finally disallow control flow statements in finally blocks (recommended)
:ballot_box_with_check: use-isnan use-isnan disallow comparisons with the value NaN (recommended)
:white_check_mark: valid-jsdoc valid-jsdoc enforce valid JSDoc comments
:white_check_mark: valid-typeof valid-typeof Ensure that the results of typeof are compared against a valid string (recommended)

Best Practices

These are rules designed to prevent you from making mistakes. They either

prescribe a better way of doing something or help you avoid footguns.
:grey_question: ESLint TSLint Description
:x: accessor-pairs accessor-pairs Enforces getter/setter pairs in objects
:x: array-callback-return array-callback-return Enforce return statements in callbacks of array’s methods
:x: block-scoped-var accessor-pairs treat var statements as if they were block scoped
:ballot_box_with_check: complexity cyclomatic-complexity specify the maximum cyclomatic complexity allowed in a program
:x: consistent-return consistent-return require return statements to either always or never specify values
:ballot_box_with_check: curly curly specify curly brace conventions for all control statements
:ballot_box_with_check: default-case switch-default require default case in switch statements
:x: dot-location dot-location enforces consistent newlines before or after dots
:x: dot-notation dot-notation encourages use of dot notation whenever possible
:ballot_box_with_check: eqeqeq triple-equals require the use of === and !==
:ballot_box_with_check: guard-for-in forin make sure for-in loops have an if statement
:ballot_box_with_check: no-alert ban disallow the use of alert, confirm, and prompt
can be achieved using the "ban": [true, ["alert"]] tslint rule
:ballot_box_with_check: no-caller no-arg disallow use of arguments.caller or arguments.callee
:x: no-case-declarations no-case-declarations disallow lexical declarations in case clauses
:x: no-div-regex no-div-regex disallow division operators explicitly at beginning of regular expression
:x: no-else-return no-else-return disallow else after a return in an if
:ballot_box_with_check: no-empty-function no-empty disallow use of empty functions
:x: no-empty-pattern no-empty-pattern disallow use of empty destructuring patterns
:x: no-eq-null no-eq-null disallow comparisons to null without a type-checking operator
:ballot_box_with_check: no-eval no-eval disallow use of eval()
:x: no-extend-native no-extend-native disallow adding to native types
:x: no-extra-bind no-extra-bind disallow unnecessary function binding
:x: no-extra-label no-extra-label disallow unnecessary labels
:ballot_box_with_check: no-fallthrough no-switch-case-fall-through disallow fallthrough of case statements (recommended)
:x: no-floating-decimal no-floating-decimal disallow the use of leading or trailing decimal points in numeric literals
:x: no-implicit-coercion no-implicit-coercion disallow the type conversions with shorter notations
:x: no-implicit-globals no-implicit-globals disallow var and named functions in global scope
:x: no-implied-eval no-implied-eval disallow use of eval()-like methods
:ballot_box_with_check: no-invalid-this no-invalid-this disallow this keywords outside of classes or class-like objects
:x: no-iterator no-iterator disallow Usage of __iterator__ property
:ballot_box_with_check: no-labels label-position disallow use of labeled statements
:x: no-lone-blocks no-lone-blocks disallow unnecessary nested blocks
:x: no-loop-func no-loop-func disallow creation of functions within loops
:ballot_box_with_check: no-magic-numbers no-magic-numbers disallow the use of magic numbers
:white_check_mark: no-multi-spaces no-multi-spaces disallow use of multiple spaces
:x: no-multi-str no-multi-str disallow use of multiline strings
:no_entry_sign: no-native-reassign Not applicable disallow reassignments of native objects
:ballot_box_with_check: no-new no-unused-new disallow use of the new operator when not part of an assignment or comparison
:x: no-new-func no-new-func disallow use of new operator for Function object
:ballot_box_with_check: no-new-wrappers no-construct disallows creating new instances of String,Number, and Boolean
:no_entry_sign: no-octal Not applicable disallow use of octal literals (recommended)
:x: no-octal-escape no-octal-escape disallow use of octal escape sequences in string literals, such as var foo = "Copyright \251";
:x: no-param-reassign no-param-reassign disallow reassignment of function parameters
:x: no-proto no-proto disallow Usage of __proto__ property
:ballot_box_with_check: no-redeclare no-duplicate-variable disallow declaring the same variable more than once (http://eslint.org/docs/rules/recommended)
:x: no-return-assign no-return-assign disallow use of assignment in return statement
:x: no-script-url no-script-url disallow use of javascript: urls.
:x: no-self-assign no-self-assign disallow assignments where both sides are exactly the same
:x: no-self-compare no-self-compare disallow comparisons where both sides are exactly the same
:x: no-sequences no-sequences disallow use of the comma operator
:ballot_box_with_check: no-throw-literal no-string-throw restrict what can be thrown as an exception
:x: no-unmodified-loop-condition no-unmodified-loop-condition disallow unmodified conditions of loops
:ballot_box_with_check: no-unused-expressions no-unused-expression disallow Usage of expressions in statement position
:x: no-unused-labels no-unused-labels disallow unused labels
:x: no-useless-call no-useless-call disallow unnecessary .call() and .apply()
:x: no-useless-concat no-useless-concat disallow unnecessary concatenation of literals or template literals
:x: no-useless-escape no-useless-escape disallow unnecessary usage of escape character
:x: no-void no-void disallow use of the void operator
:x: no-warning-comments no-warning-comments disallow Usage of configurable warning terms in comments e.g. TODO or FIXME
:x: no-with no-with disallow use of the with statement
:ballot_box_with_check: radix radix require use of the second argument for parseInt()
:x: vars-on-top vars-on-top require declaration of all vars at the top of their containing scope
:x: wrap-iife wrap-iife require immediate function invocation to be wrapped in parentheses
:x: yoda yoda require or disallow Yoda conditions

Strict Mode

These rules relate to using strict mode.

:grey_question: ESLint TSLint Description
:no_entry_sign: strict Not applicable require effective use of strict mode directives

Variables

These rules have to do with variable declarations.

:grey_question: ESLint TSLint Description
:x: init-declarations init-declarations enforce or disallow variable initializations at definition
:x: no-catch-shadow no-catch-shadow disallow the catch clause parameter name being the same as a variable in the outer scope
:no_entry_sign: no-delete-var Not applicable disallow deletion of variables (recommended)
:x: no-label-var no-label-var disallow labels that share a name with a variable
:ballot_box_with_check: no-shadow no-shadowed-variable disallow declaration of variables already declared in the outer scope
:x: no-shadow-restricted-names no-shadow-restricted-names disallow shadowing of names such as arguments
:no_entry_sign: no-undef Not applicable disallow use of undeclared variables unless mentioned in a /*global */ block (recommended)
:x: no-undef-init no-undef-init disallow use of undefined when initializing variables
:x: no-undefined no-undefined disallow use of undefined variable
:ballot_box_with_check: no-unused-vars no-unused-variable disallow unused variables (recommended).
:ballot_box_with_check: no-use-before-define no-use-before-declare disallow use of variables before they are defined

Node.js and CommonJS

These rules are specific to JavaScript running on Node.js or using CommonJS in the browser.

:grey_question: ESLint TSLint Description
:x: callback-return callback-return enforce return after a callback
:x: global-require global-require enforce require() on top-level module scope
:white_check_mark: handle-callback-err handle-callback-err enforce error handling in callbacks
:x: no-mixed-requires no-mixed-requires disallow mixing regular variable and require declarations
:x: no-new-require no-new-require disallow use of new operator with the require function
:x: no-path-concat no-path-concat disallow string concatenation with __dirname and __filename
:x: no-process-env no-process-env disallow use of process.env
:x: no-process-exit no-process-exit disallow process.exit()
:x: no-restricted-modules no-restricted-modules restrict Usage of specified node modules
:x: no-sync no-sync disallow use of synchronous methods

Stylistic Issues

These rules are purely matters of style and are quite subjective.

:grey_question: ESLint TSLint Description
:white_check_mark: array-bracket-spacing array-bracket-spacing enforce consistent spacing inside array brackets
:white_check_mark: block-spacing block-spacing disallow or enforce spaces inside of single line blocks
:white_check_mark: brace-style brace-style enforce one true brace style
:ballot_box_with_check: camelcase variable-name require camel case names
:x: comma-spacing comma-spacing enforce spacing before and after comma
:x: comma-style comma-style enforce one true comma style
:x: computed-property-spacing computed-property-spacing require or disallow padding inside computed properties
:x: consistent-this consistent-this enforce consistent naming when capturing the current execution context
:ballot_box_with_check: eol-last eofline enforce newline at the end of file, with no multiple empty lines
:white_check_mark: func-call-spacing ter-func-call-spacing require or disallow spacing between function identifiers and their invocations
:x: func-names func-names require function expressions to have a name
:x: func-style func-style enforce use of function declarations or expressions
:x: id-blacklist id-blacklist disallow certain identifiers to prevent them being used
:x: id-length id-length this option enforces minimum and maximum identifier lengths (variable names, property names etc.)
:x: id-match id-match require identifiers to match the provided regular expression
:white_check_mark: indent ter-indent enforce consistent indentation
:x: jsx-quotes jsx-quotes specify whether double or single quotes should be used in JSX attributes
:x: key-spacing key-spacing enforce spacing between keys and values in object literal properties
Tslint's whitespace can partially be used
:x: keyword-spacing keyword-spacing enforce spacing before and after keywords
Tslint's whitespace can partially be used
:ballot_box_with_check: linebreak-style linebreak-style disallow mixed 'LF' and 'CRLF' as linebreaks
:x: lines-around-comment lines-around-comment enforce empty lines around comments
:x: max-depth max-depth specify the maximum depth that blocks can be nested
:white_check_mark: max-len ter-max-len enforce a maximum line length
:ballot_box_with_check: max-lines max-file-line-count enforce a maximum number of lines per file
:x: max-nested-callbacks max-nested-callbacks specify the maximum depth callbacks can be nested
:x: max-params max-params specify the number of parameters that can be used in the function declaration
:x: max-statements max-statements specify the maximum number of statement allowed in a function
:x: max-statements-per-line max-statements-per-line specify the maximum number of statements allowed per line
:no_entry_sign: new-cap Not applicable require a capital letter for constructors
:ballot_box_with_check: new-parens new-parens disallow the omission of parentheses when invoking a constructor with no arguments
:x: newline-after-var newline-after-var require or disallow an empty newline after variable declarations
:x: newline-before-return newline-before-return require newline before return statement
:x: newline-per-chained-call newline-per-chained-call enforce newline after each call when chaining the calls
:x: no-array-constructor no-array-constructor disallow use of the Array constructor
:ballot_box_with_check: no-bitwise no-bitwise disallows bitwise operators
:x: no-continue no-continue disallow use of the continue statement
:x: no-inline-comments no-inline-comments disallow comments inline after code
:x: no-lonely-if no-lonely-if disallow if as the only statement in an else block
:ballot_box_with_check: no-mixed-spaces-and-tabs indent disallow mixed spaces and tabs for indentation (recommended)
:ballot_box_with_check: no-multiple-empty-lines no-consecutive-blank-lines disallow multiple empty lines
:x: no-negated-condition no-negated-condition disallow negated conditions
:x: no-nested-ternary no-nested-ternary disallow nested ternary expressions
:x: no-new-object no-new-object disallow the use of the Object constructor
:x: no-restricted-syntax no-restricted-syntax disallow use of certain syntax in code
:x: no-spaced-func no-spaced-func disallow space between function identifier and application
:x: no-ternary no-ternary disallow the use of ternary operators
:ballot_box_with_check: no-trailing-spaces no-trailing-whitespace disallow trailing whitespace at the end of lines
:x: no-underscore-dangle no-underscore-dangle disallow dangling underscores in identifiers
:x: no-unneeded-ternary no-unneeded-ternary disallow the use of ternary operators when a simpler alternative exists
:x: no-whitespace-before-property no-whitespace-before-property disallow whitespace before properties
:white_check_mark: object-curly-spacing object-curly-spacing require or disallow padding inside curly braces
:ballot_box_with_check: one-var one-variable-per-declaration require or disallow one variable declaration per function
:x: one-var-declaration-per-line one-var-declaration-per-line require or disallow a newline around variable declarations
:x: operator-assignment operator-assignment require assignment operator shorthand where possible or prohibit it entirely
:x: operator-linebreak operator-linebreak enforce operators to be placed before or after line breaks
:x: padded-blocks padded-blocks enforce padding within blocks
:ballot_box_with_check: quote-props object-literal-key-quotes require quotes around object literal property names
:ballot_box_with_check: quotes quotemark specify whether backticks, double or single quotes should be used
:x: require-jsdoc require-jsdoc Require JSDoc comment
:ballot_box_with_check: semi semicolon require or disallow use of semicolons instead of ASI
:x: semi-spacing semi-spacing enforce spacing before and after semicolons
:white_check_mark: sort-imports sort-imports enforce sorting import declarations within module
:x: sort-vars sort-vars sort variables within the same declaration block
:x: space-before-blocks space-before-blocks require or disallow a space before blocks
:x: space-before-function-paren space-before-function-paren require or disallow a space before function opening parenthesis
:white_check_mark: space-in-parens space-in-parens require or disallow spaces inside parentheses
:x: space-infix-ops space-infix-ops require spaces around operators
Tslint's whitespace can partially be used
:x: space-unary-ops space-unary-ops require or disallow spaces before/after unary operators
:ballot_box_with_check: spaced-comment comment-format require or disallow a space immediately following the // or /* in a comment
:x: wrap-regex wrap-regex require regex literals to be wrapped in parentheses

ECMAScript 6

These rules are only relevant to ES6 environments.

:grey_question: ESLint TSLint Description
:white_check_mark: arrow-body-style ter-arrow-body-style require braces in arrow function body
:white_check_mark: arrow-parens ter-arrow-parens require parens in arrow function arguments
:white_check_mark: arrow-spacing ter-arrow-spacing require space before/after arrow function's arrow
:no_entry_sign: constructor-super Not applicable verify calls of super() in constructors
:x: generator-star-spacing generator-star-spacing enforce spacing around the * in generator functions
:x: no-class-assign no-class-assign disallow modifying variables of class declarations
:x: no-confusing-arrow no-confusing-arrow disallow arrow functions where they could be confused with comparisons
:no_entry_sign: no-const-assign Not applicable disallow modifying variables that are declared using const
:no_entry_sign: no-dupe-class-members Not applicable disallow duplicate name in class members
:x: no-duplicate-imports no-duplicate-imports disallow duplicate module imports
:x: no-new-symbol no-new-symbol disallow use of the new operator with the Symbol object
:x: no-restricted-imports no-restricted-imports restrict usage of specified modules when loaded by import declaration
:no_entry_sign: no-this-before-super Not applicable disallow use of this/super before calling super() in constructors.
:x: no-useless-constructor no-useless-constructor disallow unnecessary constructor
:ballot_box_with_check: no-var no-var-keyword require let or const instead of var
:ballot_box_with_check: object-shorthand object-literal-shorthand require method and property shorthand syntax for object literals
:white_check_mark: prefer-arrow-callback ter-prefer-arrow-callback require arrow functions as callbacks
:ballot_box_with_check: prefer-const prefer-const suggest using const declaration for variables that are never modified after declared
:x: prefer-reflect prefer-reflect suggest using Reflect methods where applicable
:x: prefer-rest-params prefer-rest-params suggest using the rest parameters instead of arguments
:x: prefer-spread prefer-spread suggest using the spread operator instead of .apply().
:x: prefer-template prefer-template suggest using template literals instead of strings concatenation
:x: require-yield require-yield disallow generator functions that do not have yield
:x: template-curly-spacing template-curly-spacing enforce spacing around embedded expressions of template strings
:x: yield-star-spacing yield-star-spacing enforce spacing around the * in yield* expressions

Contributing

Bugs, rules requests, doubts etc., open a Github Issue. If you want to create one of the missing rules or fix/improve some existing rule please check out the contribution guide.

LICENSE

MIT