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位密钥加解密的时候,没有进行什么特殊处理:然 ...
随机推荐
- 权限过大 ssh协议通过pem文件登陆
root@oneweek:~# ssh -i uat.pem root@110.5.15.6@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ...
- Python基础(if语句、运算符)
if语句的简单用法 每条if 语句的核心都是一个值为True 或False 的表达式 (简称条件测试),python根据条件测试的值来判断是否执行if语句后面的代码块,如果为true,执行:为fals ...
- 浅谈自动化构建之gulp
一.gulp的基本使用 gulp是目前最流行的前端自动化构建系统,核心特点高效易用.(这块不过多的废话了,直接上干货了,有兴趣的话,可以查下gulp简介) 步骤如下: yarn init -y yar ...
- Struts 2 学习(一)
文章目录 @[toc] #Struts及其优势 Struts 2 是一个MVC框架,以WebWork设计思想为核心,吸收了Struts 1的部分优点. Struts 2拥有更加广阔的前景,自身功能强大 ...
- 周期性清除Spark Streaming流状态的方法
在Spark Streaming程序中,若需要使用有状态的流来统计一些累积性的指标,比如各个商品的PV.简单的代码描述如下,使用mapWithState()算子: val productPvStrea ...
- HDU 1564 Play a game && HDU 2147 kiki's game
HDU 1564 Play a game题意: 棋盘的大小是n*n.一块石头被放在一个角落的广场上.他们交替进行,8600人先走.每次,玩家可以将石头水平或垂直移动到一个未访问的邻居广场.谁不采取行动 ...
- Codeforces Round #272 (Div. 2) B. Dreamoon and WiFi (暴力二进制枚举)
题意:给你一个只含\(+\)和\(-\)的字符串,统计它的加减和,然后再给你一个包含\(+,-,?\)的字符串,其中\(?\)可以表示为\(+\)或\(-\),问有多少种情况使得第二个字符串的加减和等 ...
- Codeforces Round #669 (Div. 2) A. Ahahahahahahahaha (构造)
题意:有一个长度为偶数只含\(0\)和\(1\)的序列,你可以移除最多\(\frac{n}{2}\)个位置的元素,使得操作后奇数位置的元素和等于偶数位置的元素和,求新序列. 题解:统计\(0\)和\( ...
- Python——Django框架——Form框架
一.引入Form包 from django import forms 二.定义规则 class Forms_Login(forms.Form): 用户名 = forms.CharField(requi ...
- select(),fd_set(),fd_isset()
1. select函数 1. 用途 在编程的过程中,经常会遇到许多阻塞的函数,好像read和网络编程时使用的recv, recvfrom函数都是阻塞的函数,当函数不能成功执行的时候,程序就会一直阻塞在 ...