GithubHelp home page GithubHelp logo

Comments (15)

CiGit avatar CiGit commented on May 26, 2024

Can you provide a minimal code example which shows this difference ?

from prettier-vscode.

dKab avatar dKab commented on May 26, 2024

The output of Format Document:

export default store => next => action => {
  const callAPI = action[CALL_API];
  if (typeof callAPI === "undefined") {
    return next(action);
  }

  const { endpoint, types } = callAPI;

  if (typeof endpoint !== "string") {
    throw new Error("Specify a string endpoint URL.");
  }
  if (!Array.isArray(types) || types.length !== 3) {
    throw new Error("Expected an array of three action types.");
  }
  if (!types.every(type => typeof type === "string")) {
    throw new Error("Expected action types to be strings.");
  }

  const actionWith = data => {
    const finalAction = { ...action, ...data };
    delete finalAction[CALL_API];
    return finalAction;
  };

  const [requestType, successType, failureType] = types;
  next(actionWith({ type: requestType }));

  return callApi(endpoint).then(
    response => next(
      actionWith({
        response,
        type: successType
      })
    ),
    error => next(
      actionWith({
        type: failureType,
        error: error.message || "Something bad happened"
      })
    )
  );
};

The output of prettier --write:

export default store =>
  next =>
    action => {
      const callAPI = action[CALL_API];
      if (typeof callAPI === "undefined") {
        return next(action);
      }

      const { endpoint, types } = callAPI;

      if (typeof endpoint !== "string") {
        throw new Error("Specify a string endpoint URL.");
      }
      if (!Array.isArray(types) || types.length !== 3) {
        throw new Error("Expected an array of three action types.");
      }
      if (!types.every(type => typeof type === "string")) {
        throw new Error("Expected action types to be strings.");
      }

      const actionWith = data => {
        const finalAction = { ...action, ...data };
        delete finalAction[CALL_API];
        return finalAction;
      };

      const [requestType, successType, failureType] = types;
      next(actionWith({ type: requestType }));

      return callApi(endpoint).then(
        response =>
          next(
            actionWith({
              response,
              type: successType
            })
          ),
        error =>
          next(
            actionWith({
              type: failureType,
              error: error.message || "Something bad happened"
            })
          )
      );
    };

Note how in the latter snippet
export default store => next => action => {
becomes splitet on several lines:

export default store =>
  next =>
    action => {

from prettier-vscode.

CiGit avatar CiGit commented on May 26, 2024

On your screenshot, in vscode's settings, the left part shows the default settings. Yours are on the right ;-)

Will watch into this

from prettier-vscode.

dKab avatar dKab commented on May 26, 2024

@CiGit Yeah, sorry, you are right. There's nothing there related to prettier though...
image

from prettier-vscode.

CiGit avatar CiGit commented on May 26, 2024

Was just to be sure.
I've a minimal reproduction on my side

s =>
  a => {
    let v;
  };

from prettier-vscode.

CiGit avatar CiGit commented on May 26, 2024
(s => a => {
  let v;
});

is the output of prettier 0.21

The extension is bundled with [email protected]

$ cat extensions/esbenp.prettier-vscode-0.10.1/node_modules/prettier/package.json| grep '"version":'
  "version": "0.21.0"

@esbenp You will have to republish npm install before ;-)

from prettier-vscode.

dKab avatar dKab commented on May 26, 2024

So how does this work? Will extension update itself every time new version of prettier is released? Are you required to manually republish extension on every prettier release?

from prettier-vscode.

CiGit avatar CiGit commented on May 26, 2024

Currently something like that. I don't know if @esbenp has a little script to publish on his side.
We have #39 awaiting to be able to use prettier from the workspace.

from prettier-vscode.

esbenp avatar esbenp commented on May 26, 2024

Good news I have just published #39 which should enable VS Code to use the projects Prettier

from prettier-vscode.

esbenp avatar esbenp commented on May 26, 2024

https://github.com/esbenp/prettier-vscode/releases/tag/0.11.0

from prettier-vscode.

esbenp avatar esbenp commented on May 26, 2024

@dKab please let us know if this resolves your issue :-)

from prettier-vscode.

dKab avatar dKab commented on May 26, 2024

Do I need to do anything with the extension? I mean uninstall/install in order to get this fix?

from prettier-vscode.

esbenp avatar esbenp commented on May 26, 2024

If you go to the extensions pane it should tell you that it has a new version

from prettier-vscode.

dKab avatar dKab commented on May 26, 2024

@esbenp It works now, thanks!

from prettier-vscode.

github-actions avatar github-actions commented on May 26, 2024

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.

from prettier-vscode.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.