Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(eslint-plugin): [prefer-readonly-parameter-types] added an optio…
…nal 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 <[email protected]> * 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 <[email protected]> * 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 <[email protected]> * 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 <[email protected]> Co-authored-by: Josh Goldberg <[email protected]>
- Loading branch information