prettier-atom failed: unknown type: "TSJSDocAllType"

Created on 18 Feb 2018  路  3Comments  路  Source: prettier/prettier-atom

The problem

The package seems to complain with an error that says:

prettier-atom failed: unknown type: "TSJSDocAllType"

This happens when you try to run Prettier: Format on a file that uses the flow existential type * with generics. The code works fine in Prettier playground.

Steps to reproduce

  1. Create a file called Hello.js
  2. Put the following code inside the file:
/**
 * @flow
 */

import React, { Component } from 'react'

class Hello extends Component<*> {
  render() {
    return (
      <div>Hello</div>
    )
  }
}

export default Hello
  1. Run Prettier: Format This will throw the error.

Prettier Debug

GitHub Gist


Atom version: 1.24.0
prettier-atom version: 0.51.0
prettier version: 1.10.2
prettier-eslint version: 8.8.1
prettier-atom configuration: {
"prettierOptions": {
"bracketSpacing": false,
"parser": "flow",
"semi": false,
"singleQuote": false,
"useTabs": false,
"jsxBracketSameLine": false,
"printWidth": 80,
"tabWidth": "auto",
"trailingComma": "none",
"arrowParens": "avoid"
},
"useEslint": false,
"useStylelint": false,
"useEditorConfig": true,
"formatOnSaveOptions": {
"enabled": false,
"respectEslintignore": true,
"showInStatusBar": false,
"javascriptScopes": [
"source.js",
"source.jsx",
"source.js.jsx",
"source.babel",
"source.js-semantic",
"text.html.basic",
"text.html.vue"
],
"typescriptScopes": [
"source.ts",
"source.tsx",
"source.ts.tsx"
],
"cssScopes": [
"source.css",
"source.less",
"source.css.less",
"source.scss",
"source.css.scss",
"source.css.postcss"
],
"jsonScopes": [
"source.json"
],
"graphQlScopes": [
"source.graphql"
],
"markdownScopes": [
"source.md",
"source.gfm",
"text.md"
],
"vueScopes": [
"text.html.vue"
],
"excludedGlobs": [],
"whitelistedGlobs": [],
"isDisabledIfNotInPackageJson": false,
"isDisabledIfNoConfigFile": false
},
"prettierEslintOptions": {
"prettierLast": false
}
}

Thanks!

You all have done an awesome job with this package, thanks so much!

troubleshooting

Most helpful comment

Ahh, so sorry guys. I had "parser": "typescript" in my .prettierrc since I was trying it out for a bit, and forgot to switch it back to Flow. Everything is working as it should once I put it back to "flow", my apologies! Thanks for the quick reply :)

All 3 comments

@saadq I'm able to format this with prettier-atom just fine and I use flow (and existential types) a lot.

Do you think this might be repo-specific somehow? What version of prettier do you have installed locally? Or are you using the version that comes bundled with prettier-atom?

Oh, weird. I have version ^1.10.2 listed in my dev dependencies. I'm going to see if I can create a minimal repo which reproduces the problem.

Ahh, so sorry guys. I had "parser": "typescript" in my .prettierrc since I was trying it out for a bit, and forgot to switch it back to Flow. Everything is working as it should once I put it back to "flow", my apologies! Thanks for the quick reply :)

Was this page helpful?
0 / 5 - 0 ratings