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

Validation error after 0.31.1 update #169

Closed
marcusmotill opened this issue May 17, 2017 · 9 comments
Closed

Validation error after 0.31.1 update #169

marcusmotill opened this issue May 17, 2017 · 9 comments
Labels

Comments

@marcusmotill
Copy link

Unable to run prettier from key board shortcut after updating my plugin today.

Error showing up on screen:

 Validation Error:
  Option "tabWidth" must be of type:
    number
  but instead received:
    string
  Example:
  {
    "tabWidth": 2
  }

Debug:

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

Here are my settings:
image

I have tried to unset and reset the tab width setting but it still saves as a string. Seems like there is a cast missing

@robwise
Copy link
Collaborator

robwise commented May 17, 2017

@marcusmotill We've had users report very similar errors off and on, but we're still unable to track down the problem. I personally believe it's an Atom bug, where an old config schema somehow gets left behind.

This is Atom, not our plugin, that's throwing the error, despite our config clearing asking for a string, and it working for most users: https://github.com/prettier/prettier-atom/blob/master/src/config-schema.json#L132

A couple of months ago, this did use to be an integer type, which would throw the error you're seeing. I would try somehow clearing any atom cache or maybe even restarting your computer? Please let us know if you figure out how to fix it.

@marcusmotill
Copy link
Author

I went into my config.cson file and change the value from a string to an integer manually and it worked. Clearing cache and restarting did not work

@robwise
Copy link
Collaborator

robwise commented May 17, 2017

@marcusmotill Yess!!!! Thank you so much for figuring that out and reporting back!

@darahak
Copy link
Collaborator

darahak commented May 17, 2017

I don't understand how this keeps happening.
If I use invalid types on purpose in my config.cson, the invalid settings are erased when Atom reloads (see atom/atom#5280).

It might keep happening on every update.
I'd really like to figure it out.

@marcusmotill Did you try to open DevTools and see if there was any error/warning in the console?

@tomaskazatel
Copy link

I have same problem. After manualy change number of tabs in config it works.

@marcusmotill
Copy link
Author

@darahak I did not notice anything in the console but was not vigilantly checking it either. :/

@darahak
Copy link
Collaborator

darahak commented Jun 1, 2017

If someone gets this error again, could you try this and retry?

Open Atom with this CLI option: --clear-window-storage.
See Clearing Saved State from Atom's documentation.

@charlesvinette
Copy link

Hey @darahak. I did get the error and tried what you suggested but it didn't work, had to go directly in config.cson

@lewisblackwood
Copy link

Thanks @darahak, that worked for me!

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

6 participants