Electron-vue: 'electron' should be listed in the project's dependencies, not devDependencies

Created on 5 Oct 2017  ·  3Comments  ·  Source: SimulatedGREG/electron-vue

Thank you for this awesome repo. It's a great way to get started with electron quickly! :clinking_glasses: I hope this is the right place for this question.

I am following along with Read & Write Local Files.

When running yarn dev, I get the following lint error: 'electron' should be listed in the project's dependencies, not devDependencies

The offending line reads: import { remote } from 'electron';

My first instinct is to have eslint ignore the rule in that line:
import { remote } from 'electron'; // eslint-disable-line import/no-extraneous-dependencies

That seems to work fine, but is this the right way to import the electron module into the renderer process?

Most helpful comment

I Just ran into the same issue. You can also add this to your eslint config file which is safer IMHO:

# .eslintrc.yml
settings:
  import/core-modules: [ electron ]

https://github.com/benmosher/eslint-plugin-import#importcore-modules

All 3 comments

This would be a little more related to eslint-plugin-import. They cover this in their docs, https://www.npmjs.com/package/eslint-plugin-import#importcore-modules. I've never ran into this warning beforehand, so my question is what text editor are you using?

set rules "import/no-extraneous-dependencies": ["error", { "devDependencies": true }] is ok

I Just ran into the same issue. You can also add this to your eslint config file which is safer IMHO:

# .eslintrc.yml
settings:
  import/core-modules: [ electron ]

https://github.com/benmosher/eslint-plugin-import#importcore-modules

Was this page helpful?
0 / 5 - 0 ratings