Skip to content

Conversation

@literat
Copy link
Collaborator

@literat literat commented Aug 28, 2025

Description

Migration from Prettier formatting of JS files to Stylistic rules

What has been done:

  • prepared configuration with stylistic rules (will be changing in the future)
  • prepared configuration with prettier rules
  • root eslint configuration switched from prettier to stylistic rules
  • individual packages still using prettier styling

What is planned:

  • in the future, we can now migrate packages one by one, by switching them from prettier to style and altering the styling or rules
  • the stylistic and prettier rules can be part of the Code Quality Tools in the future

Why this change:

  • we have repeated problems with the max length of prettier and the opinionated style of the code
  • this is also a prerequisite for ESLint v9 migration

What to discuss:

Additional context

I am still considering Prettier as a good tool for formatting, but it looks like the stylistic rules are providing a more precise type of format configuration, and they let us format the code as we wish when we are under the max length limit.

Issue reference

@netlify
Copy link

netlify bot commented Aug 28, 2025

Deploy Preview for spirit-design-system-storybook canceled.

Name Link
🔨 Latest commit 5d89b88
🔍 Latest deploy log https://app.netlify.com/projects/spirit-design-system-storybook/deploys/6938230e6bf4d000085f4217

@netlify
Copy link

netlify bot commented Aug 28, 2025

Deploy Preview for spirit-design-system ready!

Name Link
🔨 Latest commit 5d89b88
🔍 Latest deploy log https://app.netlify.com/projects/spirit-design-system/deploys/6938230e4b535b000836207f
😎 Deploy Preview https://deploy-preview-2153--spirit-design-system.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 96 (no change from production)
Accessibility: 100 (no change from production)
Best Practices: 100 (no change from production)
SEO: 90 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@literat literat force-pushed the style/from-prettier-to-stylistic branch from b1143e5 to 226dd11 Compare September 12, 2025 14:47
@literat literat changed the title Style: Switch from ESLint Prettier formatting to Stylistic rules Style: Switch from ESLint Prettier formatting to Stylistic rules (1. part) Sep 12, 2025
@literat literat force-pushed the style/from-prettier-to-stylistic branch from 226dd11 to 8f757fe Compare September 12, 2025 14:51
@literat literat marked this pull request as ready for review September 12, 2025 15:03
@literat literat force-pushed the style/from-prettier-to-stylistic branch from 8f757fe to 4a236c3 Compare September 12, 2025 15:05
@literat literat requested a review from Copilot September 12, 2025 15:06
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR migrates from ESLint Prettier formatting to Stylistic rules as a first step in the transition from Prettier to a more configurable code formatting solution. The change introduces a new @stylistic/eslint-plugin configuration while maintaining backward compatibility by keeping both stylistic and prettier configurations available.

Key Changes:

  • Created new stylistic and prettier rule configurations in eslint-config-spirit
  • Updated root ESLint configuration to use stylistic rules instead of prettier
  • Individual packages still use prettier rules during this transition phase

Reviewed Changes

Copilot reviewed 38 out of 40 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
scripts/lts-schedule/lib/index.js Applied stylistic formatting fixes including improved variable naming and better line breaks
Various package.json files Added eslint-config-spirit dependency to enable new linting configurations
Various .eslintrc.js files Updated to extend prettier config from eslint-config-spirit/prettier
configs/eslint-config-spirit/style.js New stylistic rules configuration file
configs/eslint-config-spirit/prettier.js New prettier rules configuration file
.eslintrc.js Updated root config to use stylistic rules
.prettierignore Expanded to ignore additional JS/TS file types

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@literat literat force-pushed the style/from-prettier-to-stylistic branch from 4a236c3 to 8478a97 Compare October 7, 2025 20:09
@coveralls
Copy link

Coverage Status

coverage: 96.923%. remained the same
when pulling 8478a97 on style/from-prettier-to-stylistic
into a543965 on main.

@literat literat force-pushed the style/from-prettier-to-stylistic branch 2 times, most recently from 27fe2f2 to 6dd0346 Compare October 9, 2025 06:15
@literat literat force-pushed the style/from-prettier-to-stylistic branch 2 times, most recently from e3ea77e to 8171562 Compare October 20, 2025 13:36
@literat literat force-pushed the style/from-prettier-to-stylistic branch 2 times, most recently from e1406f6 to a1450a2 Compare November 6, 2025 17:14
@literat literat force-pushed the style/from-prettier-to-stylistic branch from a1450a2 to 0788a8e Compare November 11, 2025 13:31
@literat literat force-pushed the style/from-prettier-to-stylistic branch 4 times, most recently from f3649fc to 1a98636 Compare November 19, 2025 21:28
@literat literat force-pushed the style/from-prettier-to-stylistic branch 2 times, most recently from 67fe3ac to ad2bb57 Compare November 26, 2025 20:34
@literat literat force-pushed the style/from-prettier-to-stylistic branch from ad2bb57 to 5d89b88 Compare December 9, 2025 13:24
};
```

#### Switching Between Style Configurations
Copy link
Contributor

@adamkudrna adamkudrna Dec 16, 2025

Choose a reason for hiding this comment

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

If my assumption about moving this config and README to CQT is correct, maybe we could show here the main differences between the two tools? From what I can see in this PR:

  • dangling commas,
  • multi-line comments starting with /*!,
  • line length limit for single-line comments,
  • single-/multi-character variable names.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think I can mention here a few examples, but for the full list of the configuration, you must see the style.js rules. And rewriting them all will be a lot of work.

Copy link
Contributor

Choose a reason for hiding this comment

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

No no, of course not everything. Just the major differences so the users can decide better.

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.

7 participants