Skip to content

[prefer-readonly-parameter-types] Using prefer-readonly-parameter-types rule with lib.dom #1727

@denis-afanasev

Description

@denis-afanasev

I can't figure out how to use prefer-readonly-parameter-types rule on interop with DOM (lib.dom typings).

Previously i using @typescript-eslint/eslint-plugin: ^2.20.0 and have code like this:

class SomeClass {
...
    public someFunc(element: HTMLElement): void {
        ...
    }
}

After update to 2.23.0 i got a eslint error
Parameter should be a read only typeeslint(@typescript-eslint/prefer-readonly-parameter-types)
This rule require something like

class SomeClass {
...
    public someFunc(element: Readonly<HTMLElement>): void {
        ...
    }
}

After that i got next error on the same place Make all properties in T readonly.
It means that i should modify external library's code to fix that error, but it's impossible

I think that lib.dom (HTMLElement, etc) just 1 out of many errors from this rule on project-library interop layer.

This error caused by #1513
So I suggest to switch rule level from error to warn in packages/eslint-plugin/src/configs/all.json

Metadata

Metadata

Assignees

No one assigned

    Labels

    package: eslint-pluginIssues related to @typescript-eslint/eslint-pluginworking as intendedIssues that are closed as they are working as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy