我使用 prettier 和 tslint,以及https://github.com/alexjoverm/tslint-config-prettier和https://github.com/ikatyang/tslint-plugin-prettier。
我tslint.json
的就像
{
"defaultSeverity": "error",
"extends": [
"tslint-config-airbnb",
"tslint-react",
"tslint-config-prettier"
],
"jsRules": {},
"rules": {
"max-line-length": [true, 80],
"import-name": false,
"variable-name": false,
"jsx-boolean-value": false,
"jsx-no-multiline-js": false,
"no-else-after-return": false,
"object-shorthand-properties-first": false,
"ter-arrow-parens": false,
"ter-indent": false,
"prettier": true
},
"rulesDirectory": ["tslint-plugin-prettier"]
}
我.prettierrc
的就像
{
"trailingComma": "all",
"singleQuote": true
}
之后tslint --fix "src/**/*.ts"
,出现如下代码:
import { getChildrenProceduresSelector } from '@src/entities/procedures/selectors';
错误说[tslint] Exceeds maximum line length of 80 (max-line-length)
。
但是当我手动修复它时
import {
getChildrenProceduresSelector,
} from '@src/entities/procedures/selectors';
它说
[tslint] Replace `⏎··getChildrenProceduresSelector,⏎` with `·getChildrenProceduresSelector·` (prettier)
我将 VSCode 与 tslint 和更漂亮的扩展一起使用。我的 tslint 命令说同样的错误。如何解决这种冲突?