-
Notifications
You must be signed in to change notification settings - Fork 532
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Establish lint config and use across repo #9501
Comments
Personally, I would be in favor of adding no-implicit-coercion to the list as well, as I think it greatly enhances readability. |
Nice! I didn't know about that rule. I added it towards the top of the list, but I'd like to also do a check to see if we have a ton of violations in the current code. I need to write down how to do that in the wiki, so this is a good opportunity to document it as I go. |
I'm also curious what folks' opinions are on adding the |
@tylerbutler What do you think about adding this rule to our strict config? Would require that tsdoc comments always include the description field. For generated API docs in particular, I think this would be useful to enforce. |
I was also going to suggest multiline-blocks with |
@Josmithr I love these additions. I think we should chat about the minimal/recommended/strict configs and how we envision them being used long-term. @ChumpChief has made good points in the past of the value of having a single config that is quite strict. If that's our end-goal, we might change how we stage the changes. I'll spin up a separate conversation about this.
I do like the intention here, but I want to be careful to not reward "useless docs" that meet the 'requirements' but don't help developers. I.e. I don't want to incentivize people to write bad docs just to make the linter happy. That said, that's no reason not to turn on the rule. Rather, we should monitor the quality of the docs and adjust accordingly. |
100% agree. I see the linter rule as a nudge to the dev to think about the need to write docs. We need to leverage best practices and code reviews to ensure what is produced is quality. |
I think we may want to reconsider |
Hmm, this may be something that I like because Python has it, and it fits my mental model better. I could go either way. |
It could definitely be that I am in the minority for this too, and my opinion on this one isn't a super strong. Maybe worth getting more opinions on. |
Another rule worth considering: https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/consistent-type-imports.md Preferring type imports whenever possible will likely help us reduce bundle sizes pretty effectively, and I think it's a good habit for devs to get into. |
Our lint config used through most of the repo is insufficient. We need to establish a baseline config that is stricter to maintain overall code quality in the repo.
The plan
For each of the rules to be enabled, we'll make (a) a PR that enables the rule in the shared config and pre-applies fixes for the rule. Once that is merged, then (b) a pre-release shared config package is released, and then we can (c) update the version of the shared config used in the repo.
Step (a) might happen several times before (b) or (c), effectively 'batching' the config changes when it comes time to apply them to the repo.
This approach requires more bookkeeping but helps keep each individual PR focused and makes them easier to review, because all the code changes in a PR should be similar. Also, because each PR is a single rule, it's easy to have "should this rule even be turned on?" discussions without completely derailing the review.
Rules not yet done are listed first so they're easier to find. They're listed in the order we'll create PRs, and the order will be adjusted as needed.
If a rule you want to enabled is missing from the list, leave a comment. If you want to see a rule enabled sooner, leave a comment. If you have any feedback about the plan, leave a comment. 😄
Note on the unicorn rules: they are mostly from the unicorn/recommended config.
Remaining rules
See https://github.com/microsoft/FluidFramework/wiki/ESLint for how to create a PR to enable any of the rules below.
Formatting only
Code-impacting
valid-typeof
rule #10623Enable(already enabled via inheritance)use-isnan
eslint rule to base config and pre-apply fixes #10324@typescript-eslint/no-unused-vars
eslint rule and pre-apply fixes #10359unicorn/prefer-type-error
rule and pre-apply fixes #10645unicorn/prefer-switch
rule #10646unicorn/prefer-ternary
rule and pre-apply fixes #10661Documentation
jsdoc/check-access
and pre-fix violations #10578jsdoc/require-hyphen-before-param-description
#10585publicOnly
set to true.Strict
These rules are very strict and may make sense to enable on a package-by-package basis, rather than repo-wide like with the other rules. For that reason, I suggest we enable these in a separate strict config. I'm leaving them until last because applying them will be time consuming.
Done
Formatting round 1 (#10056)
Other formatting
Phase 1
Other
eslint-plugin-jsdoc
to allow enforcement of source code docs style, and potentially enforce docs presence in the future #10317Notes
The text was updated successfully, but these errors were encountered: