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

Adding prettier for code formatting, disabling ESLint formatting rules. #18325

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

dennisoelkers
Copy link
Member

@dennisoelkers dennisoelkers commented Feb 20, 2024

Description

Motivation and Context

This PR is adding prettier for code-formatting and disables ESLint rules that were previously used to ensure consistent formatting. The benefit of prettier is its speed for code formatting, making it particularly useful when using the IDE integration.

For the automatic code formatting in IntelliJ, the following setting should be used:

image

Existing settings for ESLint should be kept.

All code can be formatted from the command line as well, using:

yarn format

This PR does not contain formatting, in order to keep it small and focussed. Actual code formatting for current code will be performed in a separate PR.

/nocl

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (non-breaking change)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.

@dennisoelkers dennisoelkers marked this pull request as ready for review November 6, 2024 09:46
@dennisoelkers dennisoelkers requested review from linuspahl and a team November 6, 2024 09:46
@@ -36,6 +36,9 @@ jobs:
continue-on-error: true
working-directory: graylog2-web-interface
run: yarn lint --fix -o /tmp/report.json -f json
- name: Runt prettier
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a type in Run

@@ -24,7 +24,8 @@
"lint:changes": "./dev/lintChanges.sh",
"test": "jest --maxWorkers=50%",
"test:integration": "jest --maxWorkers=50% --config jest.it.config.js",
"check-production-build": "node checkProductionBuild.js"
"check-production-build": "node checkProductionBuild.js",
"format": "prettier --write src"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion it also makes sense to apply the formatting for the test and maybe even the docs directory.

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

Successfully merging this pull request may close these issues.

2 participants