Skip to content

Add ability to ignore certain packages from all rules #275

Closed
@sindresorhus

Description

Electron exposes an const electron = require('electron'); import, but it's not listed anywhere, as it's more of an additional built-in. Same goes for atom, when creating Atom plugins.

I think we could just ignore these by default as no one would want it to be linted, but there also might be other cases of this, so would still be useful to have an ignore option.

Here's the errors I get when running this plugin on an Electron project:

  browser.js:2
  ✖  2:18  'electron' is not listed in the project's dependencies. Run 'npm i -S electron' to add it  import/no-extraneous-dependencies
  ✖  2:26  Unable to resolve path to module 'electron'.                                               import/no-unresolved

  index.js:4
  ✖  4:18  'electron' is not listed in the project's dependencies. Run 'npm i -S electron' to add it  import/no-extraneous-dependencies
  ✖  4:26  Unable to resolve path to module 'electron'.                                               import/no-unresolved

  menu.js:3
  ✖  3:18  'electron' is not listed in the project's dependencies. Run 'npm i -S electron' to add it  import/no-extraneous-dependencies
  ✖  3:26  Unable to resolve path to module 'electron'.                                               import/no-unresolved

  storage.js:4
  ✖  4:18  'electron' is not listed in the project's dependencies. Run 'npm i -S electron' to add it  import/no-extraneous-dependencies
  ✖  4:26  Unable to resolve path to module 'electron'.                                               import/no-unresolved

  tray.js:2
  ✖  2:18  'electron' is not listed in the project's dependencies. Run 'npm i -S electron' to add it  import/no-extraneous-dependencies
  ✖  2:26  Unable to resolve path to module 'electron'.                                               import/no-unresolved

Example import: https://github.com/sindresorhus/caprine/blob/2acdd358eafdc42b45b532c90e87ba5465a30de7/index.js#L4

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions