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

Code formatting: Use prettier? #9377

Closed
tony opened this issue Mar 26, 2021 · 2 comments
Closed

Code formatting: Use prettier? #9377

tony opened this issue Mar 26, 2021 · 2 comments
Labels
resolution:expired This issue was closed due to lack of feedback. status:stale type:task This issue reports a chore (non-production change) and other types of "todos".

Comments

@tony
Copy link
Contributor

tony commented Mar 26, 2021

Avoid using automatic code formatters on existing code. It is fine to automatically format code that you are editing, but you should not be changing the formatting of the code that is already written to not pollute your PRs. You should also not rely solely on automatic corrections. via CKEditor Code Style docs

What does the CKEditor dev team think of tools like prettier?

Provide a description of the task

Weigh the pros/cons of automated formatting in 2021 / current year

Solutions like prettier make the environment far different than they were before.

📃 Pros / cons

  • Pro: I think it automates consistent code style

  • Pro: Prettier is fast

  • Pro: Contributing for outside developer is easlier, less code style in regards to formatting. A machine does the work.

  • Pro: If ckeditor5 published a @ckeditor/prettier-config package (see Prettier: Sharing configurations, external projects like @wiris/mathtype-ckeditor5 and ckeditor5-math could use it and get formatting config updates downstream.

  • Con: even the best formatter produces bad style - if prettier were ran on this codebase right now, I expect there'd be plenty of places where readability would decline (in the short term, at least)

  • Con: Some code styling things wouldn't be possible with prettier (or would require a custom plugin, and once those custom plugins get involved that's where I see friction usually since some editors ignore them and reformat the file, causing messy diffs)

    Golang does this with go fmt and python has a formatter getting more popular: https://github.com/psf/black.

  • Con: eslint and it's prettier plugin is very slow

Discussion

Any thoughts from CKEditor developers and contributors. What has / hasn't worked for you?

Also - have CKEditor developers tried sharing a branch with prettier and seeing if they liked it and it worked with their setups? Could they find a configuration that looked legible?

@tony tony added the type:task This issue reports a chore (non-production change) and other types of "todos". label Mar 26, 2021
@tony tony changed the title Code formatting: Where does the project stand? Code formatting: Use prettier? May 24, 2021
@CKEditorBot
Copy link
Collaborator

There has been no activity on this issue for the past two years. We've marked it as stale and will close it in 30 days. We understand it may be relevant, so if you're interested in the solution, leave a comment or reaction under this issue.

@CKEditorBot
Copy link
Collaborator

We've closed your issue due to inactivity over the last year. We understand that the issue may still be relevant. If so, feel free to open a new one (and link this issue to it).

@CKEditorBot CKEditorBot added the resolution:expired This issue was closed due to lack of feedback. label Oct 13, 2023
@CKEditorBot CKEditorBot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
resolution:expired This issue was closed due to lack of feedback. status:stale type:task This issue reports a chore (non-production change) and other types of "todos".
Projects
None yet
Development

No branches or pull requests

2 participants