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位密钥加解密的时候,没有进行什么特殊处理:然 ...
随机推荐
- Springboot中mybatis控制台打印sql语句
Springboot中mybatis控制台打印sql语句 https://www.jianshu.com/p/3cfe5f6e9174 https://www.jianshu.com/go-wild? ...
- PAT甲级1056Mice and Rice
目录 题目介绍 题解 解题思路 代码 参考链接 题目介绍 题目链接 https://pintia.cn/problem-sets/994805342720868352/problems/9948054 ...
- luoguP4999 烦人的数学作业
写在前面 这两天信息量有点大,需要好好消化一下,呼呼 \(f[i][j]\) 的转移式还是好理解的,但是对于其实际意义课上有点糊 求 \(ans_{1, x}\) 是感觉手动把数拆开看会好理解一点?? ...
- 写给小白的 Nginx 文章
原文地址:Nginx concepts I wish I knew years ago 原文作者:Aemie Jariwala(已授权) 译者 & 校正:HelloGitHub-小鱼干 &am ...
- 浏览器关闭后,Session就销毁了吗?
https://blog.csdn.net/QQ1012421396/article/details/70842148 话题: 当浏览器关闭后,Session就销毁了吗?答案: ...
- 在线工具生成接入信息mqtt.fx快速接入阿里云
在线工具生成接入信息mqtt.fx快速接入阿里云 在使用阿里云获取的三元组信息进行接入的时候,往往需要加密生成接入信息之后才能进行接入,因此我根据阿里云提供的加密工具实现了一个阿里云物联网平台mqtt ...
- Flink-v1.12官方网站翻译-P026-State Backends
状态后台 Flink提供了不同的状态后端,指定状态的存储方式和位置. 状态可以位于Java的堆上或离堆.根据你的状态后端,Flink还可以为应用程序管理状态,这意味着Flink处理内存管理(必要时可能 ...
- Flink-v1.12官方网站翻译-P023-The Broadcast State Pattern
广播状态模式 在本节中,您将了解如何在实践中使用广播状态.请参考状态流处理,了解状态流处理背后的概念. 提供的API 为了展示所提供的API,我们将在介绍它们的全部功能之前先举一个例子.作为我们的运行 ...
- 设计模式(十二)——享元模式(Integer缓冲池源码分析)
1 展示网站项目需求 小型的外包项目,给客户 A 做一个产品展示网站,客户 A 的朋友感觉效果不错,也希望做这样的产品展示网站,但是要求都有些不同: 1) 有客户要求以新闻的形式发布 2) 有客户人要 ...
- Codeforces Round #681 (Div. 2, based on VK Cup 2019-2020 - Final) D. Extreme Subtraction (贪心)
题意:有一个长度为\(n\)的序列,可以任意取\(k(1\le k\le n)\),对序列前\(k\)项或者后\(k\)减\(1\),可以进行任意次操作,问是否可以使所有元素都变成\(0\). 题解: ...