Commit c9427b7
feat(eslint-plugin): [prefer-readonly-parameter-types] added an optional type allowlist (#4436)
* feat(eslint-plugin): [prefer-readonly-parameter-types] Added an optional type whitelist
* chore(eslint-plugin): [prefer-readonly-parameter-types] whitelist -> allowlist
* feat(eslint-plugin): [prefer-readonly-parameter-types] Split the allowlist between internal and configurable
* fix(eslint-plugin): [prefer-readonly-parameter-types] Fixed lint issue with non-null assertion
* fix(eslint-plugin): [prefer-readonly-parameter-types] Using allowlist everywhere in deep readonlyness checks
* fix(eslint-plugin): [prefer-readonly-parameter-types] Passing internal allowlist from rule
* fix(eslint-plugin): [prefer-readonly-parameter-types] Decoupled options and schema of rule and util
* feat(eslint-plugin): [prefer-readonly-parameter-types] Added tests
* fix(eslint-plugin): [prefer-readonly-parameter-types] Added missing docs for option treatMethodsAsReadonly
* docs(eslint-plugin): [prefer-readonly-parameter-types] Added docs for allowlist
* fix(eslint-plugin): [prefer-readonly-parameter-types] Fixed regressions from merging main
* feat(eslint-plugin): [prefer-readonly-parameter-types] Merged exceptions and internalExceptions together to create a universal allowlist API
* feat(eslint-plugin): [prefer-readonly-parameter-types] Added a schema for type allowlist
* chore(eslint-plugin): [prefer-readonly-parameter-types] Split TypeAllowlistItem out into own file
* docs(eslint-plugin): [prefer-readonly-parameter-types] Updated docs for the more sophisticated allowlist
* docs(eslint-plugin): [prefer-readonly-parameter-types] Fixed allowlist option type
* test(eslint-plugin): [prefer-readonly-parameter-types] Added tests for type allowlist with wrong kinds of types
* chore(eslint-plugin): [prefer-readonly-parameter-types] Deduplicated default configuration
* fix(eslint-plugin): [prefer-readonly-parameter-types] Added back readonlynessOptionsSchema
* chore(eslint-plugin): [prefer-readonly-parameter-types] Removed default allowlist
* docs(eslint-plugin): [prefer-readonly-parameter-types] Fixed default allowlist in docs
* test(eslint-plugin): [prefer-readonly-parameter-types] Not using DOM in tests
* chore(eslint-plugin): [prefer-readonly-parameter-types] Using property shorthand
* feat(eslint-plugin): [prefer-readonly-parameter-types] TypeAllowlistItem is now a discriminated union
* docs(eslint-plugin): [prefer-readonly-parameter-types] TypeAllowlistItem is now a discriminated union - docs update
* test(type-utils): [prefer-readonly-parameter-types] Added rudimentary test for allowlist
* test(type-utils): [prefer-readonly-parameter-types] Added test for allowlist containing local definition
* Update packages/type-utils/src/TypeAllowListItem.ts to use enum in JSON schema
Co-authored-by: Brad Zacher <brad.zacher@gmail.com>
* fix(eslint-plugin): [prefer-readonly-parameter-types] Added trainling slash to package path check
* fix(eslint-plugin) Fixed type imports not being separated
* feat(type-utils): Added TypeOrValueSpecifier, its schema and test for the schema
* feat(type-utils): Added typeMatchesSpecifier() and switched isTypeReadonly over to TypeOrValueSpecifier
* fix(eslint-plugin): [prefer-readonly-parameter-types] Fixed tests having old allowlist format
* fix(type-utils): Removed unneeded function isTypeExcepted
* feat(type-utils): Added source file checking to typeMatchesFileSpecifier()
* docs(eslint-plugin): [prefer-readonly-parameter-types] Updated docs to use TypeOrValueSpecifier allowlist style
* docs(eslint-plugin): [prefer-readonly-parameter-types] Typo fix
* docs(eslint-plugin): [prefer-readonly-parameter-types] Typo fix 2
* feat(type-utils): Added tests for typeMatchesSpecifier()
* fix(type-utils): Using node path joining typeMatchesSpecifier()
* feat(type-utils): Removed MultiSourceSpecifier
* chore(type-utils): Simplified typeMatchesSpecifier()
* feat(type-utils): Added more tests for typeMatchesSpecifier()
* docs(prefer-readonly-parameter-types) more legible docs
Co-authored-by: Josh Goldberg <git@joshuakgoldberg.com>
* fix(eslint-plugin): [prefer-readonly-parameter-types] Fixed missing end of code listing in docs
* chore(type-utils): Simplified typeDeclaredInFile()
* chore(type-utils): Using unknown instead of any in tests
* test(type-utils): grammar fix in test specifications
* chore: Reset yarn.lock
* chore: renamed readonlyness allowlist to just allow
* fix(type-utils): fixed services.program now being optional and not checked in tests
* test(type-utils): negative tests for isTypeReadonly
* fix(eslint-plugin): bracket style array notation
Co-authored-by: Josh Goldberg <git@joshuakgoldberg.com>
* fix(type-utils): Fixed array style
* fix(type-utils): Not fetching symbol repeatedly
* fix(type-utils): Remove ManySpecifiers format from TypeOrValueSpecifier schema
* docs(eslint-plugin): [prefer-readonly-parameter-types] described file specifier path as being relative
* path and package
* Update docs too
* Update docs too (again)
* Added test name helpers, and fixed test data
* test(type-utils): fixed package schema tests
* test(eslint-plugin): fixed type whitelist schema in prefer-readonly-parameter-types tests
* Applied lowercasing to typeDeclaredInFile
---------
Co-authored-by: Brad Zacher <brad.zacher@gmail.com>
Co-authored-by: Josh Goldberg <git@joshuakgoldberg.com>1 parent 6652ebe commit c9427b7
10 files changed
Lines changed: 884 additions & 28 deletions
File tree
- packages
- eslint-plugin
- docs/rules
- src/rules
- tests/rules
- type-utils
- src
- tests
Lines changed: 95 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
132 | 227 | | |
133 | 228 | | |
134 | 229 | | |
| |||
Lines changed: 19 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | | - | |
| 11 | + | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
| |||
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| 30 | + | |
28 | 31 | | |
29 | 32 | | |
30 | 33 | | |
31 | 34 | | |
32 | 35 | | |
33 | 36 | | |
34 | | - | |
| 37 | + | |
| 38 | + | |
35 | 39 | | |
36 | 40 | | |
37 | 41 | | |
| |||
41 | 45 | | |
42 | 46 | | |
43 | 47 | | |
| 48 | + | |
44 | 49 | | |
45 | 50 | | |
46 | | - | |
| 51 | + | |
| 52 | + | |
47 | 53 | | |
48 | 54 | | |
49 | 55 | | |
50 | 56 | | |
51 | | - | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
52 | 65 | | |
53 | 66 | | |
54 | | - | |
55 | 67 | | |
56 | 68 | | |
57 | 69 | | |
| |||
94 | 106 | | |
95 | 107 | | |
96 | 108 | | |
97 | | - | |
| 109 | + | |
98 | 110 | | |
| 111 | + | |
99 | 112 | | |
100 | 113 | | |
101 | 114 | | |
| |||
Lines changed: 198 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
401 | 401 | | |
402 | 402 | | |
403 | 403 | | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
404 | 481 | | |
405 | 482 | | |
406 | 483 | | |
| |||
885 | 962 | | |
886 | 963 | | |
887 | 964 | | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
888 | 1086 | | |
889 | 1087 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
| |||
0 commit comments