Commit f6ca27da30327987408d55af62e587c7d3bff5f1

Authored by yangdan8
1 parent 1011bd41

添加tslint检测d.ts规范

package.json
1 1 {
2   - "name": "iview",
3   - "version": "3.3.0",
4   - "title": "iView",
5   - "description": "A high quality UI components Library with Vue.js",
6   - "homepage": "http://www.iviewui.com",
7   - "keywords": [
8   - "iview",
9   - "vue",
10   - "vue.js",
11   - "component",
12   - "components",
13   - "ui",
14   - "framework"
15   - ],
16   - "main": "dist/iview.js",
17   - "typings": "types/index.d.ts",
18   - "files": [
19   - "dist",
20   - "src",
21   - "types"
22   - ],
23   - "scripts": {
24   - "dev": "webpack-dev-server --content-base test/ --open --inline --hot --compress --history-api-fallback --port 8081 --config build/webpack.dev.config.js",
25   - "dev:s": "webpack-dev-server --content-base test/ --open --inline --hot --compress --history-api-fallback --port 8081 --host 0.0.0.0 --config build/webpack.dev.config.js",
26   - "dist:style": "gulp --gulpfile build/build-style.js",
27   - "dist:dev": "webpack --config build/webpack.dist.dev.config.js",
28   - "dist:prod": "webpack --config build/webpack.dist.prod.config.js",
29   - "dist:locale": "webpack --config build/webpack.dist.locale.config.js",
30   - "dist": "npm run dist:style && npm run dist:dev && npm run dist:prod && npm run dist:locale",
31   - "lint": "eslint --fix --ext .js,.vue src",
32   - "unit": "cross-env BABEL_ENV=test karma start test/unit/karma.conf.js --single-run",
33   - "test": "npm run lint && npm run unit",
34   - "prepare": "npm run dist"
35   - },
36   - "repository": {
37   - "type": "git",
38   - "url": "https://github.com/iview/iview"
39   - },
40   - "author": "Aresn",
41   - "license": "MIT",
42   - "bugs": {
43   - "url": "https://github.com/iview/iview/issues"
44   - },
45   - "dependencies": {
46   - "async-validator": "^1.10.0",
47   - "deepmerge": "^2.2.1",
48   - "element-resize-detector": "^1.2.0",
49   - "js-calendar": "^1.2.3",
50   - "lodash.throttle": "^4.1.1",
51   - "popper.js": "^1.14.6",
52   - "tinycolor2": "^1.4.1",
53   - "v-click-outside-x": "^3.5.6"
54   - },
55   - "peerDependencies": {
56   - "vue": "^2.5.2"
57   - },
58   - "devDependencies": {
59   - "autoprefixer-loader": "^3.2.0",
60   - "babel-cli": "^6.26.0",
61   - "babel-core": "^6.26.0",
62   - "babel-helper-vue-jsx-merge-props": "^2.0.3",
63   - "babel-loader": "^7.1.5",
64   - "babel-plugin-dynamic-import-node": "^1.2.0",
65   - "babel-plugin-syntax-jsx": "^6.18.0",
66   - "babel-plugin-transform-class-properties": "^6.24.1",
67   - "babel-plugin-transform-es5-property-mutators": "^6.24.1",
68   - "babel-plugin-transform-object-rest-spread": "^6.26.0",
69   - "babel-plugin-transform-runtime": "^6.23.0",
70   - "babel-plugin-transform-vue-jsx": "^3.7.0",
71   - "babel-preset-env": "^1.6.1",
72   - "babel-preset-stage-3": "^6.24.1",
73   - "babel-runtime": "^6.26.0",
74   - "chai": "^4.2.0",
75   - "compression-webpack-plugin": "^1.1.12",
76   - "copy-webpack-plugin": "^4.6.0",
77   - "cross-env": "^5.2.0",
78   - "css-loader": "^0.28.10",
79   - "eslint": "^3.19.0",
80   - "eslint-plugin-vue": "^2.1.0",
81   - "extract-text-webpack-plugin": "^2.1.2",
82   - "file-loader": "^1.1.11",
83   - "friendly-errors-webpack-plugin": "^1.6.1",
84   - "gulp": "^3.9.1",
85   - "gulp-autoprefixer": "^5.0.0",
86   - "gulp-clean-css": "^3.10.0",
87   - "gulp-less": "^4.0.1",
88   - "gulp-rename": "^1.4.0",
89   - "html-loader": "^0.5.5",
90   - "html-webpack-plugin": "^3.0.6",
91   - "karma": "^2.0.5",
92   - "karma-chrome-launcher": "^2.2.0",
93   - "karma-coverage": "^1.1.1",
94   - "karma-mocha": "^1.3.0",
95   - "karma-sinon-chai": "^1.3.3",
96   - "karma-sourcemap-loader": "^0.3.7",
97   - "karma-spec-reporter": "^0.0.32",
98   - "karma-webpack": "^2.0.13",
99   - "less": "^2.7.3",
100   - "less-loader": "^4.0.6",
101   - "lolex": "^2.7.5",
102   - "mocha": "^5.0.4",
103   - "sinon": "^4.4.2",
104   - "sinon-chai": "^3.3.0",
105   - "style-loader": "^0.20.2",
106   - "uglifyjs-webpack-plugin": "^1.3.0",
107   - "url-loader": "^1.1.2",
108   - "vue": "^2.5.17",
109   - "vue-hot-reload-api": "^2.3.1",
110   - "vue-html-loader": "^1.2.4",
111   - "vue-loader": "^14.2.1",
112   - "vue-router": "^3.0.2",
113   - "vue-style-loader": "^4.1.2",
114   - "vue-template-compiler": "^2.5.17",
115   - "webpack": "^3.11.0",
116   - "webpack-dev-server": "^2.11.3",
117   - "webpack-merge": "^3.0.0"
118   - },
119   - "engines": {
120   - "node": ">=8.9.1",
121   - "npm": ">=5.5.1",
122   - "yarn": ">=1.3.2"
123   - },
124   - "browserslist": [
125   - "last 3 Chrome versions",
126   - "last 3 Firefox versions",
127   - "Safari >= 10",
128   - "Explorer >= 11",
129   - "Edge >= 12",
130   - "iOS >= 10",
131   - "Android >= 6"
132   - ]
  2 + "name": "iview",
  3 + "version": "3.3.0",
  4 + "title": "iView",
  5 + "description": "A high quality UI components Library with Vue.js",
  6 + "homepage": "http://www.iviewui.com",
  7 + "keywords": [
  8 + "iview",
  9 + "vue",
  10 + "vue.js",
  11 + "component",
  12 + "components",
  13 + "ui",
  14 + "framework"
  15 + ],
  16 + "main": "dist/iview.js",
  17 + "typings": "types/index.d.ts",
  18 + "files": [
  19 + "dist",
  20 + "src",
  21 + "types"
  22 + ],
  23 + "scripts": {
  24 + "dev": "webpack-dev-server --content-base test/ --open --inline --hot --compress --history-api-fallback --port 8081 --config build/webpack.dev.config.js",
  25 + "dev:s": "webpack-dev-server --content-base test/ --open --inline --hot --compress --history-api-fallback --port 8081 --host 0.0.0.0 --config build/webpack.dev.config.js",
  26 + "dist:style": "gulp --gulpfile build/build-style.js",
  27 + "dist:dev": "webpack --config build/webpack.dist.dev.config.js",
  28 + "dist:prod": "webpack --config build/webpack.dist.prod.config.js",
  29 + "dist:locale": "webpack --config build/webpack.dist.locale.config.js",
  30 + "dist": "npm run dist:style && npm run dist:dev && npm run dist:prod && npm run dist:locale",
  31 + "lint": "eslint --fix --ext .js,.vue src",
  32 + "tslint": "tslint --type-check --fix --project .",
  33 + "unit": "cross-env BABEL_ENV=test karma start test/unit/karma.conf.js --single-run",
  34 + "test": "npm run lint && npm run tslint && npm run unit",
  35 + "prepare": "npm run dist"
  36 + },
  37 + "repository": {
  38 + "type": "git",
  39 + "url": "https://github.com/iview/iview"
  40 + },
  41 + "author": "Aresn",
  42 + "license": "MIT",
  43 + "bugs": {
  44 + "url": "https://github.com/iview/iview/issues"
  45 + },
  46 + "dependencies": {
  47 + "async-validator": "^1.10.0",
  48 + "deepmerge": "^2.2.1",
  49 + "element-resize-detector": "^1.2.0",
  50 + "js-calendar": "^1.2.3",
  51 + "lodash.throttle": "^4.1.1",
  52 + "popper.js": "^1.14.6",
  53 + "tinycolor2": "^1.4.1",
  54 + "v-click-outside-x": "^3.5.6"
  55 + },
  56 + "peerDependencies": {
  57 + "vue": "^2.5.2"
  58 + },
  59 + "devDependencies": {
  60 + "autoprefixer-loader": "^3.2.0",
  61 + "babel-cli": "^6.26.0",
  62 + "babel-core": "^6.26.0",
  63 + "babel-helper-vue-jsx-merge-props": "^2.0.3",
  64 + "babel-loader": "^7.1.5",
  65 + "babel-plugin-dynamic-import-node": "^1.2.0",
  66 + "babel-plugin-syntax-jsx": "^6.18.0",
  67 + "babel-plugin-transform-class-properties": "^6.24.1",
  68 + "babel-plugin-transform-es5-property-mutators": "^6.24.1",
  69 + "babel-plugin-transform-object-rest-spread": "^6.26.0",
  70 + "babel-plugin-transform-runtime": "^6.23.0",
  71 + "babel-plugin-transform-vue-jsx": "^3.7.0",
  72 + "babel-preset-env": "^1.6.1",
  73 + "babel-preset-stage-3": "^6.24.1",
  74 + "babel-runtime": "^6.26.0",
  75 + "chai": "^4.2.0",
  76 + "compression-webpack-plugin": "^1.1.12",
  77 + "copy-webpack-plugin": "^4.6.0",
  78 + "cross-env": "^5.2.0",
  79 + "css-loader": "^0.28.10",
  80 + "eslint": "^3.19.0",
  81 + "eslint-plugin-vue": "^2.1.0",
  82 + "extract-text-webpack-plugin": "^2.1.2",
  83 + "file-loader": "^1.1.11",
  84 + "friendly-errors-webpack-plugin": "^1.6.1",
  85 + "gulp": "^3.9.1",
  86 + "gulp-autoprefixer": "^5.0.0",
  87 + "gulp-clean-css": "^3.10.0",
  88 + "gulp-less": "^4.0.1",
  89 + "gulp-rename": "^1.4.0",
  90 + "html-loader": "^0.5.5",
  91 + "html-webpack-plugin": "^3.0.6",
  92 + "karma": "^2.0.5",
  93 + "karma-chrome-launcher": "^2.2.0",
  94 + "karma-coverage": "^1.1.1",
  95 + "karma-mocha": "^1.3.0",
  96 + "karma-sinon-chai": "^1.3.3",
  97 + "karma-sourcemap-loader": "^0.3.7",
  98 + "karma-spec-reporter": "^0.0.32",
  99 + "karma-webpack": "^2.0.13",
  100 + "less": "^2.7.3",
  101 + "less-loader": "^4.0.6",
  102 + "lolex": "^2.7.5",
  103 + "mocha": "^5.0.4",
  104 + "sinon": "^4.4.2",
  105 + "sinon-chai": "^3.3.0",
  106 + "style-loader": "^0.20.2",
  107 + "tslint": "^5.14.0",
  108 + "uglifyjs-webpack-plugin": "^1.3.0",
  109 + "url-loader": "^1.1.2",
  110 + "vue": "^2.5.17",
  111 + "vue-hot-reload-api": "^2.3.1",
  112 + "vue-html-loader": "^1.2.4",
  113 + "vue-loader": "^14.2.1",
  114 + "vue-router": "^3.0.2",
  115 + "vue-style-loader": "^4.1.2",
  116 + "vue-template-compiler": "^2.5.17",
  117 + "webpack": "^3.11.0",
  118 + "webpack-dev-server": "^2.11.3",
  119 + "webpack-merge": "^3.0.0"
  120 + },
  121 + "engines": {
  122 + "node": ">=8.9.1",
  123 + "npm": ">=5.5.1",
  124 + "yarn": ">=1.3.2"
  125 + },
  126 + "browserslist": [
  127 + "last 3 Chrome versions",
  128 + "last 3 Firefox versions",
  129 + "Safari >= 10",
  130 + "Explorer >= 11",
  131 + "Edge >= 12",
  132 + "iOS >= 10",
  133 + "Android >= 6"
  134 + ]
133 135 }
... ...
tsconfig.json 0 → 100644
  1 +{
  2 + "compilerOptions": {
  3 + "target": "esnext",
  4 + "module": "esnext",
  5 + "strict": true,
  6 + "jsx": "preserve",
  7 + "importHelpers": true,
  8 + "moduleResolution": "node",
  9 + "experimentalDecorators": true,
  10 + "esModuleInterop": true,
  11 + "allowSyntheticDefaultImports": true,
  12 + "sourceMap": true,
  13 + "baseUrl": ".",
  14 + "types": ["node"],
  15 + "paths": {
  16 + "@/*": ["src/*"]
  17 + },
  18 + "lib": ["esnext", "dom", "dom.iterable", "scripthost"]
  19 + },
  20 + "include": [
  21 + "types/*.ts",
  22 + ],
  23 + "exclude": ["node_modules"]
  24 +}
... ...
tslint.json 0 → 100644
  1 +{
  2 + "defaultSeverity": "warning",
  3 + "extends": ["tslint:recommended"],
  4 + "linterOptions": {
  5 + "exclude": ["node_modules/**"]
  6 + },
  7 + "rules": {
  8 + "jsx-boolean-value": false,
  9 + "jsx-curly-spacing": false,
  10 + "jsx-no-multiline-js": false,
  11 + "jsx-wrap-multiline": false,
  12 + "jsx-alignment": false,
  13 + "jsx-no-lambda": true,
  14 + "jsx-no-string-ref": false,
  15 + "class-name": false,
  16 + "max-line-length": [true, 180],
  17 + "member-ordering": [true, "statics-first"],
  18 + "new-parens": true,
  19 + "no-consecutive-blank-lines": true,
  20 + "no-mergeable-namespace": true,
  21 + "no-switch-case-fall-through": true,
  22 + "no-trailing-whitespace": true,
  23 + "no-unused-variable": [true],
  24 + "no-var-keyword": true,
  25 + "one-variable-per-declaration": [false, "ignore-for-loop"],
  26 + "triple-equals": [false, "allow-null-check"],
  27 + "use-isnan": false,
  28 + //ts专用
  29 + "prefer-const": false, //true, //const偏好
  30 + "adjacent-overload-signatures": true, //Enforces function overloads to be consecutive.
  31 + "ban-comma-operator": true, //禁止逗号运算符。
  32 + "ban-type": [true, ["object", "User {} instead."], ["string"]], //禁止类型
  33 + //"member-access": [true, "no-public" || "check-accessor" || "check-constructor" || "check-parameter-property"], //类成员必须声明 private public ....
  34 + "member-order": [false], //类声明排序
  35 + "no-any": false, //true, //不需使用any类型
  36 + "no-empty-interface": true, //禁止空接口 {}
  37 + "no-import-side-effect": [
  38 + true,
  39 + {
  40 + "ignore-module": "(\\.html|\\.css)$"
  41 + }
  42 + ], //禁止导入带有副作用的语句
  43 + "no-inferrable-types": [true, "ignore-params", "ignore-properties"], //不允许将变量或参数初始化为数字,字符串或布尔值的显式类型声明。
  44 + "no-internal-module": true, //不允许内部模块
  45 + "no-magic-numbers": false, //[true, 1, 2, 3], //不允许在变量赋值之外使用常量数值。当没有指定允许值列表时,默认允许-1,0和1
  46 + "no-namespace": false, //[true, "allpw-declarations"], //不允许使用内部modules和命名空间
  47 + "no-non-null-assertion": true, //不允许使用!后缀操作符的非空断言。
  48 + "no-parameter-reassignment": false, //true, //不允许重新分配参数
  49 + "no-reference": false, //true, // 禁止使用/// <reference path=> 导入 ,使用import代替
  50 + "no-unnecessary-type-assertion": true, //如果类型断言没有改变表达式的类型就发出警告
  51 + "no-var-requires": true, //不允许使用var module = require("module"),用 import foo = require('foo')导入
  52 + "only-arrow-functions": false, //[true, "allow-declarations", "allow-named-functions"], //允许箭头表达式,不需要传统表达式 ; 允许独立的函数声明 ;允许表达,function foo() {}但不是function() {}
  53 + "prefer-for-of": true, //建议使用for(..of)
  54 + "promise-function-async": true, //要求异步函数返回promise
  55 + "typedef": false, //[true, "call-signature", "parameter", "member-variable-declaration"], // 需要定义的类型存在
  56 + "typedef-whitespace": true, //类型声明的冒号之前是否需要空格,在类型定义的时候,是否允许使用空格, 使用false,表示不对此项进行校验,不启用此项的校验
  57 + "unified-signatures": true, //重载可以被统一联合成一个
  58 + //function 专用
  59 + "await-promise": true, //警告不是一个promise的await
  60 + // "ban": [
  61 + // true,
  62 + // "eval",
  63 + // {
  64 + // "name": "$",
  65 + // "message": "please don't"
  66 + // },
  67 + // ["describe", "only"],
  68 + // {
  69 + // "name": ["it", "only"],
  70 + // "message": "don't focus tests"
  71 + // },
  72 + // {
  73 + // "name": ["chai", "assert", "equal"],
  74 + // "message": "Use 'strictEqual' instead."
  75 + // },
  76 + // {
  77 + // "name": ["*", "forEach"],
  78 + // "message": "Use a regular for loop instead."
  79 + // }
  80 + // ],
  81 + "curly": true, //for if do while 要有括号
  82 + "forin": false, //true, //用for in 必须用if进行过滤
  83 + "import-blacklist": true, //允许使用import require导入具体的模块
  84 + "label-postion": true, //允许在do/for/while/swith中使用label
  85 + "no-arg": true, //不允许使用 argument.callee
  86 + "no-bitwise": false, //true, //不允许使用按位运算符
  87 + "no-conditional-assignmen": true, //不允许在do-while/for/if/while判断语句中使用赋值语句
  88 + "no-console": [true, "time", "timeEnd"], //不能使用console
  89 + "no-construct": true, //不允许使用 String/Number/Boolean的构造函数
  90 + "no-debugger": true, //不允许使用debugger
  91 + "no-duplicate-super": true, //构造函数两次用super会发出警告
  92 + "no-empty": false, //true, //不允许空的块
  93 + "no-eval": true, //不允许使用eval
  94 + "no-floating-promises": true, //必须正确处理promise的返回函数
  95 + "no-for-in-array": true, //不允许使用for in 遍历数组
  96 + "no-implicit-dependencies": true, //不允许在项目的package.json中导入未列为依赖项的模块
  97 + "no-inferred-empty-object-type": true, //不允许在函数和构造函数中使用{}的类型推断
  98 + "no-invalid-template-strings": true, //警告在非模板字符中使用${
  99 + "no-invalid-this": false, //true, //不允许在非class中使用 this关键字
  100 + "no-misused-new": true, //禁止定义构造函数或new class
  101 + "no-null-keyword": false, // true, //不允许使用null关键字
  102 + "no-object-literal-type-assertion": false, //true, //禁止objext出现在类型断言表达式中
  103 + "no-return-await": true, //不允许return await
  104 + "arrow-parens": false, //true, //箭头函数定义的参数需要括号
  105 + "quotemark": [true, "single", "jsx-double", "avoid-escape"], //引号的使用规则
  106 + "semicolon": false, //[true, "never", "ignore-interfaces"], //分号的使用规则
  107 + "indent": false, //[true, "tabs", 2], //使用Tab进行缩进,每次强制缩进2个字符
  108 + "whitespace": [
  109 + true,
  110 + "check-branch",
  111 + "check-decl",
  112 + "check-operator",
  113 + "check-type"
  114 + ], //空格的校验
  115 + "member-access": false, //类成员的显示可见性声明,即显示定义一个类的成员是否可见,即对类成员定义public | static 等
  116 + "one-line": false //, //要求指定的标记与它们之前的表达式位于同一行
  117 + // "trailing-comma": [true, { //对尾随逗号的校验
  118 + // "multiline": {
  119 + // "objects": "ignore",
  120 + // "arrays": "never",
  121 + // "functions": "never",
  122 + // "typeLiterals": "ignore"
  123 + // },
  124 + //"esSpecCompliant": true //是否允许尾随逗号出现在剩余变量中
  125 + // }]
  126 + }
  127 +}
... ...
types/layout.d.ts
... ... @@ -70,4 +70,4 @@ export declare interface Layout extends Vue {
70 70 * methods, 改变Sider展开-收起状态。
71 71 */
72 72 toggleCollapse(): void;
73   -}更多·
74 73 \ No newline at end of file
  74 +}
75 75 \ No newline at end of file
... ...