Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tried to apply to react native project #1

Open
philipheinser opened this issue Apr 11, 2024 · 2 comments
Open

tried to apply to react native project #1

philipheinser opened this issue Apr 11, 2024 · 2 comments

Comments

@philipheinser
Copy link

@alexmckenley I tried to copy the configs and apply it to our react native project and get an error from prettier if I use hook in a file.

["ERROR" - 19:40:01] Error formatting document.
["ERROR" - 19:40:01] Missing visitor keys for 'HookDeclaration'.
Error: Missing visitor keys for 'HookDeclaration'.
@alexmckenley
Copy link
Owner

alexmckenley commented Apr 12, 2024

I believe this error indicates that prettier is not using the "hermes" parser plugin for some reason. Double check to make sure you have both the prettier-plugin-hermes-parser plugin enabled and the "parser": "hermes" option configured as well: https://github.com/alexmckenley/react-flow-vite-template/blob/main/.prettierrc#L7-L14

Also, we've recently merged support for component syntax into the upstream prettier repo, so you could also try pulling the latest version, which I believe should not require any special configuration.

@philipheinser
Copy link
Author

philipheinser commented Apr 12, 2024

@alexmckenley yes I saw this config and added it already will try the route to use the prettier repo

module.exports = {
  bracketSpacing: true,
  bracketSameLine: true,
  singleQuote: true,
  trailingComma: 'all',
  arrowParens: 'avoid',
  plugins: ['prettier-plugin-hermes-parser'],
  overrides: [
    {
      files: ['*.js', '*.jsx', '*.flow'],
      options: {
        parser: 'hermes',
      },
    },
  ],
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants