Typescript & React & optional parameters & default parameters
Typescript & React & optional parameters & default parameters
Typescript & optional parameters
https://www.typescriptlang.org/docs/handbook/functions.html#optional-and-default-parameters
ESLint warning bug & Typescript & optional parameters
typescript optional parameters warnings
https://stackoverflow.com/questions/tagged/visual-studio-code
https://github.com/microsoft/vscode/issues/83056



vscode ts 的error信息可以去掉;settings.json 加上这句 "javascript.implicitProjectConfig.experimentalDecorators": true
{
"resource": "/Users/xgqfrms/ubt/src/pages/ManagePage/PointCheck/CheckDetail/index.js",
"owner": "typescript",
"code": "1219",
"severity": 8,
"message": "Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning.",
"source": "ts",
"startLineNumber": 27,
"startColumn": 7,
"endLineNumber": 27,
"endColumn": 18
}
ESLint & max-lines
https://eslint.org/docs/rules/max-lines
/* eslint-disable */
"max-lines": [
"error",
{
"max": 500,
"skipBlankLines": true ,
"skipComments": true
}
],
.eslintrc
{
"extends": ["eslint-config-umi", "standard", "standard-jsx", "standard-react"],
"rules": {
"no-console": 2, //0,1,2
/**
* 禁止使用 debugger
*/
"no-debugger": "error",
// 禁止使用var
"no-var": "error",
// 使用分号
"semi": ["error", "always"],
"space-before-function-paren": [
"error",
{ "anonymous": "always", "named": "never", "asyncArrow": "always" }
],
"comma-dangle": ["error", "always-multiline"],
"generator-star-spacing": ["error", { "before": true, "after": false }],
"standard/no-callback-literal": "off",
/**
* 禁止函数的循环复杂度超过 20
* @reason https://en.wikipedia.org/wiki/Cyclomatic_complexity
*/
"complexity": [
"error",
{
"max": 20
}
],
/**
* getter 必须有返回值,并且禁止返回空
*/
"getter-return": "error",
/**
* 代码块嵌套的深度禁止超过 5 层
*/
"max-depth": ["error", 5],
/**
* 回调函数嵌套禁止超过 3 层,多了请用 async await 替代
*/
"max-nested-callbacks": ["error", 3],
/**
* 函数的参数禁止超过 7 个
*/
"max-params": ["error", 7],
/**
* 禁止直接使用 Buffer
* @reason Buffer 构造函数是已废弃的语法
*/
"no-buffer-constructor": "error",
/**
* 禁止重复导入模块
*/
"no-duplicate-imports": "error",
/**
* 禁止出现空代码块,允许 catch 为空代码块
*/
"no-empty": [
"error",
{
"allowEmptyCatch": true
}
],
/**
* 禁止使用 foo == null,必须使用 foo === null
*/
"no-eq-null": "error",
/**
* 禁止使用特殊空白符(比如全角空格),除非是出现在字符串、正则表达式或模版字符串中
*/
"no-irregular-whitespace": [
"error",
{
"skipStrings": true,
"skipComments": false,
"skipRegExps": true,
"skipTemplates": true
}
],
/**
* 禁止对函数的参数重新赋值
*/
"no-param-reassign": "error",
/**
* 必须使用 ... 而不是 Object.assign,除非 Object.assign 的第一个参数是一个变量
*/
"prefer-object-spread": "error",
/**
* generator 函数内必须有 yield
*/
"require-yield": "error",
/**
* 必须使用 if (foo === 5) 而不是 if (5 === foo)
*/
"yoda": [
"error",
"never",
{
"onlyEquality": true
}
],
/**
* 数组中的 jsx 必须有 key
*/
"react/jsx-key": [
"error",
{
"checkFragmentShorthand": true
}
],
/**
* 禁止将 children 作为一个 prop
*/
"react/no-children-prop": "error",
/**
* 禁止在使用了 dangerouslySetInnerHTML 的组件内添加 children
*/
"react/no-danger-with-children": "error",
/**
* 禁止直接修改 this.state
*/
"react/no-direct-mutation-state": "error",
/**
* 禁止使用 findDOMNode
*/
"react/no-find-dom-node": "error",
/**
* 禁止使用 isMounted
* @reason 它是已废弃的语法
*/
"react/no-is-mounted": "error",
/**
* 禁止使用 ReactDOM.render 的返回值
*/
"react/no-render-return-value": "error",
/**
* 禁止使用字符串 ref
*/
"react/no-string-refs": "error",
/**
* 禁止在函数组件中使用 this
*/
"react/no-this-in-sfc": "error",
/**
* 禁止组件的属性或生命周期大小写错误
*/
"react/no-typos": "error",
/**
* render 方法中必须有返回值
*/
"react/require-render-return": "error",
/**
* style 属性的取值必须是 object
*/
"react/style-prop-object": "error",
/**
* img, br 标签中禁止有 children
*/
"react/void-dom-elements-no-children": "error",
// 如果你要用 state refs, 最好用 class extends React.Component 而不是 React.createClass
"react/prefer-stateless-function": 2,
// 将多行的JSX标签写在 ()里
"react/jsx-wrap-multilines": 2,
// 禁止xml tag has empty body
"react/self-closing-comp": [
"error",
{
"component": true,
"html": true
}
],
// 没有引入React,报错
"react/react-in-jsx-scope": "error",
"react/prop-types": "off",
"react/jsx-fragments": "off",
"react/jsx-handler-names": "off",
"react/no-unused-prop-types": "off"
// "react/jsx-curly-brace-presence": "off",
// "jsx-quotes": "off"
}
}
vscode
"eslint.autoFixOnSave": true,
{
"eslint.alwaysShowStatus": true,
"eslint.packageManager": "yarn",
// "eslint.parserOptions": {
// "parser": "babel-eslint"
// },
// "eslint.validate":[
// "javascript",
// "javascriptreact"
// ],
"eslint.autoFixOnSave": true,
"typescript.validate.enable": false,
"editor.tabSize": 2,
"eslint.trace.server": "messages",
"files.exclude": {
"**/.git": true,
"**/.DS_Store": true,
"**/jspm_packages": true,
"**/node_modules": true,
"**/.zip": true,
"**/.sh": true
},
"search.exclude": {
"**/node_modules": true,
"**/bower_components": true
},
"files.watcherExclude": {
"**/.git/objects/**": true,
"**/.git/subtree-cache/**": true,
"**/node_modules/*/**": true
},
"editor.formatOnSave": false,
"editor.formatOnPaste": false,
"editor.renderWhitespace": "all",
"editor.fontSize": 16,
// "editor.tabSize": 4,
"editor.multiCursorModifier": "alt",
"editor.wordWrap": "on",
"editor.insertSpaces": true,
"files.encoding": "utf8",
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe",
"[typescript]": {
"editor.formatOnSave": false,
"editor.formatOnPaste": false
},
"[javascript]": {
"editor.formatOnSave": false,
"editor.formatOnPaste": false,
"editor.renderWhitespace": "all",
"editor.foldingStrategy": "indentation",
// "editor.foldingStrategy": "auto"
"editor.getOutliningSpans": ""
},
"[javascriptreact]": {
"editor.formatOnSave": false,
"editor.formatOnPaste": false,
"editor.renderWhitespace": "all",
"editor.foldingStrategy": "indentation"
},
"[markdown]": {
"editor.formatOnSave": true,
"editor.renderWhitespace": "all",
"editor.acceptSuggestionOnEnter": "off"
},
"[html]": {
"editor.formatOnSave": false,
"editor.formatOnPaste": false,
"editor.renderWhitespace": "all",
"editor.acceptSuggestionOnEnter": "off"
},
"files.associations": {
"*.jsx": "javascriptreact",
"*.js": "javascriptreact"
},
"editor.snippetSuggestions": "top",
// When enabled, typing /** triggers documentation automatically.
"docthis.automaticForBlockComments": true,
// When enabled, type information is added to comment tags.
"docthis.includeTypes": true,
// When enabled, memberOf information is added to comment tags on class members.
"docthis.includeMemberOfOnClassMembers": true,
// When enabled, memberOf information is added to comment tags on interface members.
"docthis.includeMemberOfOnInterfaceMembers": true,
// When enabled, JSDoc comments for functions and methods will include @description.
"docthis.includeDescriptionTag": true,
// When enabled, hungarian notation will be used as a type hint.
"docthis.enableHungarianNotationEvaluation": true,
// When enabled, will use names of params & methods as type hints.
"docthis.inferTypesFromNames": true,
// When enabled, will add the @author tag.
"docthis.includeAuthorTag": true,
// When docthis.includeAuthorTag is enabled, will add @author tag with this value.
"docthis.authorName": "xgqfrms",
// HTML & overwrite User settings.json
"html.format.extraLiners": "",
"html.format.enable": false,
"html.format.contentUnformatted": "body, div, section, script, pre,code,textarea"
}



xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
Typescript & React & optional parameters & default parameters的更多相关文章
- ES6函数默认参数(Default Parameters)
语言更新时每一个新增的特性都是从千百万开发者需求里提取过来的,规范采用后能减少程序员的痛苦,带来便捷. 我们经常会这么写 function calc(x, y) { x = x || 0; y = y ...
- Java Security: Illegal key size or default parameters?
来自:http://stackoverflow.com/questions/6481627/java-security-illegal-key-size-or-default-parameters I ...
- AES加密时抛出 Illegal key size or default parameters
使用AES加密时,当密钥大于128时,代码会抛出java.security.InvalidKeyException: Illegal key size or default parameters Il ...
- java中的AES 256算法遇到 Illegal key size or default parameters错的解决办法
国内私募机构九鼎控股打造APP,来就送 20元现金领取地址:http://jdb.jiudingcapital.com/phone.html 内部邀请码:C8E245J (不写邀请码,没有现金送) 国 ...
- Caused by: java.security.InvalidKeyException: Illegal key size or default parameters
How to remove the key size restriction in Java JDK? Are you developing your beautiful application us ...
- Java学习-050-AES256 之 java.security.InvalidKeyException: Illegal key size or default parameters 解决方法
在进行 Java AES 加密测试时,出现如下错误信息: java.security.InvalidKeyException: Illegal key size or default paramete ...
- AES加密时抛出java.security.InvalidKeyException: Illegal key size or default parametersIllegal key size or default parameters
使用AES加密时,当密钥大于128时,代码会抛出java.security.InvalidKeyException: Illegal key size or default parameters Il ...
- 微信退款异步通知报错Illegal key size or default parameters 的解决办法
问题原因: Java几乎各种常用加密算法都能找到对应的实现.因为美国的出口限制,Sun通过权限文件(local_policy.jar.US_export_policy.jar)做了相应限制.因此存在一 ...
- AES的256位密钥加解密报 java.security.InvalidKeyException: Illegal key size or default parameters 异常的处理及处理工具
一.出现的现象为了数据代码在传输过程中的安全,很多时候我们都会将要传输的数据进行加密,然后等对方拿到后再解密使用.我们在使用AES加解密的时候,在遇到128位密钥加解密的时候,没有进行什么特殊处理:然 ...
随机推荐
- 【Source Insight】查找功能 Lookup References 详解
1.Options Case Sensitive //区分大小写 Whole Words Only //全字匹配查找 Skip Inactive Code //跳过无效代码查找 Skip Commen ...
- POJ1195 二维线段树
Mobile phones POJ - 1195 Suppose that the fourth generation mobile phone base stations in the Tamper ...
- centos7 快速搭建redis集群环境
本文主要是记录一下快速搭建redis集群环境的方式. 环境简介:centos 7 + redis-3.2.4 本次用两个服务6个节点来搭建:192.168.116.120 和 192.168.1 ...
- K8s 二、(1、kubeadm部署Kubernetes集群)
准备工作 满足安装 Docker 项目所需的要求,比如 64 位的 Linux 操作系统.3.10 及以上的内核版本: x86 或者 ARM 架构均可: 机器之间网络互通,这是将来容器之间网络互通的前 ...
- Dos命令思维导图
通过思维导图的方式,总结常用Dos命令. 各种思维导图下载地址
- linux c驴杂记
C语言标准库中包含了各种用于处理错误的函数和宏.1.assert( ) 宏 #include<assert.h>void assert( int expression );可用于诊断程序b ...
- 2019牛客暑期多校训练营(第二场)A Eddy Walker(打表求概率)
题意:给你n,m分别表示 长度为n的环 和最后走到的位置m 问从0点出发每次都能能往前或者往后走 求最后在m点的概率思路:我们可以先打表模拟一下 发现好像每个点的概率大概都是1/(n-1) 打表代码: ...
- CF 666E Forensic Examination 【SAM 倍增 线段树合并】
CF 666E Forensic Examination 题意: 给出一个串\(s\)和\(n\)个串\(t_i\),\(q\)次询问,每次询问串\(s\)的子串\(s[p_l:p_r]\)在串\(t ...
- HDU4787 GRE Words Revenge【AC自动机 分块】
HDU4787 GRE Words Revenge 题意: \(N\)次操作,每次记录一个\(01\)串或者查询一个\(01\)串能匹配多少个记录的串,强制在线 题解: 在线的AC自动机,利用分块来降 ...
- Codeforces Round #681 (Div. 2, based on VK Cup 2019-2020 - Final) C. The Delivery Dilemma (贪心,结构体排序)
题意:你要买\(n\)份午饭,你可以选择自己去买,或者叫外卖,每份午饭\(i\)自己去买需要消耗时间\(b_i\),叫外卖需要\(a_i\),外卖可以同时送,自己只能买完一份后回家再去买下一份,问最少 ...