Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

functional/prefer-immutable-types Limit only to specific types #577

Closed
RebeccaStevens opened this issue Mar 18, 2023 · 4 comments · Fixed by #683
Closed

functional/prefer-immutable-types Limit only to specific types #577

RebeccaStevens opened this issue Mar 18, 2023 · 4 comments · Fixed by #683
Labels
Status: Blocked Progress on this issue is currently not possible. Status: Released It's now live. Type: Feature New features or options.

Comments

@RebeccaStevens
Copy link
Collaborator

Suggestion

Use the same approach as typescript-eslint/typescript-eslint#4436

Blocked until @typescript-eslint/type-utils v6 is released.

@RebeccaStevens RebeccaStevens added Status: Blocked Progress on this issue is currently not possible. Type: Feature New features or options. labels Mar 18, 2023
@zEh-
Copy link

zEh- commented Mar 30, 2023

Any update to this?

Would this fix const f = (p: string) => ... reporting Error: Parameter should have an immutability of at least "ReadonlyShallow" (actual: "Unknown")?

@RebeccaStevens
Copy link
Collaborator Author

I haven't started work on this yet but will soon.

This won't address that error you are getting. Could you give me the full type definition you are using.
Getting "Unknown" as the result suggest a bug due to an unhandled case is occurring.

@zEh-
Copy link

zEh- commented Mar 30, 2023

I get it in a bunch of places and am forced to disable enforcement altogether for now.
Happy to move this to a new issue. Just not sure what this relates to.

export const slugify = (text: string) => text.replace(...)
async function graphFetch(resource: `/${string}`) {
readonly onClick?: (ev: React.MouseEvent<HTMLElement>) => void
export const Switch = ({
  isActiveByDefault,
  onClick,
  title,
}: {
  readonly isActiveByDefault: boolean | undefined
  readonly onClick: (isActive: boolean) => void
  readonly title: string
}) => {
export const Tag = ({ children }: { readonly children: string }) => {
type Props = {
  readonly style?: CSSProperties
  readonly width: number
  readonly height: number
  readonly items: readonly Item[]
}

export const Bar = ({ style, width, height, items }: Props) => (

eslint config:

{
  "plugins": ["prettier", "simple-import-sort", "functional"],
  "extends": [
    "next/core-web-vitals",
    "plugin:functional/lite",
    "plugin:no-template-curly-in-string-fix/recommended",
    "plugin:prettier/recommended"
  ],
  "rules": {
    "prettier/prettier": "error",
    // minor non-related stylistic custom rules...
  }
}

@github-actions
Copy link

🎉 This issue has been resolved in version 6.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot added the Status: Released It's now live. label Jul 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Blocked Progress on this issue is currently not possible. Status: Released It's now live. Type: Feature New features or options.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants