根目录下添加 tslint.json文件 ,[规范一下书写ts],下面的也是一些简单配置{ "extends": [ "tslint:recommended" ], "lib": [ "ES2015", "ES2016", "ES2017" ], "linterOptions": { "exclude": [ "node_modules", "dist", "config", "build", "./**/*.js", "src/api/**", "src/components/common/**", "src/components/page/**", "src/components/public/**", "static/**" ] }, "rules": { "member-access": [ true, "no-public" ], "interface-name": [ true, "always-prefix" ], "align": [ true, "parameters", "statements" ], "class-name": true, "comment-format": [ true, "check-space" ], "curly": true, "eofline": true, "forin": false, "indent": [ true, "spaces" ], "noImplicitThis": false, "jsdoc-format": false, "label-position": true, "max-line-length": [ true, 200 ], "no-any": false, "no-arg": true, "no-bitwise": false, "no-conditional-assignment": true, "no-consecutive-blank-lines": true, "no-console": [ false, "debug", "info", "log", "time", "timeEnd", "warn", "trace" ], "no-construct": true, "no-constructor-vars": false, "no-debugger": false, "no-duplicate-variable": true, "no-empty": false, "no-eval": true, "no-internal-module": true, "no-namespace": true, "no-reference": true, "no-shadowed-variable": false, "no-string-literal": true, "no-switch-case-fall-through": false, "no-trailing-whitespace": true, "no-unused-expression": [ true, "allow-fast-null-checks" ], "no-use-before-declare": false, "no-var-keyword": true, "no-var-requires": false, "object-literal-sort-keys": false, "one-variable-per-declaration": [ true, "ignore-for-loop" ], "quotemark": [ true, "single", "jsx-double" ], }复制代码