添加tslint检测d.ts规范
This commit is contained in:
parent
1011bd411a
commit
f6ca27da30
4 changed files with 285 additions and 132 deletions
264
package.json
264
package.json
|
@ -1,133 +1,135 @@
|
||||||
{
|
{
|
||||||
"name": "iview",
|
"name": "iview",
|
||||||
"version": "3.3.0",
|
"version": "3.3.0",
|
||||||
"title": "iView",
|
"title": "iView",
|
||||||
"description": "A high quality UI components Library with Vue.js",
|
"description": "A high quality UI components Library with Vue.js",
|
||||||
"homepage": "http://www.iviewui.com",
|
"homepage": "http://www.iviewui.com",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"iview",
|
"iview",
|
||||||
"vue",
|
"vue",
|
||||||
"vue.js",
|
"vue.js",
|
||||||
"component",
|
"component",
|
||||||
"components",
|
"components",
|
||||||
"ui",
|
"ui",
|
||||||
"framework"
|
"framework"
|
||||||
],
|
],
|
||||||
"main": "dist/iview.js",
|
"main": "dist/iview.js",
|
||||||
"typings": "types/index.d.ts",
|
"typings": "types/index.d.ts",
|
||||||
"files": [
|
"files": [
|
||||||
"dist",
|
"dist",
|
||||||
"src",
|
"src",
|
||||||
"types"
|
"types"
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "webpack-dev-server --content-base test/ --open --inline --hot --compress --history-api-fallback --port 8081 --config build/webpack.dev.config.js",
|
"dev": "webpack-dev-server --content-base test/ --open --inline --hot --compress --history-api-fallback --port 8081 --config build/webpack.dev.config.js",
|
||||||
"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",
|
"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",
|
||||||
"dist:style": "gulp --gulpfile build/build-style.js",
|
"dist:style": "gulp --gulpfile build/build-style.js",
|
||||||
"dist:dev": "webpack --config build/webpack.dist.dev.config.js",
|
"dist:dev": "webpack --config build/webpack.dist.dev.config.js",
|
||||||
"dist:prod": "webpack --config build/webpack.dist.prod.config.js",
|
"dist:prod": "webpack --config build/webpack.dist.prod.config.js",
|
||||||
"dist:locale": "webpack --config build/webpack.dist.locale.config.js",
|
"dist:locale": "webpack --config build/webpack.dist.locale.config.js",
|
||||||
"dist": "npm run dist:style && npm run dist:dev && npm run dist:prod && npm run dist:locale",
|
"dist": "npm run dist:style && npm run dist:dev && npm run dist:prod && npm run dist:locale",
|
||||||
"lint": "eslint --fix --ext .js,.vue src",
|
"lint": "eslint --fix --ext .js,.vue src",
|
||||||
"unit": "cross-env BABEL_ENV=test karma start test/unit/karma.conf.js --single-run",
|
"tslint": "tslint --type-check --fix --project .",
|
||||||
"test": "npm run lint && npm run unit",
|
"unit": "cross-env BABEL_ENV=test karma start test/unit/karma.conf.js --single-run",
|
||||||
"prepare": "npm run dist"
|
"test": "npm run lint && npm run tslint && npm run unit",
|
||||||
},
|
"prepare": "npm run dist"
|
||||||
"repository": {
|
},
|
||||||
"type": "git",
|
"repository": {
|
||||||
"url": "https://github.com/iview/iview"
|
"type": "git",
|
||||||
},
|
"url": "https://github.com/iview/iview"
|
||||||
"author": "Aresn",
|
},
|
||||||
"license": "MIT",
|
"author": "Aresn",
|
||||||
"bugs": {
|
"license": "MIT",
|
||||||
"url": "https://github.com/iview/iview/issues"
|
"bugs": {
|
||||||
},
|
"url": "https://github.com/iview/iview/issues"
|
||||||
"dependencies": {
|
},
|
||||||
"async-validator": "^1.10.0",
|
"dependencies": {
|
||||||
"deepmerge": "^2.2.1",
|
"async-validator": "^1.10.0",
|
||||||
"element-resize-detector": "^1.2.0",
|
"deepmerge": "^2.2.1",
|
||||||
"js-calendar": "^1.2.3",
|
"element-resize-detector": "^1.2.0",
|
||||||
"lodash.throttle": "^4.1.1",
|
"js-calendar": "^1.2.3",
|
||||||
"popper.js": "^1.14.6",
|
"lodash.throttle": "^4.1.1",
|
||||||
"tinycolor2": "^1.4.1",
|
"popper.js": "^1.14.6",
|
||||||
"v-click-outside-x": "^3.5.6"
|
"tinycolor2": "^1.4.1",
|
||||||
},
|
"v-click-outside-x": "^3.5.6"
|
||||||
"peerDependencies": {
|
},
|
||||||
"vue": "^2.5.2"
|
"peerDependencies": {
|
||||||
},
|
"vue": "^2.5.2"
|
||||||
"devDependencies": {
|
},
|
||||||
"autoprefixer-loader": "^3.2.0",
|
"devDependencies": {
|
||||||
"babel-cli": "^6.26.0",
|
"autoprefixer-loader": "^3.2.0",
|
||||||
"babel-core": "^6.26.0",
|
"babel-cli": "^6.26.0",
|
||||||
"babel-helper-vue-jsx-merge-props": "^2.0.3",
|
"babel-core": "^6.26.0",
|
||||||
"babel-loader": "^7.1.5",
|
"babel-helper-vue-jsx-merge-props": "^2.0.3",
|
||||||
"babel-plugin-dynamic-import-node": "^1.2.0",
|
"babel-loader": "^7.1.5",
|
||||||
"babel-plugin-syntax-jsx": "^6.18.0",
|
"babel-plugin-dynamic-import-node": "^1.2.0",
|
||||||
"babel-plugin-transform-class-properties": "^6.24.1",
|
"babel-plugin-syntax-jsx": "^6.18.0",
|
||||||
"babel-plugin-transform-es5-property-mutators": "^6.24.1",
|
"babel-plugin-transform-class-properties": "^6.24.1",
|
||||||
"babel-plugin-transform-object-rest-spread": "^6.26.0",
|
"babel-plugin-transform-es5-property-mutators": "^6.24.1",
|
||||||
"babel-plugin-transform-runtime": "^6.23.0",
|
"babel-plugin-transform-object-rest-spread": "^6.26.0",
|
||||||
"babel-plugin-transform-vue-jsx": "^3.7.0",
|
"babel-plugin-transform-runtime": "^6.23.0",
|
||||||
"babel-preset-env": "^1.6.1",
|
"babel-plugin-transform-vue-jsx": "^3.7.0",
|
||||||
"babel-preset-stage-3": "^6.24.1",
|
"babel-preset-env": "^1.6.1",
|
||||||
"babel-runtime": "^6.26.0",
|
"babel-preset-stage-3": "^6.24.1",
|
||||||
"chai": "^4.2.0",
|
"babel-runtime": "^6.26.0",
|
||||||
"compression-webpack-plugin": "^1.1.12",
|
"chai": "^4.2.0",
|
||||||
"copy-webpack-plugin": "^4.6.0",
|
"compression-webpack-plugin": "^1.1.12",
|
||||||
"cross-env": "^5.2.0",
|
"copy-webpack-plugin": "^4.6.0",
|
||||||
"css-loader": "^0.28.10",
|
"cross-env": "^5.2.0",
|
||||||
"eslint": "^3.19.0",
|
"css-loader": "^0.28.10",
|
||||||
"eslint-plugin-vue": "^2.1.0",
|
"eslint": "^3.19.0",
|
||||||
"extract-text-webpack-plugin": "^2.1.2",
|
"eslint-plugin-vue": "^2.1.0",
|
||||||
"file-loader": "^1.1.11",
|
"extract-text-webpack-plugin": "^2.1.2",
|
||||||
"friendly-errors-webpack-plugin": "^1.6.1",
|
"file-loader": "^1.1.11",
|
||||||
"gulp": "^3.9.1",
|
"friendly-errors-webpack-plugin": "^1.6.1",
|
||||||
"gulp-autoprefixer": "^5.0.0",
|
"gulp": "^3.9.1",
|
||||||
"gulp-clean-css": "^3.10.0",
|
"gulp-autoprefixer": "^5.0.0",
|
||||||
"gulp-less": "^4.0.1",
|
"gulp-clean-css": "^3.10.0",
|
||||||
"gulp-rename": "^1.4.0",
|
"gulp-less": "^4.0.1",
|
||||||
"html-loader": "^0.5.5",
|
"gulp-rename": "^1.4.0",
|
||||||
"html-webpack-plugin": "^3.0.6",
|
"html-loader": "^0.5.5",
|
||||||
"karma": "^2.0.5",
|
"html-webpack-plugin": "^3.0.6",
|
||||||
"karma-chrome-launcher": "^2.2.0",
|
"karma": "^2.0.5",
|
||||||
"karma-coverage": "^1.1.1",
|
"karma-chrome-launcher": "^2.2.0",
|
||||||
"karma-mocha": "^1.3.0",
|
"karma-coverage": "^1.1.1",
|
||||||
"karma-sinon-chai": "^1.3.3",
|
"karma-mocha": "^1.3.0",
|
||||||
"karma-sourcemap-loader": "^0.3.7",
|
"karma-sinon-chai": "^1.3.3",
|
||||||
"karma-spec-reporter": "^0.0.32",
|
"karma-sourcemap-loader": "^0.3.7",
|
||||||
"karma-webpack": "^2.0.13",
|
"karma-spec-reporter": "^0.0.32",
|
||||||
"less": "^2.7.3",
|
"karma-webpack": "^2.0.13",
|
||||||
"less-loader": "^4.0.6",
|
"less": "^2.7.3",
|
||||||
"lolex": "^2.7.5",
|
"less-loader": "^4.0.6",
|
||||||
"mocha": "^5.0.4",
|
"lolex": "^2.7.5",
|
||||||
"sinon": "^4.4.2",
|
"mocha": "^5.0.4",
|
||||||
"sinon-chai": "^3.3.0",
|
"sinon": "^4.4.2",
|
||||||
"style-loader": "^0.20.2",
|
"sinon-chai": "^3.3.0",
|
||||||
"uglifyjs-webpack-plugin": "^1.3.0",
|
"style-loader": "^0.20.2",
|
||||||
"url-loader": "^1.1.2",
|
"tslint": "^5.14.0",
|
||||||
"vue": "^2.5.17",
|
"uglifyjs-webpack-plugin": "^1.3.0",
|
||||||
"vue-hot-reload-api": "^2.3.1",
|
"url-loader": "^1.1.2",
|
||||||
"vue-html-loader": "^1.2.4",
|
"vue": "^2.5.17",
|
||||||
"vue-loader": "^14.2.1",
|
"vue-hot-reload-api": "^2.3.1",
|
||||||
"vue-router": "^3.0.2",
|
"vue-html-loader": "^1.2.4",
|
||||||
"vue-style-loader": "^4.1.2",
|
"vue-loader": "^14.2.1",
|
||||||
"vue-template-compiler": "^2.5.17",
|
"vue-router": "^3.0.2",
|
||||||
"webpack": "^3.11.0",
|
"vue-style-loader": "^4.1.2",
|
||||||
"webpack-dev-server": "^2.11.3",
|
"vue-template-compiler": "^2.5.17",
|
||||||
"webpack-merge": "^3.0.0"
|
"webpack": "^3.11.0",
|
||||||
},
|
"webpack-dev-server": "^2.11.3",
|
||||||
"engines": {
|
"webpack-merge": "^3.0.0"
|
||||||
"node": ">=8.9.1",
|
},
|
||||||
"npm": ">=5.5.1",
|
"engines": {
|
||||||
"yarn": ">=1.3.2"
|
"node": ">=8.9.1",
|
||||||
},
|
"npm": ">=5.5.1",
|
||||||
"browserslist": [
|
"yarn": ">=1.3.2"
|
||||||
"last 3 Chrome versions",
|
},
|
||||||
"last 3 Firefox versions",
|
"browserslist": [
|
||||||
"Safari >= 10",
|
"last 3 Chrome versions",
|
||||||
"Explorer >= 11",
|
"last 3 Firefox versions",
|
||||||
"Edge >= 12",
|
"Safari >= 10",
|
||||||
"iOS >= 10",
|
"Explorer >= 11",
|
||||||
"Android >= 6"
|
"Edge >= 12",
|
||||||
]
|
"iOS >= 10",
|
||||||
|
"Android >= 6"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
24
tsconfig.json
Normal file
24
tsconfig.json
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "esnext",
|
||||||
|
"module": "esnext",
|
||||||
|
"strict": true,
|
||||||
|
"jsx": "preserve",
|
||||||
|
"importHelpers": true,
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
|
"sourceMap": true,
|
||||||
|
"baseUrl": ".",
|
||||||
|
"types": ["node"],
|
||||||
|
"paths": {
|
||||||
|
"@/*": ["src/*"]
|
||||||
|
},
|
||||||
|
"lib": ["esnext", "dom", "dom.iterable", "scripthost"]
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"types/*.ts",
|
||||||
|
],
|
||||||
|
"exclude": ["node_modules"]
|
||||||
|
}
|
127
tslint.json
Normal file
127
tslint.json
Normal file
|
@ -0,0 +1,127 @@
|
||||||
|
{
|
||||||
|
"defaultSeverity": "warning",
|
||||||
|
"extends": ["tslint:recommended"],
|
||||||
|
"linterOptions": {
|
||||||
|
"exclude": ["node_modules/**"]
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"jsx-boolean-value": false,
|
||||||
|
"jsx-curly-spacing": false,
|
||||||
|
"jsx-no-multiline-js": false,
|
||||||
|
"jsx-wrap-multiline": false,
|
||||||
|
"jsx-alignment": false,
|
||||||
|
"jsx-no-lambda": true,
|
||||||
|
"jsx-no-string-ref": false,
|
||||||
|
"class-name": false,
|
||||||
|
"max-line-length": [true, 180],
|
||||||
|
"member-ordering": [true, "statics-first"],
|
||||||
|
"new-parens": true,
|
||||||
|
"no-consecutive-blank-lines": true,
|
||||||
|
"no-mergeable-namespace": true,
|
||||||
|
"no-switch-case-fall-through": true,
|
||||||
|
"no-trailing-whitespace": true,
|
||||||
|
"no-unused-variable": [true],
|
||||||
|
"no-var-keyword": true,
|
||||||
|
"one-variable-per-declaration": [false, "ignore-for-loop"],
|
||||||
|
"triple-equals": [false, "allow-null-check"],
|
||||||
|
"use-isnan": false,
|
||||||
|
//ts专用
|
||||||
|
"prefer-const": false, //true, //const偏好
|
||||||
|
"adjacent-overload-signatures": true, //Enforces function overloads to be consecutive.
|
||||||
|
"ban-comma-operator": true, //禁止逗号运算符。
|
||||||
|
"ban-type": [true, ["object", "User {} instead."], ["string"]], //禁止类型
|
||||||
|
//"member-access": [true, "no-public" || "check-accessor" || "check-constructor" || "check-parameter-property"], //类成员必须声明 private public ....
|
||||||
|
"member-order": [false], //类声明排序
|
||||||
|
"no-any": false, //true, //不需使用any类型
|
||||||
|
"no-empty-interface": true, //禁止空接口 {}
|
||||||
|
"no-import-side-effect": [
|
||||||
|
true,
|
||||||
|
{
|
||||||
|
"ignore-module": "(\\.html|\\.css)$"
|
||||||
|
}
|
||||||
|
], //禁止导入带有副作用的语句
|
||||||
|
"no-inferrable-types": [true, "ignore-params", "ignore-properties"], //不允许将变量或参数初始化为数字,字符串或布尔值的显式类型声明。
|
||||||
|
"no-internal-module": true, //不允许内部模块
|
||||||
|
"no-magic-numbers": false, //[true, 1, 2, 3], //不允许在变量赋值之外使用常量数值。当没有指定允许值列表时,默认允许-1,0和1
|
||||||
|
"no-namespace": false, //[true, "allpw-declarations"], //不允许使用内部modules和命名空间
|
||||||
|
"no-non-null-assertion": true, //不允许使用!后缀操作符的非空断言。
|
||||||
|
"no-parameter-reassignment": false, //true, //不允许重新分配参数
|
||||||
|
"no-reference": false, //true, // 禁止使用/// <reference path=> 导入 ,使用import代替
|
||||||
|
"no-unnecessary-type-assertion": true, //如果类型断言没有改变表达式的类型就发出警告
|
||||||
|
"no-var-requires": true, //不允许使用var module = require("module"),用 import foo = require('foo')导入
|
||||||
|
"only-arrow-functions": false, //[true, "allow-declarations", "allow-named-functions"], //允许箭头表达式,不需要传统表达式 ; 允许独立的函数声明 ;允许表达,function foo() {}但不是function() {}
|
||||||
|
"prefer-for-of": true, //建议使用for(..of)
|
||||||
|
"promise-function-async": true, //要求异步函数返回promise
|
||||||
|
"typedef": false, //[true, "call-signature", "parameter", "member-variable-declaration"], // 需要定义的类型存在
|
||||||
|
"typedef-whitespace": true, //类型声明的冒号之前是否需要空格,在类型定义的时候,是否允许使用空格, 使用false,表示不对此项进行校验,不启用此项的校验
|
||||||
|
"unified-signatures": true, //重载可以被统一联合成一个
|
||||||
|
//function 专用
|
||||||
|
"await-promise": true, //警告不是一个promise的await
|
||||||
|
// "ban": [
|
||||||
|
// 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": false, //true, //用for in 必须用if进行过滤
|
||||||
|
"import-blacklist": true, //允许使用import require导入具体的模块
|
||||||
|
"label-postion": true, //允许在do/for/while/swith中使用label
|
||||||
|
"no-arg": true, //不允许使用 argument.callee
|
||||||
|
"no-bitwise": false, //true, //不允许使用按位运算符
|
||||||
|
"no-conditional-assignmen": true, //不允许在do-while/for/if/while判断语句中使用赋值语句
|
||||||
|
"no-console": [true, "time", "timeEnd"], //不能使用console
|
||||||
|
"no-construct": true, //不允许使用 String/Number/Boolean的构造函数
|
||||||
|
"no-debugger": true, //不允许使用debugger
|
||||||
|
"no-duplicate-super": true, //构造函数两次用super会发出警告
|
||||||
|
"no-empty": false, //true, //不允许空的块
|
||||||
|
"no-eval": true, //不允许使用eval
|
||||||
|
"no-floating-promises": true, //必须正确处理promise的返回函数
|
||||||
|
"no-for-in-array": true, //不允许使用for in 遍历数组
|
||||||
|
"no-implicit-dependencies": true, //不允许在项目的package.json中导入未列为依赖项的模块
|
||||||
|
"no-inferred-empty-object-type": true, //不允许在函数和构造函数中使用{}的类型推断
|
||||||
|
"no-invalid-template-strings": true, //警告在非模板字符中使用${
|
||||||
|
"no-invalid-this": false, //true, //不允许在非class中使用 this关键字
|
||||||
|
"no-misused-new": true, //禁止定义构造函数或new class
|
||||||
|
"no-null-keyword": false, // true, //不允许使用null关键字
|
||||||
|
"no-object-literal-type-assertion": false, //true, //禁止objext出现在类型断言表达式中
|
||||||
|
"no-return-await": true, //不允许return await
|
||||||
|
"arrow-parens": false, //true, //箭头函数定义的参数需要括号
|
||||||
|
"quotemark": [true, "single", "jsx-double", "avoid-escape"], //引号的使用规则
|
||||||
|
"semicolon": false, //[true, "never", "ignore-interfaces"], //分号的使用规则
|
||||||
|
"indent": false, //[true, "tabs", 2], //使用Tab进行缩进,每次强制缩进2个字符
|
||||||
|
"whitespace": [
|
||||||
|
true,
|
||||||
|
"check-branch",
|
||||||
|
"check-decl",
|
||||||
|
"check-operator",
|
||||||
|
"check-type"
|
||||||
|
], //空格的校验
|
||||||
|
"member-access": false, //类成员的显示可见性声明,即显示定义一个类的成员是否可见,即对类成员定义public | static 等
|
||||||
|
"one-line": false //, //要求指定的标记与它们之前的表达式位于同一行
|
||||||
|
// "trailing-comma": [true, { //对尾随逗号的校验
|
||||||
|
// "multiline": {
|
||||||
|
// "objects": "ignore",
|
||||||
|
// "arrays": "never",
|
||||||
|
// "functions": "never",
|
||||||
|
// "typeLiterals": "ignore"
|
||||||
|
// },
|
||||||
|
//"esSpecCompliant": true //是否允许尾随逗号出现在剩余变量中
|
||||||
|
// }]
|
||||||
|
}
|
||||||
|
}
|
2
types/layout.d.ts
vendored
2
types/layout.d.ts
vendored
|
@ -70,4 +70,4 @@ export declare interface Layout extends Vue {
|
||||||
* methods, 改变Sider展开-收起状态。
|
* methods, 改变Sider展开-收起状态。
|
||||||
*/
|
*/
|
||||||
toggleCollapse(): void;
|
toggleCollapse(): void;
|
||||||
}更多·
|
}
|
Loading…
Reference in a new issue