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
Not working properly width eslint 6 #222
Comments
this is causing me issues too - any help resolving would be great! |
We just recently added support for eslint 5 so prettier-eslint might not work with eslint 6 as it hasn't been tested by us and depends on eslint 5. Will accept a PR for eslint 6 support otherwise I'll try and get to it in a couple of weeks as I'm on vacation currently. |
@zimme @nashaofu I found related one more issue related to eslint 6 and CWD. Minimal reproducible repo: https://github.com/phts/prettier-eslint-overrides-bug TL;DR: Issue with overrides. When I set override with explicit file path, e.g. When override contains And if I remove line |
@phts If I remove line |
@nashaofu could you please make a pull request with your change :)? @zimme please look into it, we really need this fix. The reason for the problem (also reported in microsoft/vscode-eslint#696 and prettier/prettier-atom#505) is setting the cwd option as the path for resolving plugins in this line and trying to resolve plugins here which results in an error if cwd isn't set correctly. |
Would appreciate some eyes on #236 (not just from this project's maintainers). I know this problem is affecting a lot of people who use VS Code and enjoy using Prettier format on save in projects that have an ESLint integration. Removing |
Any news on this? |
I don't want to ping people with a new comment, but wow comments like the one below are not helpful. If it's such an emergency for you, feel free to fork the repo and publish the lib under your own NPM org |
When open source fails |
Fixed issue by adding But feels like a hack (and eslint complains about unknown property), prettier-eslint should add function createEslintFix(eslintConfig, eslintPath) {
return function eslintFix(text, filePath) {
+ const cwd = path.dirname(filePath);
+
const cliEngine = (0, _utils.getESLintCLIEngine)(
eslintPath,
- eslintConfig,
+ Object.assign(Object.create(null), eslintConfig, { cwd }),
); But not sure, that it is not a hack too. |
Alternatively you might want to check out: https://www.npmjs.com/package/@effective/prettier comes together with a brand new extension for VSCode: https://marketplace.visualstudio.com/items?itemName=sebastian-software.effective-prettier-vscode - hopefully this fixes the issues for some. |
🎉 This issue has been resolved in version 10.0.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Versions:
prettier-eslint
9.0.0:node
10.15.3:npm
(oryarn
) version: 6.10.0Have you followed the debugging tips?
Yes
Relevant code or config
prettier-eslint/src/index.js
Lines 225 to 243 in c87b69b
const eslintOptions = {}; if (filePath) { eslintOptions.cwd = path.dirname(filePath); } logger.trace( oneLine` creating ESLint CLI Engine to get the config for "${filePath || process.cwd()}" ` ); const cliEngine = getESLintCLIEngine(eslintPath, eslintOptions); try { logger.debug(`getting eslint config for file at "${filePath}"`); const config = cliEngine.getConfigForFile(filePath); + config.cwd = eslintOptions.cwd logger.trace( `eslint config for "${filePath}" received`, prettyFormat(config) ); return config;
What I did:
Support eslint 6
What happened:
when I set "prettier.eslintIntegration": true
then the error happend in VSCode
My eslint configuration is as follows:
Problem description:
The CWD of the process pointed incorrectly
Suggested solution:
details prettier/prettier-vscode#869
The text was updated successfully, but these errors were encountered: