-
Notifications
You must be signed in to change notification settings - Fork 286
Add tslint/prettier for linting/formatting. #299
Conversation
tslint.json
Outdated
@@ -0,0 +1,7 @@ | |||
{ | |||
"defaultSeverity": "error", | |||
"extends": ["tslint:recommended", "tslint-config-prettier"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking tslint-microsoft-contrib
vs tslint:recommended
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have zero experience with ts or tslint. Fine with me :)
Except for using |
I looked into it and it appears that Those rules only work if you lint the entire project at once with a grunt task... Maybe we could start with this and switch to better rules as they become available? Better some tslint than no tslint :) |
I'm not following. The |
My understanding of these tools is not great so I could be wrong. The
|
Yep, got that. That just means we are going to need to support also having people being able to run TSLint over the whole project (possibly via a task that can be run within VSCode so you still get feedback in the problems section). |
I think there's value in tslint regardless of the ruleset applied. If you think the We can add a task to run with Let me try turning it on here and see how it feels. Maybe we can disable the invalid rules in the vscode-tslint config to avoid warning spam. |
Please switch it to |
Sure. How about this? I disabled a few rules that were overly noisy. I think it's generating some useful stuff now. If you have some experience with tslint it would be great if you could help me customize the ruleset a bit... |
Oh, and here's a sample of the errors produced:
|
BTW, this is the default config that {
"rules": {
"no-string-throw": true,
"no-unused-expression": true,
"no-duplicate-variable": true,
"curly": true,
"class-name": true,
"semicolon": [true, "always", "ignore-bound-class-methods"],
"triple-equals": true
},
"defaultSeverity": "warning"
} Might be worth considering. Let me know if you want me to fix these conflicts or make changes to get it merged. |
This change adds tslint & prettier as dev dependencies and recommends the vscode extensions as well. Using tslint will increase the quality of our work with very little dev cost. Prettier will auto-format our js and ts files on save. This sidesteps all problems related to code formatting, since prettier will just take care of it for us.
There are no code changes in this PR. Once this is merged, we should go ahead and run tslint and prettier across the entire source tree as a single PR. Otherwise we'll suffer through piecemeal diffs for subsequent PRs.
If we agree that this is a step we'd like to take, please read the proposed
.prettierrc
below. You can see the full list of options here:https://prettier.io/docs/en/options.html
Personally I don't care very much about the specific prettier settings. That's the great thing about adopting prettier - using it helps you stop caring about formatting. :)