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

Prettier Error #86

Open
vicente-dl opened this issue Aug 1, 2020 · 7 comments
Open

Prettier Error #86

vicente-dl opened this issue Aug 1, 2020 · 7 comments
Labels
help wanted Extra attention is needed needs more info

Comments

@vicente-dl
Copy link

Hello!
I have been trying to add a worker through this plugin, but I cannot stop getting errors from prettier related to core-js.
All the functions that I used I appear to be imported as double quotes when compiled.

error in ./src/workers/myworker.js

Module build failed (from ./node_modules/worker-plugin/loader.js):
ModuleError: Module Error (from ./node_modules/@vue/cli-plugin-eslint/node_modules/eslint-loader/index.js):

/Users/vicentediaz/pt/src/workers/myworker.js
1:9 error Replace "core-js/modules/es.array.for-each"); with 'core-js/modules/es.array.for-each') prettier/prettier
3:9 error Replace "core-js/modules/es.array.join"); with 'core-js/modules/es.array.join') prettier/prettier
5:9 error Replace "core-js/modules/es.array.map"); with 'core-js/modules/es.array.map') prettier/prettier
7:9 error Replace "core-js/modules/es.function.name"); with 'core-js/modules/es.function.name') prettier/prettier
9:9 error Replace "core-js/modules/es.object.keys"); with 'core-js/modules/es.object.keys') prettier/prettier
11:9 error Replace "core-js/modules/es.object.to-string"); with 'core-js/modules/es.object.to-string') prettier/prettier
13:9 error Replace "core-js/modules/es.regexp.exec"); with 'core-js/modules/es.regexp.exec') prettier/prettier
15:9 error Replace "core-js/modules/es.string.split"); with 'core-js/modules/es.string.split') prettier/prettier
17:9 error Replace "core-js/modules/web.dom-collections.for-each"); with 'core-js/modules/web.dom-collections.for-each') prettier/prettier
19:42 error Replace "/Users/vicentediaz/pt/node_modules/@babel/runtime/helpers/createForOfIteratorHelper"); with '/Users/vicentediaz/pt/node_modules/@babel/runtime/helpers/createForOfIteratorHelper') prettier/prettier

Has anyone had any similar problem??

@developit
Copy link
Collaborator

developit commented Aug 1, 2020

You shouldn't be running prettier or eslint on generated output files. I'm not sure how the vue-cli prettier plugin you're using works, but you'll want to find a way to tell prettier to ignore whatever directory you're outputting files to (dist, build, etc).

@vicente-dl
Copy link
Author

Is not running on generated files, the error appears on the worker inside the src folder. I was able to fix it ignoring the worker specifically. Is not the best solution but works for now.

@developit
Copy link
Collaborator

What does your worker code look like? I can't think of a reason why Prettier would complain about core-js require() statements other than them simply being present in the worker file. Is it code you've copied from somewhere?

@developit
Copy link
Collaborator

FWIW this appears to be a specific issue with @vue/cli.

@developit developit added help wanted Extra attention is needed needs more info labels Aug 11, 2020
@vicente-dl
Copy link
Author

What does your worker code look like? I can't think of a reason why Prettier would complain about core-js require() statements other than them simply being present in the worker file. Is it code you've copied from somewhere?

I created the code, there is nothing complex about, but it throws the error when I use ES6 functions such as map.
I was able to fix the error by disabling prettier on it, but still i havent been able to find any other solution.

@dohun-toss
Copy link

Could you provide CSB?

@jpoles1
Copy link

jpoles1 commented Jun 21, 2021

Still having issues with this plugin and @vue/cli. Unable to switch over to eslint-webpack-plugin as described in #95, unfortunately. Any fixes that anyone's come across to get it working with vue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed needs more info
Projects
None yet
Development

No branches or pull requests

4 participants