Prettier-atom: Validation error after 0.31.1 update

Created on 17 May 2017  路  9Comments  路  Source: prettier/prettier-atom

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

bug

All 9 comments

@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.

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

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

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 https://github.com/atom/atom/pull/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?

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

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

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.

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

Thanks @darahak, that worked for me!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

saadq picture saadq  路  3Comments

ZeeCoder picture ZeeCoder  路  6Comments

iamphill picture iamphill  路  5Comments

jonyyz picture jonyyz  路  6Comments

Andersos picture Andersos  路  6Comments