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

How to revert to previous version ( prettier-eslint ) #332

Closed antonreshetov closed 4 years ago

antonreshetov commented 6 years ago

How to revert to previous version? Where do you even find all versions of the plugin?

antonreshetov commented 6 years ago

Since no one answered, had to ask Google) May be useful to someone pattern link for download the correct version of the plugin

https://${publisher}.gallery.vsassets.io/_apis/public/gallery/publisher/${publisher}/extension/${extension_name}/${version}/assetbyname/Microsoft.VisualStudio.Services.VSIXPackage

Thanks for the article - https://tpodolak.com/blog/2017/04/09/downgrading-visual-studio-code-extension/

azz commented 6 years ago

Curious why you had to downgrade?

antonreshetov commented 6 years ago

@azz I was faced with a similar problem https://github.com/prettier/prettier-vscode/issues/318

ryanditjia commented 6 years ago

The auto-update to 1.1.1 broke prettier-eslint integration for me.

My environment:

Downgrading to 1.1.0 fixed it for me. Here’s how to downgrade if you‘re facing the same problem:

  1. Download 1.1.0 from this link https://esbenp.gallery.vsassets.io/_apis/public/gallery/publisher/esbenp/extension/prettier-vscode/1.1.0/assetbyname/Microsoft.VisualStudio.Services.VSIXPackage
  2. Rename the file extension from .VSIXPackage to .vsix
  3. In your VSCode user settings, add: "extensions.autoUpdate": false,
  4. Open up Command Palette (⌘ ⇧ P on macOS) and select "Extensions: Install from VSIX..."
  5. Select the .vsix file to install, and then reload / reopen VSCode
azz commented 6 years ago

This obviously needs further investigation but if upgrading from 1.1.0 to 1.1.1 causes issues, you could try pinning prettier-eslint back to 8.3.1 as that's all that happened.

https://github.com/prettier/prettier-vscode/compare/v1.1.0...v1.1.1

If the issue is from 1.1.0 though it is more confusing, because there's nothing obvious in the diff that would cause this: https://github.com/prettier/prettier-vscode/compare/v1.0.1...v1.1.0

azz commented 6 years ago

Judging by the number of upvotes in a short amount of time on @ryanditjia's comment above, there was obviously an issue with 1.1.1. @CiGit Do you want to release a patch to rollback while we investigate?

zfeher commented 6 years ago

Reverting back to 1.1.0 as mentioned above worked for me too. Thanks.

We are using prettier-eslint-cli@4.4.0 with prettier-eslint@8.7.5 which works with v1.1.0 but not with v1.1.1. I also tried v1.1.1 with prettier-eslint@8.3.1 but it didn't work. It seems the v1.1.1 doesn't care about the "prettier.eslintIntegration"=true setting.

CiGit commented 6 years ago

@ryanditjia Can you share exactly what broke?

We don't pick your local prettier-eslint, we always use ours. @azz I'll make a new rollback release.

RobinMalfait commented 6 years ago

I can confirm that the latest version broke the eslint integration.

RobinMalfait commented 6 years ago

@azz I am pro releasing a patch while investigating! Something I can help with?

azz commented 6 years ago

I'm just trying to hack some logging into ~/.vscode/extensions/esbenp.prettier-vscode-1.1.1/node_modules/prettier-eslint/dist/index.js to investigate.

CiGit commented 6 years ago

v1.1.2 on it's way to your editors with prettier-eslint@8.3.1

azz commented 6 years ago
2018-1-17 22:09:19:
-------------------
ImportDeclaration should appear when the mode is ES6 and in the module context.

Is this relevant?

RobinMalfait commented 6 years ago

Awesome, thanks @CiGit anything I can help with to resolve the issue?

CiGit commented 6 years ago

@RobinMalfait Well, find out what break. On my tests in was working... Any help welcome @azz Anything in the output channel is something probably bad as it is catched when throwed. @RobinMalfait 's safeExecution

azz commented 6 years ago

Now I can't reproduce it :(

image

(notice the space after foo which ESLint is correctly inserting)

CiGit commented 6 years ago

Does who have an issue with v1.1.1, could you share your eslint config and a piece of code which fails? Or even better, a repository. I can't make it fail whatever that means.

RobinMalfait commented 6 years ago

On it, I have one that fails!

RobinMalfait commented 6 years ago

@CiGit I have created a repro repo: https://github.com/RobinMalfait/broken-prettier-repro-case

CiGit commented 6 years ago

:+1: Thanks @RobinMalfait will do something with it

RobinMalfait commented 6 years ago

Once I find some time I'll try to investigate as well!

CiGit commented 6 years ago

Just seen your format is: eslint --fix. Shouldn't it compare to prettier-eslint?

RobinMalfait commented 6 years ago

@CiGit eslint uses the prettier plugin so it should work. It worked before though. And since prettier-eslint in essence just runs Code ➡️ prettier ➡️ eslint --fix ➡️ Formatted Code

CiGit commented 6 years ago

prettier-eslint [DEBUG]: Unable to find config

CiGit commented 6 years ago

If I change the content of your .eslintrc.yml with a simple one, it works ....

CiGit commented 6 years ago

It seems it's highly dependent from where prettier-eslint is run. In our case, extension context... As it doesn't find plugins / parser / config, it does nothing. diff

ryanditjia commented 6 years ago

Here’s my repro that fails: https://github.com/ryanditjia/another-broken-prettier-repro-case

It’s an empty create-react-app with my eslint boilerplate added. I tried simplifying the eslint config to only include "extends airbnb", but it still reproduces.

EDIT: turning off all extensions except Prettier (or just Prettier + ESLint) still reproduces.

CiGit commented 6 years ago

I think I've understood: Your eslint config can't depend on other modules like config, plugin, parser

zfeher commented 6 years ago

Here is our .eslintrc file which works fine with the latest prettier-eslint@8.7.5 as well, running from npm script or a command line.

{
  "env": {
    "browser": true,
    "node": true,
    "es6": true,
    "mocha": true
  },
  "globals": {
    "expect": true
  },
  "parser": "babel-eslint",
  "parserOptions": {
    "ecmaVersion": 6,
    "sourceType": "module",
    "ecmaFeatures": {
      "experimentalObjectRestSpread": true
    }
  },
  "plugins": ["import", "mocha", "unicorn"],
  "extends": ["semistandard", "plugin:import/errors", "plugin:import/warnings"],
  "rules": {
    "max-len": [
      "error",
      {
        "code": 120,
        "ignoreRegExpLiterals": true,
        "ignoreTrailingComments": true,
        "ignoreUrls": true
      }
    ],

    "no-console": "error",

    // import: Static analysis
    "import/no-unresolved": "off", // does not work with HTML and CSS files just yet
    "import/namespace": "off",
    "import/no-absolute-path": "error",
    "import/no-internal-modules": "off", // pretty extensively used throughout the project
    "import/no-webpack-loader-syntax": "error",

    // import: Helpful warnings
    "import/export": "error",
    "import/no-named-as-default": "error",
    "import/no-named-as-default-member": "error",
    "import/no-extraneous-dependencies": "error",
    "import/no-mutable-exports": "error",

    // import: Style guide
    "import/no-duplicates": "error",
    "import/extensions": ["error", "never"],
    "import/order": "error",
    "import/newline-after-import": "error",

    // Mocha
    "mocha/no-exclusive-tests": "error",

    // Unicorn
    "unicorn/catch-error-name": ["error", { "name": "err" }],
    "unicorn/filename-case": ["error", { "case": "kebabCase" }],
    "unicorn/no-abusive-eslint-disable": "error",
    "unicorn/throw-new-error": "error"
  }
}

The eslint dep versons:

    "babel-eslint": "8.0.1",
    "eslint": "4.8.0",
    "eslint-config-semistandard": "11.0.0",
    "eslint-config-standard": "10.2.1",
    "eslint-loader": "1.9.0",
    "eslint-plugin-import": "2.7.0",
    "eslint-plugin-mocha": "4.11.0",
    "eslint-plugin-node": "5.2.0",
    "eslint-plugin-promise": "3.5.0",
    "eslint-plugin-standard": "3.0.1",
    "eslint-plugin-unicorn": "2.1.2",
CiGit commented 6 years ago

@zfeher And I think it fails if you run it from the command line from a different project which hasn't your eslint plugins for instance


- your project with that eslint
- folder with only prettier-eslint-cli installed
zfeher commented 6 years ago

Yes it fails. Played with it a little bit. If a single plugin is not installed prettier-eslint fails to use the eslint config and falls back to default. However this happens with 8.3.1 and 8.7.5 as well.

Vscode prettier plugin 1.1.2 kinda works the same way, if eslint plugins are missing it will fallback to another default (single quotes instead double, ...), but if plugins are installed it works.

zimme commented 6 years ago

prettier-eslint@8.7.6 is out, please test that version. I do believe it should fix the regression.

riddla commented 6 years ago

Anyone else having problems in conjunction with eslint-config-prettier?

The VS Code prettier extension stopped working for me on JSON files, while prettier is working fine via the CLI.

I am on version 1.1.2 of the extension, got prettier.eslintIntegration set to false in the VS Code settings + the following npm modules in my project:

npm ls --depth=0 | grep prettier                                                                                                                                                                                           
├── eslint-config-prettier@2.9.0
├── prettier@1.10.2
├── tslint-config-prettier@1.6.0

The according sections of my package.json are as follows:

  "prettier": {
    "singleQuote": true
  },
  "eslintConfig": {
    "extends": ["eslint:recommended", "prettier"],
    "env": {
      "browser": true,
      "jquery": true
    }
  },

If this is another issue and does not belong here, I'm happy to add it as a separate one.

CiGit commented 6 years ago

@riddla Other issue, although the title is misleading, this is mostly due to eslintIntegration: true

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.

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.