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

chore(*): Sync linting and IDE config #2137

Merged
merged 15 commits into from Oct 31, 2023
Merged

chore(*): Sync linting and IDE config #2137

merged 15 commits into from Oct 31, 2023

Conversation

imagoiq
Copy link
Contributor

@imagoiq imagoiq commented Oct 26, 2023

What

Commit essential linting and formatting config from our favourite IDE to the repository. The aim is to have the same config across the team and across IDE so we avoid dealing with changes that shouldn't be part of our PR.

  • Add config for Intellij and vscode
    • Remove gitignore on .idea config
    • Disable prettier on MDX files
    • Use LF as default line separator
    • Enable format on save
  • Run prettier --write "**/*.{**/*,*}.{js,ts,jsx,tsx,scss,css,html,json}"
  • Remove prettier-ignore in mdx files

About MDX:
Disable formatting totally, as the maximum printWidth rule conflicts with MDX syntax about new line = <p>.
Latest issue that we had: #2128 . Issue on Prettier repository: prettier/prettier#12209

If this wouldn't be enough, the second option is to ensure that our files are checked before committed with a git hook: https://github.com/lint-staged/lint-staged

For review: you can do it commit by commit.

@imagoiq imagoiq self-assigned this Oct 26, 2023
@changeset-bot
Copy link

changeset-bot bot commented Oct 26, 2023

⚠️ No Changeset found

Latest commit: 8dd4ab6

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@swisspost-bot
Copy link
Contributor

swisspost-bot commented Oct 26, 2023

Preview environment ready: https://preview-2137--swisspost-web-frontend.netlify.app
Preview environment ready: https://preview-2137--swisspost-design-system-next.netlify.app

@imagoiq imagoiq force-pushed the fix/eslint-prettier-all branch 8 times, most recently from 71a981f to 9c85bcd Compare October 26, 2023 11:06
@imagoiq imagoiq changed the title chore(*): Sync eslint, prettier config and IDE config chore(*): Sync linting and IDE config Oct 26, 2023
- Remove gitignore on .idea config
- Disable prettier on MDX files
- Use LF as default line separator
- Enable format on save
- Disable prettier for MDX files
- Use LF as default line separator
- Enable format on save
@imagoiq imagoiq changed the base branch from main to chore/sync-idea-lint-config October 26, 2023 12:32
@imagoiq imagoiq marked this pull request as ready for review October 26, 2023 14:11
@imagoiq imagoiq requested review from alizedebray and removed request for a team October 26, 2023 14:11
Comment on lines +8 to +9
"editor.defaultFormatter": null,
"editor.formatOnSave": false
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Setting defaultFormatter to null should be sufficient according to https://zellwk.com/blog/prettier-disable-languages but it's not. So I disabled as well formatOnSave for MDX according to https://github.com/prettier/prettier-vscode

@imagoiq imagoiq added the 🚂 PR train PR which follows another one. label Oct 30, 2023
@imagoiq imagoiq changed the base branch from chore/sync-idea-lint-config to main October 31, 2023 13:40
# Conflicts:
#	.vscode/settings.json
#	packages/components/src/components.d.ts
#	packages/documentation/src/stories/components/badge/badge.stories.ts
#	packages/internet-header/src/components.d.ts
Comment on lines -9 to -11
# IDEs and editors
.idea/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

.idea contain already a generated gitignore that manage what can be sync with a team and what shoudn't.

Copy link

sonarcloud bot commented Oct 31, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@imagoiq imagoiq merged commit 4bbd53f into main Oct 31, 2023
8 checks passed
@imagoiq imagoiq deleted the fix/eslint-prettier-all branch October 31, 2023 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚂 PR train PR which follows another one.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix eslint config in packages and improve prettier config sync across the team
3 participants