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 Apr 22, 2024
1 parent 389d79d commit 3563ace
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 @@ -62,10 +62,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 3563ace

Please sign in to comment.