Skip to content

no-array-prototype-extensions still false-positives on many common mirage.js querying patterns #2339

@hoylemd

Description

@hoylemd

I was quite excited to see #2331 get merged, as it would allow me to remove a lot of in-line disable comments of the no-array-prototype-extensions rule in my mirage.js files. Unfortunately I've found a couple of cases of mirage findBy that aren't covered by that solution.

  • if the call chain starts with server or schema (common in mirage factories and config) and not this. or window., it's still flagged as a violation of no-array-prototype-extensions
  • it still requires both server and schema in the request chain. When defining mocked routes in mirage.config.js, only schema is passed in, not server, so a query would be server.modelName.findBy()
  • records can also be looked up in mirage via server.db.modelName.findBy, bypassing schema. (though I'm not sure this is something to be encouraged).

Could the regex perhaps be tweaked not to require a preceeding ., and only require that server and/or schema are in the request chain? or would that broaden the pattern too much?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions