Skip to content

Commit

Permalink
feat(prefer-immutable-types): change the options in recommeneded and …
Browse files Browse the repository at this point in the history
…lite configs

Recommended: Parameters must be deeply readonly when typed with a type defined in a local file.
Types defined in packages in the ts lib must be readonly shallow.

Lite: Parameters must be shallowly readonly when typed with a type defined in a local file.
There is no enforcement on types defined elsewhere.
  • Loading branch information
RebeccaStevens committed May 6, 2024
1 parent 0903137 commit d0bd5dd
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 8 deletions.
17 changes: 13 additions & 4 deletions src/configs/lite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,19 @@ const overrides = {
"error",
{
enforcement: "None",
ignoreInferredTypes: true,
parameters: {
enforcement: "ReadonlyShallow",
},
overrides: [
{
specifiers: {
from: "file",
},
options: {
ignoreInferredTypes: true,
parameters: {
enforcement: "ReadonlyShallow",
},
},
},
],
},
],
} satisfies FlatConfig.Config["rules"];
Expand Down
33 changes: 29 additions & 4 deletions src/configs/recommended.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,35 @@ const overrides = {
"error",
{
enforcement: "None",
ignoreInferredTypes: true,
parameters: {
enforcement: "ReadonlyDeep",
},
overrides: [
{
specifiers: [
{
from: "lib",
},
{
from: "package",
},
],
options: {
ignoreInferredTypes: true,
parameters: {
enforcement: "ReadonlyShallow",
},
},
},
{
specifiers: {
from: "file",
},
options: {
ignoreInferredTypes: true,
parameters: {
enforcement: "ReadonlyDeep",
},
},
},
],
},
],
[typeDeclarationImmutability.fullName]: [
Expand Down

0 comments on commit d0bd5dd

Please sign in to comment.