Search code examples
atom-editorreact-starter-kit

Atom react starter kit lint error package.json


Update 27.10.17
updating linter-eslint to 8.4.0 did the trick, thanks to @holland's comment.

Original question:
Inside Atom Editor I get The package.json file could not be found. (import/no-extraneous-dependencies) error in all files, first line of code, but yarn lint passes through, meanings the problem is in the configuration of atom itself.

Any ideas?

List of lint packages currently installed:

  • linter 2.2.0
  • linter-csslint 2.0.0
  • linter-eslint 8.4.0
  • linter-flow 5.6.1
  • linter-ui-default 1.2.4

enter image description here


Solution

  • By itself, Atom has no means of understanding whether code is good or not. This specific error is being generated by the linter-eslint package, which relies on the external binary eslint. Sometimes linters have arbitrary style requirements, and sometimes they get out of date and need to be updated. The typical process for troubleshooting linters is to take a look at the specific linter's rule set to see if the error is supposed to be thrown in that context. Since linters are intended for enforcing good coding style in addition to highlighting syntax errors, a linter-originating error doesn't necessarily mean that the code is bad and won't run. That's a question that must be answered on a case-by-case basis.

    Testing linter packages generally requires a small amount of NPM experience (you can do it without Node, but it's easiest to download them via NPM). All you have to do is install the package globally and then run its command, which is trivially easy for someone who has done it before, but not necessarily easy for someone who doesn't know what the individual steps look like. For anyone reading this question in the future and dealing with a similar situation, I would recommend hopping onto the Atom forum or Slack and asking for a walkthrough.