Tslint download

Local installation:

npm install tslint typescript --save-dev
 or
yarn add tslint typescript --dev
Copy the code

Global installation:

npm install tslint typescript -g
or
yarn global add tslint typescript
Copy the code

Install vscode plug-in:

Initialize the tslint configuration file: tslint.json

npx tslint --init
Copy the code

Configuration details:website(Don’t read all English guess you also don’t understand the following has been summarized)

Extends: extends: an internal configuration item name "extends": [" tsLint :recommended", using esLint default configuration], rules: Rules {//ts special greek-overload -signatures: true, // Enforces function overloads to be avg. ban-comma-operator: True, // Disallows the comma operator. ban-type: [true, [" object ", "User home {}."], [" string "]] / / prohibited type member - access:  [true , "no-public"||"check-accessor"|| "check-constructor" || "check-parameter-property" ] , // Class members must declare private public.... Member - order: [true, {order:...}], / / the class declaration order no - any: {} no-import-side-effect: [true, {"ignore-module": {} no-import-side-effect: [true, {"ignore-module": | \ \ "(\ \. HTML CSS) $"}], / / prohibit import with no side effects of statements - inferrable - types: [true, "ignore-params", "ignore-properties"], // An explicit type declaration that does not allow variables or parameters to be initialized as numbers, strings, or booleans. No-internal-module :true, // internal module no-magic-numbers: [true,1,2,3], // constant numbers are not allowed outside of variable assignments. When no list of allowed values is specified, the default is -1,0 and 1 no-namespace: [true," allPW-declarations "], // Internal modules and namespace no-non-null-assertion are not allowed: True, // Not allowed! Nonnull assertions for postfix operators. No-parameter reassignment: true, // no-reference: True, // <reference path=> import, use import instead of no-unnecessary-type-assertion: True, // warns if the type assertion does not change the type of the expression no-var-requires: Var module = require("module"); import foo = require('foo'); [true, "allow-declarations", "allow-named-functions"], // allows arrow expressions without traditional expressions; Allow independent function declarations; Function foo() {} but not function() {} prefer-for-of:true, // Use for(.. Of) promise-function-async: true, requiring asynchronous functions to return a promise typedef: [true, "call-signature", "parameter", "member-variable-declaration"], // Type pedef-whitespace: True, // can a type declaration be preceded by a space unified-signatures: true, // Overloads can be unified into a //function special await-promise: True, // Warning is not an await ban of a promise: [true, "eval", {"name": "$", "message": "please don't"}, ["describe", "only"], {"name": ["it", "only"], "message": "don't focus tests"}, { "name": ["chai", "assert", "equal"], "message": "Use 'strictEqual' instead." }, {"name": ["*", "forEach"], "message": "Use a regular for loop instead."} ], curly: True, //for if do while forin:true, //for in must be filtered with if import-blacklist:true, // Use import require to import a specific module label-postion: Callee no-bitwise:true, // Label no-arg:true is allowed in do/for/while/swith, // argument is not allowed. Callee no-bitwise:true, // The no-conditional-assignmen operator is not allowed: True, // No-console: true is not allowed in do-while/for/if/while judgements, // Console no-construct is not allowed: String/Number/Boolean constructor no-debugger: true, // debugger no-duplicate-super is not allowed: // Eval no-floating-promises are not allowed: // Eval no-floating-promises are not allowed: // Eval no-floating-promises are not allowed: // Eval no-floating-promises are not allowed: < span style = "box-sizing: border-box; color: RGB (51, 51, 51); line-height: 20px; font-size: 14px! Important; word-break: inherit! Important;" True, // do not allow the import of module no-demonstrator-object-type that is not listed as a dependency in the project package.json: ${no-invalid-template-strings: true; // Warning ${no-invalid-this in non-template characters: True, // This keyword no-misused-new: true is not allowed on non-classes, // defining constructors or new class no-null-keyword is disallowed: Assertion: true, // Forbid null no-object-literal-type-assertion: true, // Forbid objext to appear in type assertion expressions no-return-await: True, // return await arrow-parens: true, // arrow function parameters need parentheses}Copy the code

Also note:

I added configuration: why doesn’t it work? The no-any: true configuration is followed by a comma

The completion of

One step closer to the girl hahaha