-
Notifications
You must be signed in to change notification settings - Fork 887
Analysis: Determine which tslint-microsoft-contrib rules should be moved to tslint #1142
Comments
Thanks for posting this @HamletDRC! I probably won't get to make a response until next week, but it's on my todo list |
I think one guiding principle here will be that TSLint won't include library specific rules, which would rules things like 1 out. Here's a quick list of what I'm thinking for each rule:
A lot of these sound like good rules, just not suitable as ones built-in to TSLint, but perfect for a package of custom rules as they are in now. @adidahiya What do you think about the "unsure"/"yes" rules? |
Relevant to rule 24, looks like there's now a PR for it: #1191 |
So we are left with these rules needing a decision:
Also, 27 (no-unnecessary-semicolons) is not covered by the tslint semi-colon rule as far as I can tell. |
What exactly would you mean by "stay in tslint-microsoft-contrib" are you saying that we should run two different linters on our codebase, or replace tslint all together? If not then I would say that we(you) should include no-unnecessary-semicolons. I'm working on converting an existing project to TS and I'm doing so on a file-by-file basis. |
tslint-microsoft-contrib is a package of extra rules that can be run by TSLint to check your TS code. This issue is just about moving rules from the external tslint-microsoft-contrib package to the core TSLint package |
|
If it helps, no-self-this is now no-this-assignment in TSLint itself. |
Here are a few more rules to propose to be added:
Also, all the React-based rules should probably be triaged/moved to |
Has anyone on this thread thought about the licensing stuff? |
@ajafff I'm hazy on the exact legal practices here, but would it be enough if I took responsibility for the rules and submitted newly-written-from-scratch equivalents for all of them? It should be fairly quick. |
@JoshuaKGoldberg I guess that could work. Though it depends on how much the new implementation differs from the original. If it was Apache 2.0 you were required to keep the copyright notice, even if you have completely rewritten all code that originally had the Apache 2.0 license. MIT doesn't seem to require this, it just requires the notice in "copies or substantial portions of the Software". |
Good news! I reviewed this use case with the legal representatives on the Microsoft side, and there are no legal blockers on our end. I'll send some pull requests. ❤ In more detail: for Microsoft devs who've already been cleared to contribute to TSLint, because the tslint-microsoft-contrib code was already released on open source and is not relevant to business&IP-related patents, we're cleared to redistribute and/or contribute it under another organization's project. |
Adding a comment for Personally I'd rather see the internal |
Per #4534, this is no longer relevant. https://typescript-eslint.io will receive rule donations instead. 🚀 |
I'd like to know which of the tslint-microsoft-contrib rules you'd like me to merge back into the tslint product. We can discuss the rules here and then I can later create an issue and pull request for each of the rules we want to port.
NOTE: Answer has been edited to incorporate the feedback in comments.
Rules to Merge to TS Lint
max-func-body-length
You can setup a general max function body length applied for every function/method/arrow function e.g. [true, 30] or set different maximum length for every type e.g. [true, { "func-body-length": 10 , "arrow-body-length": 5, "method-body-length": 15, "ctor-body-length": 5 }]. To specify a function name whose parameters you can ignore for this rule, pass a regular expression as a string(this can be useful for Mocha users to ignore the describe() function)
no-for-in
no-missing-visibility-modifiers
no-unnecessary-bind
no-with-statement
Rules to Discuss Further
missing-jsdoc
no-banned-terms
no-delete-expression
no-empty-interfaces
no-function-constructor-with-string-args
no-function-expression
no-increment-decrement
no-multiline-string
no-octal-literal
prefer-array-literal
promise-must-complete
Rules that Remain in Contrib
chai-vague-errors
expect(something).to.be.true
will result in the failure message "Expected true received false". This is a vague error message that does not reveal the underlying problem. It is especially vague in TypeScript because stack trace line numbers often do not match the source code. A better pattern to follow is the xUnit Patterns Assertion Message pattern. The previous code sample could be better written asexpect(something).to.equal(true, 'expected something to have occurred');
export-name
jquery-deferred-must-complete
missing-optional-annotation
mocha-avoid-only
no-backbone-get-set-outside-model
no-cookies
no-disable-auto-sanitization
no-document-write
no-duplicate-parameter-names
no-exec-script
no-http-string
no-multiple-var-decl
no-reserved-keywords
no-unnecessary-semicolons
use-named-parameter
The text was updated successfully, but these errors were encountered: