prettier / prettier-vscode

Visual Studio Code extension for Prettier
https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode
MIT License
5.04k stars 446 forks source link

I want to add a space between the JS method function name and the parenthesis. how to set it? #318

Closed qingyuun closed 4 years ago

qingyuun commented 6 years ago

I want to add a space between the JS method function name and the parenthesis. how to set it?

CiGit commented 6 years ago

There is no such thing in prettier. ref: https://github.com/prettier/prettier/issues/1139 However, this should be possible with eslint https://eslint.org/docs/rules/space-before-function-parentheses

Edit: It's https://eslint.org/docs/rules/space-before-function-paren the other one is deprecated and doesn't work

antonreshetov commented 6 years ago

Such a situation occurred when I upgraded from 1.0.1 to 1.1.0. I'm using eslint and standard JS style. In 1.1.0 prettier ignores this rule. I rolled back to 1.0.1 and all was well.

Here is a link to 1.0.1 https://esbenp.gallery.vsassets.io/_apis/public/gallery/publisher/esbenp/extension/prettier-vscode/1.0.1/assetbyname/Microsoft.VisualStudio.Services.VSIXPackage

After downloading, rename the extension from vsixpackage to vsix and install

azz commented 6 years ago

Did the extension stop using prettier-eslint entirely, or was it just one rule?

azz commented 6 years ago

I think it is this issue. https://github.com/prettier/prettier-eslint/issues/156

@CiGit Maybe bump prettier-eslint and release a new version?

antonreshetov commented 6 years ago

@azz Not quite understand the question. You say that this problem is related to an outdated version prettier-eslint?

azz commented 6 years ago

Yeah, this extension bundles in prettier-eslint (which it uses when prettier.eslintIntegration is true). I suspect the issue your facing is a consequence of the aforementioned issue. You could try npm install prettier-eslint@latest and it might work.

antonreshetov commented 6 years ago

@azz No, out. Probably not the problem. I have installed the latest prettier-eslint 8.7.5 and still is ignoring the rules

CiGit commented 6 years ago

Will update prettier-eslint, but there was no change between 1.0.1 and 1.1.0 ...

@antonreshetov you have to update it in the extension itself, we don't pick your local version.

CiGit commented 6 years ago

Isn't it an issue between eslint 3 and eslint 4 ? The rule is named space-before-function-paren in v4. Bundled version is also an eslint@4 in 1.0.1

CiGit commented 6 years ago

Just released version 1.1.1

antonreshetov commented 6 years ago

I updated to 1.1.1, the result is now somewhat deteriorated

screenflow2

CiGit commented 6 years ago

What's wrong? Can you post a before / after text please :-)

antonreshetov commented 6 years ago

Briefly, again not working correctly https://eslint.org/docs/rules/space-before-function-parentheses

CiGit commented 6 years ago

This rule was removed in ESLint v1.0 and replaced by the space-before-function-paren rule

Spittal commented 5 years ago

Hey, I'm still having this issue.

No matter what I do regardless of the rule I have set in my .eslintrc.js I can't seem to get prettier to add the space between function and parenthesis.

I am totally up to date with both ESLint and Prettier and have the "Prettier: Eslint Integration" enabled.

I end up with a situation, that when I format document it ends up spitting ESLint errors, because there's no space between function name and parenthesis.

This is after a Format Document command image

mike1e commented 5 years ago

@Spittal Were you able to resolve this issue?

Spittal commented 5 years ago

Not yet, sorry. @mike1e

kivervinicius commented 5 years ago

any update?

rlam3 commented 4 years ago

same issue. is there a workaround ?

opravil-jan commented 4 years ago

Hello,

this bug is really annoying. What prevents it from resolving this issue?

Thank you

Jan Opravil

chrfs commented 4 years ago

Still an issue, this is very annoying! Why is commenting on the issue ? :/

ntotten commented 4 years ago

Due to the huge amount of bugs, linting support has been deprecated in version 2.0.0. See the documentation on the recommended configuration: https://github.com/prettier/prettier-vscode#vscode-eslint-and-tslint-integration

See #870 for more details.

brodybits commented 4 years ago

FYI the equivalent of space-before-function-paren is supported by my prettierx fork.

github-actions[bot] commented 4 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.