-
-
Notifications
You must be signed in to change notification settings - Fork 49
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
Error: r is not a constructor #41
Comments
@KaniDev Have you looked at the TypeScript examples? https://github.com/idahogurl/vs-code-prettier-eslint/tree/master/examples/typescript I'm able to reproduce the issue because you have not fully setup your ESLint config. Also, what version of the extension are you using? |
I am also getting this error. I have v3.1.0 of the extension. I am not using typescript. My ESLint config is module.exports = {
env: {
browser: true,
es2021: true,
jest: true,
},
extends: [
'airbnb-base',
],
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
rules: {
},
}; Running the prettier-eslint CLI with --write updates my JS files. But when I enable the extension to format on save, I see |
@mjvestal Version 3.10 only works with Prettier 1.9 and ESLint 6.8. You need to use the Prerelease Versions for Prettier 2 & ESLint 7 or 8. See https://github.com/idahogurl/vs-code-prettier-eslint/tree/3.x#installation. Version 4 supports ESLint 7 and Version 5 supports ESLint 8 |
@idahogurl Getting this error too; I have projects using ESLint 7 and all of the "Version 4" of this extension aren't advertised when I go to install a specific version |
|
This issue is stale because it has been open for 14 days with no activity. |
This issue was closed because it has been inactive for 14 days since being marked as stale. |
I believe I ran into this issue, and I assume this is similar to #16 and #26. I noticed on my backend files which use ESlint 7.32 Prettier Eslint worked fine. But, my frontend files which use 6.8 I would receive an error in the OUTPUT -> Prettier Eslint:
I thought this was working fine at one point. I see that VSCode extension Prettier Eslint released v5 in Apr 2022. It's possible I simply missed the upgrade happening and that this issue is related to the upgrade, it sounds like that might be the case based on this thread. I see now that the README https://github.com/idahogurl/vs-code-prettier-eslint#support-for-earlier-versions says if you want to use ESLint lower than 8 you must download and manually install a different version of the extension. Just like @idahogurl explains above. I downgraded the Prettier ESLint extension from 5.0.4 to 4.1.0 and the error no longer occurs. This comment was helpful in explaining how to do that: #41 (comment). |
Important note: because v4 is not available in the marketplace, I had to disable VSCode's auto-update of extensions. The auto-update of extensions will uninstall the manually installed version 4.1.0 because a newer version 5.0.4 is available. It would be excellent if the 4.1.0 version was available in the marketplace. Or, if someone can identify a way to allow this extension to be pinned at 4.1.0 while allowing other extensions in VSCode to continue to be updated. |
@josephdpurcell May I ask why upgrading to ESLint 8 is an issue? Is it because of an older Node version? |
@idahogurl Yes, I need to keep the versions pinned where they are for ESLint and related packages. Certainly, as time approaches infinity, it will get upgraded to ESLint >= 8 or replaced, but for now it is ideal to avoid the effort to upgrade. |
Interesting! Ok, I tried that, and assuming I did the steps correctly it didn't work. Here's what I tried:
At this point, VSCode automatically updates from v4.1.0 to v5.0.4 again. |
Hi ! This seems to have been a past issue, but seems to have come back recently.
Environment: Arch Linux, VSCode 1.67.2, node v16.14.2 (LTS), using the default Next TS app.
Using format on save, each time i save, I get a new "Error: r is not a constructor" in the output tab.
Steps to reproduce:
yarn create next-app --typescript
yarn add -D prettier@^2.5.1 eslint@^8.7.0 @typescript-eslint/parser@^5.0.1 typescript@^4.4.4 prettier-eslint
The text was updated successfully, but these errors were encountered: