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的更多相关文章

  1. ES6函数默认参数(Default Parameters)

    语言更新时每一个新增的特性都是从千百万开发者需求里提取过来的,规范采用后能减少程序员的痛苦,带来便捷. 我们经常会这么写 function calc(x, y) { x = x || 0; y = y ...

  2. Java Security: Illegal key size or default parameters?

    来自:http://stackoverflow.com/questions/6481627/java-security-illegal-key-size-or-default-parameters I ...

  3. AES加密时抛出 Illegal key size or default parameters

    使用AES加密时,当密钥大于128时,代码会抛出java.security.InvalidKeyException: Illegal key size or default parameters Il ...

  4. java中的AES 256算法遇到 Illegal key size or default parameters错的解决办法

    国内私募机构九鼎控股打造APP,来就送 20元现金领取地址:http://jdb.jiudingcapital.com/phone.html 内部邀请码:C8E245J (不写邀请码,没有现金送) 国 ...

  5. 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 ...

  6. Java学习-050-AES256 之 java.security.InvalidKeyException: Illegal key size or default parameters 解决方法

    在进行 Java AES 加密测试时,出现如下错误信息: java.security.InvalidKeyException: Illegal key size or default paramete ...

  7. 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 ...

  8. 微信退款异步通知报错Illegal key size or default parameters 的解决办法

    问题原因: Java几乎各种常用加密算法都能找到对应的实现.因为美国的出口限制,Sun通过权限文件(local_policy.jar.US_export_policy.jar)做了相应限制.因此存在一 ...

  9. AES的256位密钥加解密报 java.security.InvalidKeyException: Illegal key size or default parameters 异常的处理及处理工具

    一.出现的现象为了数据代码在传输过程中的安全,很多时候我们都会将要传输的数据进行加密,然后等对方拿到后再解密使用.我们在使用AES加解密的时候,在遇到128位密钥加解密的时候,没有进行什么特殊处理:然 ...

随机推荐

  1. 踹树(Trie 字典树)

    Trie 字典树 ~~ 比 KMP 简单多了,无脑子选手学不会KMP,不会结论题~~ 自己懒得造图了OI WIKI 真棒 字典树大概长这么个亚子 呕吼真棒 就是将读进去的字符串根据当前的字符是什么和所 ...

  2. ceph --- (简单操作及openstack交接)

    部署ceph :https://www.cnblogs.com/cloudhere/p/10519647.html Centos7部署ceph:https://www.cnblogs.com/kevi ...

  3. Flink-v1.12官方网站翻译-P012-Stateful Stream Processing

    有状态的流处理 什么是状态? 虽然数据流中的许多操作一次只看一个单独的事件(例如事件解析器),但有些操作会记住多个事件的信息(例如窗口操作符).这些操作被称为有状态操作.一些有状态操作的例子. - 当 ...

  4. Jenkins(7)参数化构建(构建git仓库分支)

    前言 当我们的自动化项目越来越多的时候,在代码仓库会提交不同的分支来管理,在用jenkins来构建的时候,我们希望能通过参数化构建git仓库的分支. 下载安装Git Parameter插件 系统管理- ...

  5. mybatis Sql语句配置详解

    sql语句配置 id sqlSession执行的唯一标识 resultMap 结果集封装映射,可用于内部对象一对多封装 resultType 返回的结果类型,直接就是一个po对象 resultSets ...

  6. 2020牛客暑期多校训练营(第四场) C - Count New String (字符串,广义后缀自动机,序列自动机)

    Count New String 题意: 定义字符串函数 \(f(S,x,y)(1\le x\le y\le n)\),返回一个长度为y-x+1的字符串,第 i 位是 \(max_{i=x...x+k ...

  7. Codeforces Round #626 Div2 D,E

    比赛链接: Codeforces Round #626 (Div. 2, based on Moscow Open Olympiad in Informatics) D.Present 题意: 给定大 ...

  8. 【noi 2.6_1808】最长公共子序列(DP)

    题意:给2个字符串求其最大公共子序列的长度.解法:这个和一般的状态定义有点不一样,f[i][j]表示 str 前i位和 str2 前j的最大公共子序列的长度,而不是选 str 的第i位和 str2 的 ...

  9. Codeforces Round #296 (Div. 2B. Error Correct System

    Ford Prefect got a job as a web developer for a small company that makes towels. His current work ta ...

  10. 2019牛客暑期多校训练营(第八场)B Beauty Values && C CDMA

    B题题意: 题目 给你n个数,让你把这一个序列中的所有子区间的Beauty Values加起来,Beauty Values是子区间内有几个不同的数 题解: 肯定不会是暴力,所以我们就要在各元素的位置上 ...