From 8b19c81bfbb06f0ad1f1787655fbebf2da4ed863 Mon Sep 17 00:00:00 2001 From: Vitor Buzinaro Date: Mon, 14 Dec 2015 14:14:19 -0300 Subject: [PATCH] [feat] prepare 1.0.0 release (refs #50) --- README.md | 1162 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 671 insertions(+), 491 deletions(-) diff --git a/README.md b/README.md index 32755ae..1dcf50f 100644 --- a/README.md +++ b/README.md @@ -368,10 +368,14 @@ These are rules designed to prevent you from making mistakes. They either prescr ```json "dot-location": [ true, - { - "object": true, - "property": false - } + "object" + ] + ``` + + ```json + "dot-location": [ + true, + "property" ] ``` @@ -698,10 +702,14 @@ These are rules designed to prevent you from making mistakes. They either prescr ```json "no-return-assign": [ true, - { - "except-parens": true, - "always": true - } + "except-parens" + ] + ``` + + ```json + "no-return-assign": [ + true, + "always" ] ``` @@ -818,6 +826,20 @@ These are rules designed to prevent you from making mistakes. They either prescr ] ``` + ```json + "wrap-iife": [ + true, + "outside" + ] + ``` + + ```json + "wrap-iife": [ + true, + "any" + ] + ``` + * [yoda](http://eslint.org/docs/rules/yoda) => yoda (tslint-eslint-rules) [TODO]() * Description: require or disallow Yoda conditions * Usage @@ -829,20 +851,39 @@ These are rules designed to prevent you from making mistakes. They either prescr ] ``` + ```json + "yoda": [ + true, + "always" + ] + ``` + ### Strict Mode These rules relate to using strict mode. -* [strict](http://eslint.org/docs/rules/strict) => +* [strict](http://eslint.org/docs/rules/strict) => strict (tslint-eslint-rules) [TODO]() * Description: controls location of Use Strict Directives * Usage ```json "strict": [ true, - { + "function" + ] + ``` - } + ```json + "strict": [ + true, + "global" + ] + ``` + + ```json + "strict": [ + true, + "never" ] ``` @@ -850,95 +891,82 @@ These rules relate to using strict mode. These rules have to do with variable declarations. -* [init-declarations](http://eslint.org/docs/rules/init-declarations) => +* [init-declarations](http://eslint.org/docs/rules/init-declarations) => init-declarations (tslint-eslint-rules) [TODO]() * Description: enforce or disallow variable initializations at definition * Usage ```json "init-declarations": [ true, + "always" { - + "ignoreForLoopInit": false } ] ``` -* [no-catch-shadow](http://eslint.org/docs/rules/no-catch-shadow) => - * Description: disallow the catch clause parameter name being the same as a variable in the outer scope - * Usage ```json - "no-catch-shadow": [ + "init-declarations": [ true, + "never" { - + "ignoreForLoopInit": false } ] ``` + +* [no-catch-shadow](http://eslint.org/docs/rules/no-catch-shadow) => no-catch-shadow (tslint-eslint-rules) [TODO]() + * Description: disallow the catch clause parameter name being the same as a variable in the outer scope + * Usage + + ```json + "no-catch-shadow": true + ``` + * [no-delete-var](http://eslint.org/docs/rules/no-delete-var) => not applicable to TypeScript * Description: disallow deletion of variables (recommended) -* [no-label-var](http://eslint.org/docs/rules/no-label-var) => +* [no-label-var](http://eslint.org/docs/rules/no-label-var) => no-label-var (tslint-eslint-rules) [TODO]() * Description: disallow labels that share a name with a variable * Usage ```json - "no-label-var": [ - true, - { - - } - ] + "no-label-var": true ``` -* [no-shadow-restricted-names](http://eslint.org/docs/rules/no-shadow-restricted-names) => + +* [no-shadow-restricted-names](http://eslint.org/docs/rules/no-shadow-restricted-names) => no-shadow-restricted-names (tslint-eslint-rules) [TODO]() * Description: disallow shadowing of names such as `arguments` * Usage ```json - "no-shadow-restricted-names": [ - true, - { - - } - ] + "no-shadow-restricted-names": true ``` -* [no-shadow](http://eslint.org/docs/rules/no-shadow) => + +* [no-shadow](http://eslint.org/docs/rules/no-shadow) => no-shadowed-variable (native) * Description: disallow declaration of variables already declared in the outer scope * Usage ```json - "no-shadow": [ - true, - { - - } - ] + "no-shadowed-variable": true ``` -* [no-undef-init](http://eslint.org/docs/rules/no-undef-init) => + +* [no-undef-init](http://eslint.org/docs/rules/no-undef-init) => no-undef-init (tslint-eslint-rules) [TODO]() * Description: disallow use of undefined when initializing variables * Usage ```json - "no-undef-init": [ - true, - { - - } - ] + "no-undef-init": true ``` + * [no-undef](http://eslint.org/docs/rules/no-undef) => not applicable to TypeScript * Description: disallow use of undeclared variables unless mentioned in a `/*global */` block (recommended) -* [no-undefined](http://eslint.org/docs/rules/no-undefined) => +* [no-undefined](http://eslint.org/docs/rules/no-undefined) => no-undefined (tslint-eslint-rules) [TODO]() * Description: disallow use of `undefined` variable * Usage ```json - "no-undefined": [ - true, - { - - } - ] + "no-undefined": true ``` * [no-unused-vars](http://eslint.org/docs/rules/no-unused-vars) => no-unused-variable (native) @@ -949,60 +977,53 @@ These rules have to do with variable declarations. "no-unused-variable": true ``` -* [no-use-before-define](http://eslint.org/docs/rules/no-use-before-define) => +* [no-use-before-define](http://eslint.org/docs/rules/no-use-before-define) => no-use-before-define (native) * Description: disallow use of variables before they are defined * Usage ```json - "no-use-before-define": [ - true, - { - - } - ] + "no-use-before-define": true ``` ### Node.js and CommonJS These rules are specific to JavaScript running on Node.js or using CommonJS in the browser. -* [callback-return](http://eslint.org/docs/rules/callback-return) => +* [callback-return](http://eslint.org/docs/rules/callback-return) => callback-return (tslint-eslint-rules) [TODO]() * Description: enforce `return` after a callback * Usage ```json "callback-return": [ true, - { - - } + [ + "callback", + "cb", + "next" + ] ] ``` -* [global-require](http://eslint.org/docs/rules/global-require) => + +* [global-require](http://eslint.org/docs/rules/global-require) => global-require (tslint-eslint-rules) [TODO]() * Description: enforce `require()` on top-level module scope * Usage ```json - "global-require": [ - true, - { - - } - ] + "global-require": true ``` -* [handle-callback-err](http://eslint.org/docs/rules/handle-callback-err) => + +* [handle-callback-err](http://eslint.org/docs/rules/handle-callback-err) => handle-callback-err (tslint-eslint-rules) [TODO]() * Description: enforce error handling in callbacks * Usage ```json "handle-callback-err": [ true, - { - - } + "^(err|error|anySpecificError)$" ] ``` -* [no-mixed-requires](http://eslint.org/docs/rules/no-mixed-requires) => + +* [no-mixed-requires](http://eslint.org/docs/rules/no-mixed-requires) => no-mixed-requires (tslint-eslint-rules) [TODO]() * Description: disallow mixing regular variable and require declarations * Usage @@ -1010,125 +1031,154 @@ These rules are specific to JavaScript running on Node.js or using CommonJS in t "no-mixed-requires": [ true, { - + "grouping": false } ] ``` -* [no-new-require](http://eslint.org/docs/rules/no-new-require) => + +* [no-new-require](http://eslint.org/docs/rules/no-new-require) => no-new-require (tslint-eslint-rules) [TODO]() * Description: disallow use of `new` operator with the `require` function * Usage ```json - "no-new-require": [ - true, - { - - } - ] + "no-new-require": true ``` -* [no-path-concat](http://eslint.org/docs/rules/no-path-concat) => + +* [no-path-concat](http://eslint.org/docs/rules/no-path-concat) => no-path-concat (tslint-eslint-rules) [TODO]() * Description: disallow string concatenation with `__dirname` and `__filename` * Usage ```json - "no-path-concat": [ - true, - { - - } - ] + "no-path-concat": true ``` -* [no-process-exit](http://eslint.org/docs/rules/no-process-exit) => + +* [no-process-exit](http://eslint.org/docs/rules/no-process-exit) => no-process-exit (tslint-eslint-rules) [TODO]() * Description: disallow `process.exit()` * Usage ```json - "no-process-exit": [ - true, - { - - } - ] + "no-process-exit": true ``` -* [no-restricted-modules](http://eslint.org/docs/rules/no-restricted-modules) => - * Description: restrict Usage - of specified node modules + +* [no-restricted-modules](http://eslint.org/docs/rules/no-restricted-modules) => no-restricted-modules (tslint-eslint-rules) [TODO]() + * Description: restrict Usage of specified node modules * Usage ```json "no-restricted-modules": [ true, - { - - } + [ + "fs", + "cluster", + "moduleName" + ] ] ``` -* [no-sync](http://eslint.org/docs/rules/no-sync) => + +* [no-sync](http://eslint.org/docs/rules/no-sync) => no-sync (tslint-eslint-rules) [TODO]() * Description: disallow use of synchronous methods * Usage ```json - "no-sync": [ - true, - { - - } - ] + "no-sync": true ``` ### Stylistic Issues These rules are purely matters of style and are quite subjective. -* [array-bracket-spacing](http://eslint.org/docs/rules/array-bracket-spacing) => +* [array-bracket-spacing](http://eslint.org/docs/rules/array-bracket-spacing) => array-bracket-spacing (tslint-eslint-rules) [TODO]() * Description: enforce spacing inside array brackets * Usage ```json "array-bracket-spacing": [ true, + "always", { + "singleValue": true, + "objectsInArrays": true, + "arraysInArrays": true + } + ] + ``` + ```json + "array-bracket-spacing": [ + true, + "never", + { + "singleValue": false, + "objectsInArrays": false, + "arraysInArrays": false } ] ``` -* [block-spacing](http://eslint.org/docs/rules/block-spacing) => + +* [block-spacing](http://eslint.org/docs/rules/block-spacing) => block-spacing (tslint-eslint-rules) [TODO]() * Description: disallow or enforce spaces inside of single line blocks * Usage ```json "block-spacing": [ true, - { + "always" + ] + ``` - } + ```json + "block-spacing": [ + true, + "never" ] ``` -* [brace-style](http://eslint.org/docs/rules/brace-style) => + +* [brace-style](http://eslint.org/docs/rules/brace-style) => brace-style (tslint-eslint-rules) [TODO]() * Description: enforce one true brace style * Usage ```json "brace-style": [ true, + "1tbs", { - + "allowSingleLine": true } ] ``` -* [camelcase](http://eslint.org/docs/rules/camelcase) => - * Description: require camel case names - * Usage ```json - "camelcase": [ + "brace-style": [ true, + "stroustrup", { + "allowSingleLine": true + } + ] + ``` + ```json + "brace-style": [ + true, + "allman", + { + "allowSingleLine": true } ] ``` -* [comma-spacing](http://eslint.org/docs/rules/comma-spacing) => + +* [camelcase](http://eslint.org/docs/rules/camelcase) => variable-name (native) + * Description: require camel case names + * Usage + + ```json + "variable-name": [ + true, + "check-format" + ] + ``` + +* [comma-spacing](http://eslint.org/docs/rules/comma-spacing) => comma-spacing (tslint-eslint-rules) [TODO]() * Description: enforce spacing before and after comma * Usage @@ -1136,83 +1186,110 @@ These rules are purely matters of style and are quite subjective. "comma-spacing": [ true, { - + "before": false, + "after": true } ] ``` -* [comma-style](http://eslint.org/docs/rules/comma-style) => + +* [comma-style](http://eslint.org/docs/rules/comma-style) => comma-style (tslint-eslint-rules) [TODO]() * Description: enforce one true comma style * Usage ```json "comma-style": [ true, - { + "first" + ] + ``` - } + ```json + "comma-style": [ + true, + "last" ] ``` -* [computed-property-spacing](http://eslint.org/docs/rules/computed-property-spacing) => + +* [computed-property-spacing](http://eslint.org/docs/rules/computed-property-spacing) => computed-property-spacing (tslint-eslint-rules) [TODO]() * Description: require or disallow padding inside computed properties * Usage ```json "computed-property-spacing": [ true, - { + "always" + ] + ``` - } + ```json + "computed-property-spacing": [ + true, + "never" ] ``` -* [consistent-this](http://eslint.org/docs/rules/consistent-this) => + +* [consistent-this](http://eslint.org/docs/rules/consistent-this) => consistent-this (tslint-eslint-rules) [TODO]() * Description: enforce consistent naming when capturing the current execution context * Usage ```json "consistent-this": [ true, - { - - } + "self" ] ``` -* [eol-last](http://eslint.org/docs/rules/eol-last) => + +* [eol-last](http://eslint.org/docs/rules/eol-last) => eol-last (tslint-eslint-rules) [TODO]() * Description: enforce newline at the end of file, with no multiple empty lines * Usage ```json "eol-last": [ true, - { + "unix" + ] + ``` - } + ```json + "eol-last": [ + true, + "windows" ] ``` -* [func-names](http://eslint.org/docs/rules/func-names) => + +* [func-names](http://eslint.org/docs/rules/func-names) => func-names (tslint-eslint-rules) [TODO]() * Description: require function expressions to have a name * Usage ```json - "func-names": [ + "func-names": true + ``` + +* [func-style](http://eslint.org/docs/rules/func-style) => func-style (tslint-eslint-rules) [TODO]() + * Description: enforce use of function declarations or expressions + * Usage + + ```json + "func-style": [ true, + "declaration" { - + "allowArrowFunctions": true } ] ``` -* [func-style](http://eslint.org/docs/rules/func-style) => - * Description: enforce use of function declarations or expressions - * Usage ```json "func-style": [ true, + "expression" { - + "allowArrowFunctions": true } ] ``` -* [id-length](http://eslint.org/docs/rules/id-length) => + +* [id-length](http://eslint.org/docs/rules/id-length) => id-length (tslint-eslint-rules) [TODO]() * Description: this option enforces minimum and maximum identifier lengths (variable names, property names etc.) * Usage @@ -1220,47 +1297,77 @@ These rules are purely matters of style and are quite subjective. "id-length": [ true, { + "min": 2, + "max": 10, + "properties": "always", + "exceptions": [ "x", "bolinha" ] + } + ] + ``` + ```json + "id-length": [ + true, + { + "min": 2, + "max": 10, + "properties": "never", + "exceptions": [ "x", "bolinha" ] } ] ``` -* [id-match](http://eslint.org/docs/rules/id-match) => + +* [id-match](http://eslint.org/docs/rules/id-match) => id-match (tslint-eslint-rules) [TODO]() * Description: require identifiers to match the provided regular expression * Usage ```json "id-match": [ true, + "^[a-z]+([A-Z][a-z]+)*$", { - + "properties": false } ] ``` -* [indent](http://eslint.org/docs/rules/indent) => + +* [indent](http://eslint.org/docs/rules/indent) => indent (native) * Description: specify tab or space width for your code * Usage ```json "indent": [ true, - { + "spaces" + ] + ``` - } + ```json + "indent": [ + true, + "tabs" ] ``` -* [jsx-quotes](http://eslint.org/docs/rules/jsx-quotes) => + +* [jsx-quotes](http://eslint.org/docs/rules/jsx-quotes) => jsx-quotes (tslint-eslint-rules) [TODO]() * Description: specify whether double or single quotes should be used in JSX attributes * Usage ```json "jsx-quotes": [ true, - { + "prefer-double" + ] + ``` - } + ```json + "jsx-quotes": [ + true, + "prefer-single" ] ``` -* [key-spacing](http://eslint.org/docs/rules/key-spacing) => + +* [key-spacing](http://eslint.org/docs/rules/key-spacing) => key-spacing (tslint-eslint-rules) [TODO]() * Description: enforce spacing between keys and values in object literal properties * Usage @@ -1268,23 +1375,33 @@ These rules are purely matters of style and are quite subjective. "key-spacing": [ true, { - + "align": "value", + "beforeColon": false, + "afterColon": true, + "mode": "minimum" } ] ``` -* [linebreak-style](http://eslint.org/docs/rules/linebreak-style) => + +* [linebreak-style](http://eslint.org/docs/rules/linebreak-style) => linebreak-style (tslint-eslint-rules) [TODO]() * Description: disallow mixed 'LF' and 'CRLF' as linebreaks * Usage ```json "linebreak-style": [ true, - { + "unix" + ] + ``` - } + ```json + "linebreak-style": [ + true, + "windows" ] ``` -* [lines-around-comment](http://eslint.org/docs/rules/lines-around-comment) => + +* [lines-around-comment](http://eslint.org/docs/rules/lines-around-comment) => lines-around-comment (tslint-eslint-rules) [TODO]() * Description: enforce empty lines around comments * Usage @@ -1292,105 +1409,90 @@ These rules are purely matters of style and are quite subjective. "lines-around-comment": [ true, { - + "beforeBlockComment": true, + "afterBlockComment": false, + "beforeLineComment": false, + "afterLineComment": false, + "allowBlockStart": false, + "allowBlockEnd": false, + "allowObjectStart": false, + "allowObjectEnd": false, + "allowArrayStart": false, + "allowArrayEnd": false } ] ``` -* [max-nested-callbacks](http://eslint.org/docs/rules/max-nested-callbacks) => + +* [max-nested-callbacks](http://eslint.org/docs/rules/max-nested-callbacks) => max-nested-callbacks (tslint-eslint-rules) [TODO]() * Description: specify the maximum depth callbacks can be nested * Usage ```json "max-nested-callbacks": [ true, - { - - } + 3 ] ``` -* [new-cap](http://eslint.org/docs/rules/new-cap) => + +* [new-cap](http://eslint.org/docs/rules/new-cap) => Not applicable to TypeScript * Description: require a capital letter for constructors + +* [new-parens](http://eslint.org/docs/rules/new-parens) => new-parens (tslint-eslint-rules) [TODO]() + * Description: disallow the omission of parentheses when invoking a constructor with no arguments * Usage ```json - "new-cap": [ - true, - { - - } - ] + "new-parens": true ``` -* [new-parens](http://eslint.org/docs/rules/new-parens) => - * Description: disallow the omission of parentheses when invoking a constructor with no arguments + +* [newline-after-var](http://eslint.org/docs/rules/newline-after-var) => newline-after-var (tslint-eslint-rules) [TODO]() + * Description: require or disallow an empty newline after variable declarations * Usage ```json - "new-parens": [ + "newline-after-var": [ true, - { - - } + "never" ] ``` -* [newline-after-var](http://eslint.org/docs/rules/newline-after-var) => - * Description: require or disallow an empty newline after variable declarations - * Usage ```json "newline-after-var": [ true, - { - - } + "always" ] ``` -* [no-array-constructor](http://eslint.org/docs/rules/no-array-constructor) => + +* [no-array-constructor](http://eslint.org/docs/rules/no-array-constructor) => no-array-constructor (tslint-eslint-rules) [TODO]() * Description: disallow use of the `Array` constructor * Usage ```json - "no-array-constructor": [ - true, - { - - } - ] + "no-array-constructor": true ``` -* [no-continue](http://eslint.org/docs/rules/no-continue) => + +* [no-continue](http://eslint.org/docs/rules/no-continue) => no-continue (tslint-eslint-rules) [TODO]() * Description: disallow use of the `continue` statement * Usage ```json - "no-continue": [ - true, - { - - } - ] + "no-continue": true ``` -* [no-inline-comments](http://eslint.org/docs/rules/no-inline-comments) => + +* [no-inline-comments](http://eslint.org/docs/rules/no-inline-comments) => no-inline-comments (tslint-eslint-rules) [TODO]() * Description: disallow comments inline after code * Usage ```json - "no-inline-comments": [ - true, - { - - } - ] + "no-inline-comments": true ``` -* [no-lonely-if](http://eslint.org/docs/rules/no-lonely-if) => + +* [no-lonely-if](http://eslint.org/docs/rules/no-lonely-if) => no-lonely-if (tslint-eslint-rules) [TODO]() * Description: disallow `if` as the only statement in an `else` block * Usage ```json - "no-lonely-if": [ - true, - { - - } - ] + "no-lonely-if": true ``` * [no-mixed-spaces-and-tabs](http://eslint.org/docs/rules/no-mixed-spaces-and-tabs) => ident (native) @@ -1401,15 +1503,13 @@ These rules are purely matters of style and are quite subjective. "ident": "spaces" ``` - or - ```json "ident": "tabs" ``` Note: When using TSLint `ident` rule, it will enforce the consistent use of the chosen identation. The ESLint rule allows an option for Smart Tabs, but there are some open issues, and we're not going to support this. -* [no-multiple-empty-lines](http://eslint.org/docs/rules/no-multiple-empty-lines) => +* [no-multiple-empty-lines](http://eslint.org/docs/rules/no-multiple-empty-lines) => no-multiple-empty-lines (tslint-eslint-rules) [TODO]() * Description: disallow multiple empty lines * Usage @@ -1417,96 +1517,73 @@ These rules are purely matters of style and are quite subjective. "no-multiple-empty-lines": [ true, { - + "max": 2, + "maxEOF": 1 } ] ``` -* [no-negated-condition](http://eslint.org/docs/rules/no-negated-condition) => +* [no-negated-condition](http://eslint.org/docs/rules/no-negated-condition) => no-negated-condition (tslint-eslint-rules) [TODO]() * Description: disallow negated conditions * Usage ```json - "no-negated-condition": [ - true, - { - - } - ] + "no-negated-condition": true ``` -* [no-nested-ternary](http://eslint.org/docs/rules/no-nested-ternary) => + +* [no-nested-ternary](http://eslint.org/docs/rules/no-nested-ternary) => no-nested-ternary (tslint-eslint-rules) [TODO]() * Description: disallow nested ternary expressions * Usage ```json - "no-nested-ternary": [ - true, - { - - } - ] + "no-nested-ternary": true ``` -* [no-new-object](http://eslint.org/docs/rules/no-new-object) => + +* [no-new-object](http://eslint.org/docs/rules/no-new-object) => no-new-object (tslint-eslint-rules) [TODO]() * Description: disallow the use of the `Object` constructor * Usage ```json - "no-new-object": [ - true, - { - - } - ] + "no-new-object": true ``` -* [no-restricted-syntax](http://eslint.org/docs/rules/no-restricted-syntax) => + +* [no-restricted-syntax](http://eslint.org/docs/rules/no-restricted-syntax) => no-restricted-syntax (tslint-eslint-rules) [TODO]() * Description: disallow use of certain syntax in code * Usage ```json "no-restricted-syntax": [ true, - { - - } + "FunctionExpression", + "WithStatement" ] ``` -* [no-spaced-func](http://eslint.org/docs/rules/no-spaced-func) => + +* [no-spaced-func](http://eslint.org/docs/rules/no-spaced-func) => no-spaced-func (tslint-eslint-rules) [TODO]() * Description: disallow space between function identifier and application * Usage ```json - "no-spaced-func": [ - true, - { - - } - ] + "no-spaced-func": true ``` -* [no-ternary](http://eslint.org/docs/rules/no-ternary) => + +* [no-ternary](http://eslint.org/docs/rules/no-ternary) => no-ternary (tslint-eslint-rules) [TODO]() * Description: disallow the use of ternary operators * Usage ```json - "no-ternary": [ - true, - { - - } - ] + "no-ternary": true ``` -* [no-trailing-spaces](http://eslint.org/docs/rules/no-trailing-spaces) => + +* [no-trailing-spaces](http://eslint.org/docs/rules/no-trailing-spaces) => no-trailing-whitespace (native) * Description: disallow trailing whitespace at the end of lines * Usage ```json - "no-trailing-spaces": [ - true, - { - - } - ] + "no-trailing-whitespace": true ``` -* [no-underscore-dangle](http://eslint.org/docs/rules/no-underscore-dangle) => + +* [no-underscore-dangle](http://eslint.org/docs/rules/no-underscore-dangle) => no-underscore-dangle (tslint-eslint-rules) [TODO]() * Description: disallow dangling underscores in identifiers * Usage @@ -1514,11 +1591,12 @@ These rules are purely matters of style and are quite subjective. "no-underscore-dangle": [ true, { - + "allow": ["foo_", "_bar"] } ] ``` -* [no-unneeded-ternary](http://eslint.org/docs/rules/no-unneeded-ternary) => + +* [no-unneeded-ternary](http://eslint.org/docs/rules/no-unneeded-ternary) => no-unneeded-ternary (tslint-eslint-rules) [TODO]() * Description: disallow the use of ternary operators when a simpler alternative exists * Usage @@ -1526,95 +1604,199 @@ These rules are purely matters of style and are quite subjective. "no-unneeded-ternary": [ true, { - + "defaultAssignment": true } ] ``` -* [object-curly-spacing](http://eslint.org/docs/rules/object-curly-spacing) => + +* [object-curly-spacing](http://eslint.org/docs/rules/object-curly-spacing) => object-curly-spacing (tslint-eslint-rules) [TODO]() * Description: require or disallow padding inside curly braces * Usage ```json "object-curly-spacing": [ true, - { + "always" + ] + ``` - } + ```json + "object-curly-spacing": [ + true, + "never" ] ``` -* [one-var](http://eslint.org/docs/rules/one-var) => + +* [one-var](http://eslint.org/docs/rules/one-var) => one-var (tslint-eslint-rules) [TODO]() * Description: require or disallow one variable declaration per function * Usage ```json "one-var": [ true, - { + "always" + ] + ``` - } + ```json + "one-var": [ + true, + "never" ] ``` -* [operator-assignment](http://eslint.org/docs/rules/operator-assignment) => + +* [operator-assignment](http://eslint.org/docs/rules/operator-assignment) => operator-assignment (tslint-eslint-rules) [TODO]() * Description: require assignment operator shorthand where possible or prohibit it entirely * Usage ```json "operator-assignment": [ true, - { + "always" + ] + ``` - } + ```json + "operator-assignment": [ + true, + "never" ] ``` -* [operator-linebreak](http://eslint.org/docs/rules/operator-linebreak) => + +* [operator-linebreak](http://eslint.org/docs/rules/operator-linebreak) => operator-linebreak (tslint-eslint-rules) [TODO]() * Description: enforce operators to be placed before or after line breaks * Usage ```json "operator-linebreak": [ true, + "before", { + "overrides": { "?": "after"} + } + ] + ``` + ```json + "operator-linebreak": [ + true, + "after", + { + "overrides": { "?": "after"} } ] ``` -* [padded-blocks](http://eslint.org/docs/rules/padded-blocks) => + + ```json + "operator-linebreak": [ + true, + "none", + { + "overrides": { "?": "none", "+=": "none"} + } + ] + ``` + +* [padded-blocks](http://eslint.org/docs/rules/padded-blocks) => padded-blocks (tslint-eslint-rules) [TODO]() * Description: enforce padding within blocks * Usage ```json "padded-blocks": [ true, - { + "always" + ] + ``` - } + ```json + "padded-blocks": [ + true, + "never" ] ``` -* [quote-props](http://eslint.org/docs/rules/quote-props) => + +* [quote-props](http://eslint.org/docs/rules/quote-props) => quote-props (tslint-eslint-rules) [TODO]() * Description: require quotes around object literal property names * Usage ```json "quote-props": [ true, - { + "always" + ] + ``` - } + ```json + "quote-props": [ + true, + "as-needed" + ] + ``` + + ```json + "quote-props": [ + true, + "consistent" + ] + ``` + + ```json + "quote-props": [ + true, + "consistent-as-needed" ] ``` -* [quotes](http://eslint.org/docs/rules/quotes) => + +* [quotes](http://eslint.org/docs/rules/quotes) => quote-props (tslint-eslint-rules) [TODO]() * Description: specify whether backticks, double or single quotes should be used * Usage ```json "quotes": [ true, - { + "single" + ] + ``` - } + ```json + "quotes": [ + true, + "single", + "avoid-escape" + ] + ``` + + ```json + "quotes": [ + true, + "double" + ] + ``` + + ```json + "quotes": [ + true, + "double", + "avoid-escape" + ] + ``` + + ```json + "quotes": [ + true, + "backtick" + ] + ``` + + ```json + "quotes": [ + true, + "backtick", + "avoid-escape" ] ``` -* [require-jsdoc](http://eslint.org/docs/rules/require-jsdoc) => + +* [require-jsdoc](http://eslint.org/docs/rules/require-jsdoc) => require-jsdoc (tslint-eslint-rules) [TODO]() * Description: Require JSDoc comment * Usage @@ -1622,11 +1804,17 @@ These rules are purely matters of style and are quite subjective. "require-jsdoc": [ true, { - + "require": + { + "FunctionDeclaration": true, + "MethodDefinition": false, + "ClassDeclaration": false + } } ] ``` -* [semi-spacing](http://eslint.org/docs/rules/semi-spacing) => + +* [semi-spacing](http://eslint.org/docs/rules/semi-spacing) => semi-spacing (tslint-eslint-rules) [TODO]() * Description: enforce spacing before and after semicolons * Usage @@ -1634,23 +1822,31 @@ These rules are purely matters of style and are quite subjective. "semi-spacing": [ true, { - + "before": false, + "after": true } ] ``` -* [semi](http://eslint.org/docs/rules/semi) => + +* [semi](http://eslint.org/docs/rules/semi) => semi (tslint-eslint-rules) [TODO]() * Description: require or disallow use of semicolons instead of ASI * Usage ```json "semi": [ true, - { + "always" + ] + ``` - } + ```json + "semi": [ + true, + "never" ] ``` -* [sort-vars](http://eslint.org/docs/rules/sort-vars) => + +* [sort-vars](http://eslint.org/docs/rules/sort-vars) => sort-vars (tslint-eslint-rules) [TODO]() * Description: sort variables within the same declaration block * Usage @@ -1658,71 +1854,122 @@ These rules are purely matters of style and are quite subjective. "sort-vars": [ true, { - + "ignoreCase": false } ] ``` -* [space-after-keywords](http://eslint.org/docs/rules/space-after-keywords) => + +* [space-after-keywords](http://eslint.org/docs/rules/space-after-keywords) => space-after-keywords (tslint-eslint-rules) [TODO]() * Description: require a space after certain keywords * Usage ```json "space-after-keywords": [ true, - { + "always" + ] + ``` - } + ```json + "space-after-keywords": [ + true, + "never" ] ``` -* [space-before-blocks](http://eslint.org/docs/rules/space-before-blocks) => + +* [space-before-blocks](http://eslint.org/docs/rules/space-before-blocks) => space-before-blocks (tslint-eslint-rules) [TODO]() * Description: require or disallow a space before blocks * Usage ```json "space-before-blocks": [ true, - { + "always" + ] + ``` + + ```json + "space-before-blocks": [ + true, + "never" + ] + ``` + ```json + "space-before-blocks": [ + true, + { + "functions": "never", + "keywords": "always" } ] ``` -* [space-before-function-paren](http://eslint.org/docs/rules/space-before-function-paren) => + +* [space-before-function-paren](http://eslint.org/docs/rules/space-before-function-paren) => space-before-function-paren (tslint-eslint-rules) [TODO]() * Description: require or disallow a space before function opening parenthesis * Usage ```json "space-before-function-paren": [ true, - { + "always" + ] + ``` + ```json + "space-before-function-paren": [ + true, + "never" + ] + ``` + + ```json + "space-before-function-paren": [ + true, + { + "anonymous": "always", + "named": "never" } ] ``` -* [space-before-keywords](http://eslint.org/docs/rules/space-before-keywords) => + +* [space-before-keywords](http://eslint.org/docs/rules/space-before-keywords) => space-before-keywords (tslint-eslint-rules) [TODO]() * Description: require a space before certain keywords * Usage ```json "space-before-keywords": [ true, - { + "always" + ] + ``` - } + ```json + "space-before-keywords": [ + true, + "never" ] ``` -* [space-in-parens](http://eslint.org/docs/rules/space-in-parens) => + +* [space-in-parens](http://eslint.org/docs/rules/space-in-parens) => space-in-parens (tslint-eslint-rules) [TODO]() * Description: require or disallow spaces inside parentheses * Usage ```json "space-in-parens": [ true, - { + "always" + ] + ``` - } + ```json + "space-in-parens": [ + true, + "never" ] ``` -* [space-infix-ops](http://eslint.org/docs/rules/space-infix-ops) => + +* [space-infix-ops](http://eslint.org/docs/rules/space-infix-ops) => space-infix-ops (tslint-eslint-rules) [TODO]() * Description: require spaces around operators * Usage @@ -1730,23 +1977,20 @@ These rules are purely matters of style and are quite subjective. "space-infix-ops": [ true, { - + "int32Hint": false } ] ``` -* [space-return-throw-case](http://eslint.org/docs/rules/space-return-throw-case) => + +* [space-return-throw-case](http://eslint.org/docs/rules/space-return-throw-case) => space-return-throw-case (tslint-eslint-rules) [TODO]() * Description: require a space after `return`, `throw`, and `case` * Usage ```json - "space-return-throw-case": [ - true, - { - - } - ] + "space-return-throw-case": true ``` -* [space-unary-ops](http://eslint.org/docs/rules/space-unary-ops) => + +* [space-unary-ops](http://eslint.org/docs/rules/space-unary-ops) => space-unary-ops (tslint-eslint-rules) [TODO]() * Description: require or disallow spaces before/after unary operators * Usage @@ -1754,64 +1998,106 @@ These rules are purely matters of style and are quite subjective. "space-unary-ops": [ true, { - + "words": true, + "nonwords": false } ] ``` -* [spaced-comment](http://eslint.org/docs/rules/spaced-comment) => + +* [spaced-comment](http://eslint.org/docs/rules/spaced-comment) => spaced-comment (tslint-eslint-rules) [TODO]() * Description: require or disallow a space immediately following the `//` or `/*` in a comment * Usage ```json "spaced-comment": [ true, - { + "always" + ] + ``` - } + ```json + "spaced-comment": [ + true, + "never" ] ``` -* [wrap-regex](http://eslint.org/docs/rules/wrap-regex) => - * Description: require regex literals to be wrapped in parentheses - * Usage ```json - "wrap-regex": [ + "spaced-comment": [ true, + "always", { + "exceptions": ["-", "+"] + } + ] + ``` + ```json + "spaced-comment": [ + true, + "always", + { + "line": { + "markers": ["/"] + "exceptions": ["-", "+"] + }, + "block": { + "markers": ["/"] + "exceptions": ["-", "+"] + } } ] ``` +* [wrap-regex](http://eslint.org/docs/rules/wrap-regex) => wrap-regex (tslint-eslint-rules) [TODO]() + * Description: require regex literals to be wrapped in parentheses + * Usage + + ```json + "wrap-regex": true + ``` + ### ECMAScript 6 These rules are only relevant to ES6 environments. -* [arrow-body-style](http://eslint.org/docs/rules/arrow-body-style) => +* [arrow-body-style](http://eslint.org/docs/rules/arrow-body-style) => arrow-body-style (tslint-eslint-rules) [TODO]() * Description: require braces in arrow function body * Usage ```json "arrow-body-style": [ true, - { + "as-needed" + ] + ``` - } + ```json + "arrow-body-style": [ + true, + "always" ] ``` -* [arrow-parens](http://eslint.org/docs/rules/arrow-parens) => + +* [arrow-parens](http://eslint.org/docs/rules/arrow-parens) => arrow-parens (tslint-eslint-rules) [TODO]() * Description: require parens in arrow function arguments * Usage ```json "arrow-parens": [ true, - { + "as-needed" + ] + ``` - } + ```json + "arrow-parens": [ + true, + "always" ] ``` -* [arrow-spacing](http://eslint.org/docs/rules/arrow-spacing) => + +* [arrow-spacing](http://eslint.org/docs/rules/arrow-spacing) => arrow-spacing (tslint-eslint-rules) [TODO]() * Description: require space before/after arrow function's arrow * Usage @@ -1819,23 +2105,21 @@ These rules are only relevant to ES6 environments. "arrow-spacing": [ true, { - + "before": true, + "after": true } ] ``` -* [constructor-super](http://eslint.org/docs/rules/constructor-super) => + +* [constructor-super](http://eslint.org/docs/rules/constructor-super) => constructor-super (tslint-eslint-rules) [TODO]() * Description: verify calls of `super()` in constructors * Usage ```json - "constructor-super": [ - true, - { - - } - ] + "constructor-super": true ``` -* [generator-star-spacing](http://eslint.org/docs/rules/generator-star-spacing) => + +* [generator-star-spacing](http://eslint.org/docs/rules/generator-star-spacing) => generator-star-spacing (tslint-eslint-rules) [TODO]() * Description: enforce spacing around the `*` in generator functions * Usage @@ -1843,242 +2127,138 @@ These rules are only relevant to ES6 environments. "generator-star-spacing": [ true, { - + "before": true, + "after": true } ] ``` -* [no-arrow-condition](http://eslint.org/docs/rules/no-arrow-condition) => + +* [no-arrow-condition](http://eslint.org/docs/rules/no-arrow-condition) => no-arrow-condition (tslint-eslint-rules) [TODO]() * Description: disallow arrow functions where a condition is expected * Usage ```json - "no-arrow-condition": [ - true, - { - - } - ] + "no-arrow-condition": true ``` -* [no-class-assign](http://eslint.org/docs/rules/no-class-assign) => + +* [no-class-assign](http://eslint.org/docs/rules/no-class-assign) => no-class-assign (tslint-eslint-rules) [TODO]() * Description: disallow modifying variables of class declarations * Usage ```json - "no-class-assign": [ - true, - { - - } - ] + "no-class-assign": true ``` -* [no-const-assign](http://eslint.org/docs/rules/no-const-assign) => + +* [no-const-assign](http://eslint.org/docs/rules/no-const-assign) => no-const-assign (tslint-eslint-rules) [TODO]() * Description: disallow modifying variables that are declared using `const` * Usage ```json - "no-const-assign": [ - true, - { - - } - ] + "no-const-assign": true ``` -* [no-dupe-class-members](http://eslint.org/docs/rules/no-dupe-class-members) => - * Description: disallow duplicate name in class members - * Usage - ```json - "no-dupe-class-members": [ - true, - { +* [no-dupe-class-members](http://eslint.org/docs/rules/no-dupe-class-members) => Not applicable to TypeScript + * Description: disallow duplicate name in class members - } - ] - ``` -* [no-this-before-super](http://eslint.org/docs/rules/no-this-before-super) => +* [no-this-before-super](http://eslint.org/docs/rules/no-this-before-super) => no-this-before-super (tslint-eslint-rules) [TODO]() * Description: disallow use of `this`/`super` before calling `super()` in constructors. * Usage ```json - "no-this-before-super": [ - true, - { - - } - ] + "no-this-before-super": true ``` -* [no-var](http://eslint.org/docs/rules/no-var) => + +* [no-var](http://eslint.org/docs/rules/no-var) => no-var-keyword (native) * Description: require `let` or `const` instead of `var` * Usage ```json - "no-var": [ - true, - { - - } - ] + "no-var-keyword": true ``` -* [object-shorthand](http://eslint.org/docs/rules/object-shorthand) => + +* [object-shorthand](http://eslint.org/docs/rules/object-shorthand) => object-shorthand (tslint-eslint-rules) [TODO]() * Description: require method and property shorthand syntax for object literals * Usage ```json "object-shorthand": [ true, - { - - } + "always" ] ``` -* [prefer-arrow-callback](http://eslint.org/docs/rules/prefer-arrow-callback) => - * Description: suggest using arrow functions as callbacks - * Usage ```json - "prefer-arrow-callback": [ + "object-shorthand": [ true, - { - - } + "methods" ] ``` -* [prefer-const](http://eslint.org/docs/rules/prefer-const) => - * Description: suggest using `const` declaration for variables that are never modified after declared - * Usage ```json - "prefer-const": [ + "object-shorthand": [ true, - { - - } + "properties" ] ``` -* [prefer-reflect](http://eslint.org/docs/rules/prefer-reflect) => - * Description: suggest using Reflect methods where applicable - * Usage ```json - "prefer-reflect": [ + "object-shorthand": [ true, - { - - } + "never" ] ``` -* [prefer-spread](http://eslint.org/docs/rules/prefer-spread) => - * Description: suggest using the spread operator instead of `.apply()`. - * Usage - ```json - "prefer-spread": [ - true, - { - - } - ] - ``` -* [prefer-template](http://eslint.org/docs/rules/prefer-template) => - * Description: suggest using template literals instead of strings concatenation +* [prefer-arrow-callback](http://eslint.org/docs/rules/prefer-arrow-callback) => prefer-arrow-callback (tslint-eslint-rules) [TODO]() + * Description: suggest using arrow functions as callbacks * Usage ```json - "prefer-template": [ - true, - { - - } - ] + "prefer-arrow-callback": true ``` -* [require-yield](http://eslint.org/docs/rules/require-yield) => - * Description: disallow generator functions that do not have `yield` + +* [prefer-const](http://eslint.org/docs/rules/prefer-const) => prefer-const (tslint-eslint-rules) [TODO]() + * Description: suggest using `const` declaration for variables that are never modified after declared * Usage ```json - "require-yield": [ - true, - { - - } - ] + "prefer-const": true ``` -### Legacy - -The following rules are included for compatibility with [JSHint](http://jshint.com/) and [JSLint](http://jslint.com/). While the names of the rules may not match up with the JSHint/JSLint counterpart, the functionality is the same. - -* [max-depth](http://eslint.org/docs/rules/max-depth) => - * Description: specify the maximum depth that blocks can be nested +* [prefer-reflect](http://eslint.org/docs/rules/prefer-reflect) => prefer-reflect (tslint-eslint-rules) [TODO]() + * Description: suggest using Reflect methods where applicable * Usage ```json - "max-depth": [ + "prefer-reflect": [ true, { - + "exceptions": ["apply", "call", "defineProperty", "getOwnPropertyDescriptor", "getPrototypeOf", "setPrototypeOf", "isExtensible", "getOwnPropertyNames", "preventExtensions", "delete"] } ] ``` -* [max-len](http://eslint.org/docs/rules/max-len) => - * Description: specify the maximum length of a line in your program - * Usage - ```json - "max-len": [ - true, - { - - } - ] - ``` -* [max-params](http://eslint.org/docs/rules/max-params) => - * Description: limits the number of parameters that can be used in the function declaration. +* [prefer-spread](http://eslint.org/docs/rules/prefer-spread) => prefer-spread (tslint-eslint-rules) [TODO]() + * Description: suggest using the spread operator instead of `.apply()`. * Usage ```json - "max-params": [ - true, - { - - } - ] + "prefer-spread": true ``` -* [max-statements](http://eslint.org/docs/rules/max-statements) => - * Description: specify the maximum number of statement allowed in a function - * Usage - ```json - "max-statements": [ - true, - { - - } - ] - ``` -* [no-bitwise](http://eslint.org/docs/rules/no-bitwise) => - * Description: disallow use of bitwise operators +* [prefer-template](http://eslint.org/docs/rules/prefer-template) => prefer-template (tslint-eslint-rules) [TODO]() + * Description: suggest using template literals instead of strings concatenation * Usage ```json - "no-bitwise": [ - true, - { - - } - ] + "prefer-template": true ``` -* [no-plusplus](http://eslint.org/docs/rules/no-plusplus) => - * Description: disallow use of unary operators, `++` and `--` + +* [require-yield](http://eslint.org/docs/rules/require-yield) => require-yield (tslint-eslint-rules) [TODO]() + * Description: disallow generator functions that do not have `yield` * Usage ```json - "no-plusplus": [ - true, - { - - } - ] + "require-yield": true ```