Skip to content

Reconsider capIsNew: false for new-cap #2200

@kevinoid

Description

@kevinoid

With eslint-config-airbnb-base@8.0.0 the code

class Example {}
module.exports = Example();

would result in the error:

example.js:2:18: A function with a name starting with an uppercase letter should only be used as a constructor. [Error/new-cap]

As a result of #1090, which set capIsNew: false for new-cap, this is no longer the case.

#1089 (comment) which motivated the change only mentions adding "capIsNewExceptions": ["Immutable.Map", "Immutable.Set", "Immutable.List"]. Would it make sense to revert capIsNew: false (and perhaps adopt "capIsNewExceptionPattern": "^Immutable.\\w" as suggested in #1106) or was there another rationale for setting capIsNew: false?

Thanks,
Kevin

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions