nova-prettier icon indicating copy to clipboard operation
nova-prettier copied to clipboard

Error: No parser could be inferred for file…

Open conorsexton opened this issue 3 years ago • 4 comments

I get the following error on save in my project for any file: (May be related to #17)

[object Object] Error: No parser could be inferred for file: /Users/REDACTED/Library/Application Support/Nova/Extensions/alexanderweiss.prettier/**/*.{graphql,js,json,md,ts,tsx,yaml,yml} at normalize$1 (/Users/REDACTED/Projects/REDACTED/node_modules/prettier/index.js:11433:15) at formatWithCursor (/Users/REDACTED/Projects/REDACTED/node_modules/prettier/index.js:15034:12) at args (/Users/REDACTED/Projects/REDACTED/node_modules/prettier/index.js:51620:12) at Object.format (/Users/REDACTED/Projects/REDACTED/node_modules/prettier/index.js:51640:12) at PrettierService.format (/Users/REDACTED/Library/Application Support/Nova/Extensions/alexanderweiss.prettier/Scripts/prettier-service/prettier-service.js:51:35)

In this case, the issue appears when trying to save any changes on a .tsx file, whether the syntax is set to TSX or TypeScript.

I do have a .prettierrc.js file at the root of my project that requires an external config with a few overrides. Deleting the config file does not eliminate the error.

I also have prettier rules set in an .eslintrc.js config at the root of the project: 'prettier/prettier': ['error', { printWidth: 120, singleQuote: true, semi: true, trailingComma: 'none' }]

Any ideas or suggestions for resolution?

conorsexton avatar Jun 08 '21 17:06 conorsexton

Hmmm. That first line seems strange. I'll need to look into this a little. Did you reopen the project after deleting the config file? Otherwise it may be cached. Also, do you have any prettier plugins installed in the same folder as your project?

alexanderweiss avatar Jun 09 '21 20:06 alexanderweiss

Did you reopen the project after deleting the config file?

Restarting Nova after deleting the config results in no discernible Prettier action. I see in the extension console: Prettier service starting, but on save I don’t get formatting or an error.

No Prettier plugins installed in the same folder as the project.

conorsexton avatar Jun 10 '21 14:06 conorsexton

Wanted to follow up here to see if you have any suggestions for further investigation? I’m happy to help try and contribute a resolution but am not quite sure where to begin.

conorsexton avatar Aug 25 '21 13:08 conorsexton

Hi Conor, sorry for not getting back to you. If you're still using this, how does it work with the latest version?

alexanderweiss avatar Apr 16 '23 18:04 alexanderweiss