Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Warning about linter-eslint fix on save (coming from prettier-atom) when linter-eslint is not installed #168

Closed
dinophile opened this issue May 17, 2017 · 7 comments
Assignees
Labels

Comments

@dinophile
Copy link

I keep getting a warning telling me that linter-eslint's fix on save feature is enabled (warning is coming from prettier-atom). But I don't even have the linter-eslint package installed in my editor...nothing obvious coming up other than the following from prettier:debug (and a line telling me that this issue has already been reported):

Error: ENOENT: no such file or directory, open 'package.json' at Error (native) at Object.fs.openSync (fs.js:640:18) at Object.module.(anonymous function) [as openSync] (ELECTRON_ASAR.js:168:20) at Object.fs.readFileSync (fs.js:508:33) at Object.fs.readFileSync (ELECTRON_ASAR.js:501:29) at Function.module.exports.sync.fp [as sync] (/home/cheyenne/.atom/packages/prettier-atom/node_modules/load-json-file/index.js:11:38) at Function.module.exports.sync (/home/cheyenne/.atom/packages/prettier-atom/node_modules/read-pkg/index.js:40:25) at getDebugInfo (/home/cheyenne/.atom/packages/prettier-atom/dist/displayDebugInfo/index.js:16:89) at displayDebugInfo (/home/cheyenne/.atom/packages/prettier-atom/dist/displayDebugInfo/index.js:21:13) at atom-workspace.lazyDisplayDebugInfo (/home/cheyenne/.atom/packages/prettier-atom/dist/main.js:58:3) at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/usr/share/atom/resources/app.asar/src/command-registry.js:259:29) at CommandRegistry.handleCommandEvent (/usr/share/atom/resources/app.asar/src/command-registry.js:3:59) at CommandRegistry.module.exports.CommandRegistry.dispatch (/usr/share/atom/resources/app.asar/src/command-registry.js:160:19) at AtomEnvironment.module.exports.AtomEnvironment.dispatchApplicationMenuCommand (/usr/share/atom/resources/app.asar/src/atom-environment.js:1162:28) at EventEmitter.outerCallback (/usr/share/atom/resources/app.asar/src/application-delegate.js:312:25) at emitThree (events.js:116:13) at EventEmitter.emit (events.js:194:7)

@robwise robwise added the bug label May 17, 2017
@robwise
Copy link
Collaborator

robwise commented May 17, 2017

@dinophile We had a bug in our debug script, I just pushed a new version (0.31.1), can you please update prettier-atom, and re-run the debug script. Also, can you please triple-check that you don't have linter-eslint installed? This error is only supposed to happen if all of the following are true at the same time:

  • have linter eslint
  • have linter-eslint autofix set to true
  • have prettier-atom's eslint integration enabled

@dinophile
Copy link
Author

Hi @robwise, thanks for getting back to me!

Upgraded to the new version, checked three times (just in case!) and I definitely don't have linter-eslint installed (or any of the linter packages) yet I still get the warning about linter's fix on save feature being active.

This time when I run the debug script this is the only output I get:

Atom version: 1.15.0
prettier-atom version: 0.31.1
prettier version: 1.3.1
prettier-eslint version: 6.2.2
prettier-atom configuration: {
  "formatOnSaveOptions": {
    "showInStatusBar": true,
    "enabled": false,
    "respectEslintignore": true,
    "scopes": [
      "source.js",
      "source.jsx",
      "source.js.jsx",
      "source.babel",
      "source.js-semantic",
      "text.html.basic",
      "text.html.vue"
    ],
    "excludedGlobs": [],
    "whitelistedGlobs": []
  },
  "prettierOptions": {
    "bracketSpacing": false,
    "singleQuote": false,
    "semi": true,
    "useTabs": false,
    "jsxBracketSameLine": false,
    "printWidth": 80,
    "tabWidth": "auto",
    "trailingComma": "none",
    "parser": "babylon"
  },
  "useEslint": true,
  "silenceErrors": false,
  "useEditorConfig": true,
  "prettierEslintOptions": {
    "prettierLast": false
  }
}

@darahak
Copy link
Collaborator

darahak commented May 17, 2017

@dinophile Are there any properties related to linter-eslint in your config.cson file? (could happen if you installed it before and removed it)

@robwise
Copy link
Collaborator

robwise commented May 17, 2017

^ oh yeah good thinking

@dinophile
Copy link
Author

dinophile commented May 17, 2017

Aha! And removing them did the trick! That was sneaky, yup the settings were still in my config file...once I removed them there was no more error! Did not even think to look there. Thanks a million @darahak and @robwise! :)

@darahak
Copy link
Collaborator

darahak commented May 17, 2017

Knowing this, maybe we should check if linter-eslint is actually installed.
I don't know what's the proper way to do this and how much it would cost though.

@robwise
Copy link
Collaborator

robwise commented May 17, 2017

@darahak Agreed, we should investigate if there's a way to tell if the package is actually installed and enabled instead of just checking for the value in the config. Then we could change the implementation here: https://github.com/prettier/prettier-atom/blob/master/src/atomInterface/index.js#L17

@darahak darahak self-assigned this May 20, 2017
darahak added a commit to darahak/prettier-atom that referenced this issue May 20, 2017
…eading user config

Config properties are not reset when a user uninstalls an Atom package. Because of that, a warning
about linter-eslint was displayed even though it was not installed.

Fixes prettier#168
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants