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

Suggestion: Prettier #56

Open
curran opened this issue Feb 18, 2021 · 0 comments
Open

Suggestion: Prettier #56

curran opened this issue Feb 18, 2021 · 0 comments

Comments

@curran
Copy link

curran commented Feb 18, 2021

I notice much of the code formatting is internally inconsistent. It would be great to adopt Prettier to auto-format the code.

Example: /backend/src/app.js

app.get("/api/invalidate", (req, res, next) => {
  let request = Object.assign({}, requests.invalidate);
  request.data = {
    'access_token': accessToken
  }

  return axios(request)
           .then(r => {
             return res.json("OK");
           })
           .catch(next);
});

app.get("/api/finished/:conferenceId", (req, res) => {
  console.log("received finished for: ", req.params.conferenceId);
  let request = Object.assign({}, requests.url);
  request.url = request.url.replace(/%conferenceId%/g, req.params.conferenceId);

  axios(request)
    .then((res) => console.log(res))
    .catch(e => console.error(e));

  return res.end();
});

This could be done by adding the following script in package.json:

  "scripts": {
    "prettier": "prettier --single-quote --write 'src/**/*.js'",
  },

Would this be a welcome change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant