-
Notifications
You must be signed in to change notification settings - Fork 490
Default tslint config has style rules #216
Comments
Because of this linter rule: https://github.com/wmonk/create-react-app-typescript/blob/master/packages/react-scripts/template/tslint.json#L64 You are right that this behavior is different from CRA. This topic is a bit complicated, since Personally, I'm using a {
"extends": [
"tslint:recommended",
"tslint-react",
"tslint-config-prettier"
]
} The last extension, while originally intended for use with |
@DorianGrey tslint-config-prettier doesn't handle explicitly defined that @apihlaja is talking about. The most obvious of which is: "quotemark": [true, "single", "jsx-double"], If you extend tslint-config-prettier and leave the @wmonk are you using prettier in your environment? As is, I'll probably just remove the explicitly defined rules one at a time from the Using the tslint-config-prettier CLI tool these are the affected rules:
|
Here is a npm i -D tslint-config-prettier {
"extends": ["tslint-react", "tslint-config-prettier"],
"rules": {
"ban": false,
"class-name": true,
"comment-format": [true, "check-space"],
"curly": true,
"eofline": false,
"forin": true,
"interface-name": [true, "never-prefix"],
"jsdoc-format": true,
"jsx-no-lambda": false,
"jsx-no-multiline-js": false,
"label-position": true,
"member-ordering": [
true,
"public-before-private",
"static-before-instance",
"variables-before-functions"
],
"no-any": true,
"no-arg": true,
"no-bitwise": true,
"no-console": [
true,
"log",
"error",
"debug",
"info",
"time",
"timeEnd",
"trace"
],
"no-construct": true,
"no-debugger": true,
"no-duplicate-variable": true,
"no-empty": true,
"no-eval": true,
"no-shadowed-variable": true,
"no-string-literal": true,
"no-switch-case-fall-through": true,
"no-trailing-whitespace": false,
"no-unused-expression": true,
"no-use-before-declare": true,
"radix": true,
"switch-default": true,
"trailing-comma": [false],
"triple-equals": [true, "allow-null-check"],
"typedef": [true, "parameter", "property-declaration"],
"variable-name": [
true,
"ban-keywords",
"check-format",
"allow-leading-underscore",
"allow-pascal-case"
]
}
} |
@vpicone - suppose we've got a misunderstanding here, because
was not my intention. The intention was to replace the currently used
entirely. The resulting behavior would be closer to what CRA achieves with the ESLint rules it utilizes ( tslint-eslint-rules might help out here as well). This would disable all styling rules conflicting with |
@DorianGrey You're totally right, I agree the explicit rule definitions here seem out of step with CRA. |
I got annoyed yesterday when working first time |
I changed quotation marks of
App.tsx
and now it doesn't pass provided tslint config, wrong quotation marks. That reveals quite significant disparity between original CRA and typescript version.I didn't find any documentation / discussion about the reasoning behind the difference. Ie. why does typescript version nitpick about quotation marks?
Edit: It seems original error was caused by me accidentally reformatting
App.tsx
but point stands.The text was updated successfully, but these errors were encountered: