Vscode-extension-for-zowe: Adopt Prettier for code style

Created on 27 May 2020  Â·  5Comments  Â·  Source: zowe/vscode-extension-for-zowe

Having a unified code style within a repository has many advantages:

  • The code becomes easier to read because it follows the same, predictable visual pattern
  • Easier onboarding. Anyone new to the project can rely on the formatting patterns and does not have to learn different styles in different files.
  • Pull requests do not show changes caused by reformatting code that did not actually change. This can happen accidentally or by using a different editor.
  • Easier code authoring. Developers can focus on the logical structure of their code without having to worry about formatting. The formatting tool takes care of that.

Most helpful comment

I converted the FTP extension to eslint with prettier here. If people like this approach then we can apply the same here, but a lot of fixing will be required, which could be a good thing.

https://github.com/zowe/zowe-explorer-ftp-extension/tree/add-eslint-prettier-support

All 5 comments

Currently our code base does not follow a unified code formatting style. For javascript and typescript codebases Prettier is the de-facto standard used by the majority of projects.

Lets’ adopt prettier for ZOWE Explorer.

I converted the FTP extension to eslint with prettier here. If people like this approach then we can apply the same here, but a lot of fixing will be required, which could be a good thing.

https://github.com/zowe/zowe-explorer-ftp-extension/tree/add-eslint-prettier-support

Thank you @phaumer for taking the initiative. I completely agree. Let's discuss it in your PR for the FTP plugin and once merged and tested, we can then come up with a suggestion for this repo.

We we had a really good discussion in https://github.com/zowe/zowe-explorer-ftp-extension/pull/3 and https://github.com/zowe/zowe-explorer-ftp-extension/pull/4

and have a proposal for a starting point for this repo as well: https://github.com/zowe/zowe-explorer-ftp-extension

Next steps:

  • go through specific rules we want to enable
  • plan a transition strategy for updating our code base as getting the ideal set of rules will be a slow process of updating the code case by case. We can discuss using warning and switching rules gradually over time.

Thank you @phaumer for leading this effort! I think we can break this down a bit more.

The very first step can be reformatting the codebase with prettier without enabling any new linting rules. This will require only minimal manual effort.

Then we can continue a separate discussion as you suggested in _next steps_. Perhaps in a separate issue dedicated to linting rules.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

phaumer picture phaumer  Â·  5Comments

jellypuno picture jellypuno  Â·  5Comments

jelaplan picture jelaplan  Â·  3Comments

gplambert picture gplambert  Â·  3Comments

zFernand0 picture zFernand0  Â·  3Comments