Skip to content

Conversation

JasonWeinzierl
Copy link
Owner

@JasonWeinzierl JasonWeinzierl commented Nov 22, 2024

Introduces a new configuration strict for enforcing more difficult-yet-generally-useful RxJS rules/conventions.

  • Includes all rules from recommended.
  • Plus adds these rules:
    • no-explicit-generics
    • no-exposed-subjects
    • no-ignored-default-value
    • no-ignored-error
    • no-ignored-observable
    • no-subclass
    • no-topromise*
    • prefer-observer*
    • prefer-root-operators*
    • throw-error*
  • *these indicated rules will soon be added to recommended. See Changes to the recommended config #35 .
  • Added unit tests for ensuring the rule.meta.docs.recommended metadata stays in sync with the configs.

Resolves #36 .

Copy link

github-actions bot commented Nov 22, 2024

LCOV of commit 9ae8db5 during .github/workflows/ci.yml #121

Summary coverage rate:
  lines......: 96.3% (3688 of 3830 lines)
  functions..: 95.6% (238 of 249 functions)
  branches...: 91.3% (733 of 803 branches)

Files changed coverage rate:
                                         |Lines       |Functions  |Branches    
  Filename                               |Rate     Num|Rate    Num|Rate     Num
  =============================================================================
  src/configs/recommended.ts             | 100%     24| 100%     1| 100%      1
  src/configs/strict.ts                  | 100%     39| 100%     1| 100%      1
  src/index.ts                           | 100%    103|    -     0|    -      0
  src/rules/no-async-subscribe.ts        | 100%     46| 100%     2| 100%      3
  src/rules/no-create.ts                 | 100%     32| 100%     2| 100%      2
  src/rules/no-explicit-generics.ts      | 100%     54| 100%     4| 100%     10
  src/rules/no-exposed-subjects.ts       |96.5%    114| 100%     2|86.7%     15
  src/rules/no-ignored-default-value.ts  |98.1%    103| 100%    10|97.0%     33
  src/rules/no-ignored-error.ts          |98.6%     73| 100%     6|95.2%     21
  src/rules/no-ignored-notifier.ts       | 100%     76| 100%     5| 100%     14
  src/rules/no-ignored-observable.ts     | 100%     30| 100%     2| 100%      3
  src/rules/no-ignored-replay-buffer.ts  | 100%     75| 100%     7| 100%     13
  src/rules/no-ignored-takewhile-value.ts| 100%     56| 100%     4| 100%     14
  src/rules/no-implicit-any-catch.ts     |98.8%    164| 100%     6|96.6%     29
  src/rules/no-index.ts                  | 100%     27| 100%     1| 100%      2
  src/rules/no-internal.ts               |86.8%     76| 100%     3|78.9%     19
  src/rules/no-nested-subscribe.ts       | 100%     49| 100%     1| 100%     11
  src/rules/no-redundant-notify.ts       |84.4%     90| 100%     4|53.3%     15
  src/rules/no-sharereplay.ts            | 100%     49| 100%     2| 100%      7
  src/rules/no-subclass.ts               | 100%     45| 100%     1| 100%      4
  src/rules/no-subject-unsubscribe.ts    | 100%     47| 100%     3| 100%      4
  src/rules/no-topromise.ts              |94.9%     98| 100%     4|82.6%     23
  src/rules/no-unbound-methods.ts        |97.2%     72| 100%     6|92.9%     14
  src/rules/no-unsafe-subject-next.ts    | 100%     54| 100%     1| 100%     14
  src/rules/no-unsafe-takeuntil.ts       |96.3%    109| 100%     2|88.9%     18
  src/rules/prefer-observer.ts           | 100%    126| 100%     6|97.2%     36
  src/rules/prefer-root-operators.ts     |94.9%    138| 100%    16|90.7%     43
  src/rules/throw-error.ts               | 100%     76| 100%     5|93.3%     15
  src/utils.ts                           | 100%     22| 100%     2| 100%      9

JasonWeinzierl added a commit that referenced this pull request Nov 24, 2024
BREAKING CHANGE: allowExplicitAny now defaults to `true` instead of
`false`.

This change was made for several reasons:

1. To align with other rules in this codebase dealing with explicit
`any` (namely `throw-error`, which allows `any` by default).
2. To align with the rule's name: to a casual reader, this rule seems to
only ban implicit `any`, not explicit too.
3. Lax codebases often change allowExplicitAny to `true`, or they
disable this rule entirely.
- By relaxing the default options, developers will be encouraged to at
least add an explicit annotation, and stricter codebases can re-opt-in
to banning `any`.
- Strict codebases likely already have typescript-eslint's
no-explicit-any turned on, so this shouldn't reduce practical coverage.
5. The upcoming `strict` config will set this option back to `false`.
See #36 and #41 .
@JasonWeinzierl JasonWeinzierl merged commit f2bf3fa into main Nov 24, 2024
2 checks passed
@JasonWeinzierl JasonWeinzierl deleted the strict-config branch November 24, 2024 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Introduce a strict config
1 participant