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

Port the eslint config from UDR and next-hashicorp #2704

Merged
merged 3 commits into from
Mar 6, 2025

Conversation

rmainwork
Copy link
Contributor

@rmainwork rmainwork commented Mar 5, 2025

πŸ”— Relevant links

πŸ—’οΈ What

This PR is the first of several aimed to rectify the broken linting setup in devdot which has been the cause of at least one incident recently. The intent is to bring together multiple PRs (starting with this one) on to an assembly branch (rm/fix-linting) and then PR from there into main. This helps to reduce the size of each PR as well as getting multiple eyes and reviews on the changes being made.

🀷 Why

This is an initial attempt to rectify the broken linting on dev dot by first bringing in the eslint config.

πŸ› οΈ How

Porting the linting setup from UDR was deemed to be easier and faster than attempting to modify hashicorp-next, republish and then try to integrate the new package version.

The eslint config from UDR was written as an esmodule in order to use things like import - so a straight copy and paste wasn't possible. But with a little massaging (i.e: swapping out import for require) it seems to work in a rudimentary sense.

Additionally, some tweaks had to be made to package.json to uninstall hashicorp-next and remove references to it in pre-commit hooks(in order to be able to commit)

Finally the old rules from next-hashicorp were ported over in attempt to resolve lint issues and bring the lint rules in line with the current code style in devdot

Porting the linting setup from UDR was deemed to be easier and faster than
attempting to modify `hashicorp-next`, republish and then try to integrate the
new package version.

The eslint config from UDR was written as an esmodule in order to use things
like import - so a straight copy and paste wasn't possible. But with a little
massaging (i.e: swapping out `import` for require) it seems to work in a
rudimentary sense.

Additionally, some tweaks had to be made to package.json to uninstall
`hashicorp-next` and remove references to it in pre-commit hooks(in
order to be able to commit)

Finally the old rules from next-hashicorp were ported over in attempt to
resolve lint issues and bring the lint rules in line with the current
code style in devdot
@rmainwork rmainwork requested review from a team and LeahMarieBush and removed request for a team March 5, 2025 20:57
Copy link

vercel bot commented Mar 5, 2025

The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

Name Status Preview Comments Updated (UTC)
dev-portal βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Mar 6, 2025 4:23pm

Copy link
Contributor

@LeahMarieBush LeahMarieBush left a comment

Choose a reason for hiding this comment

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

Overall this LGTM, just added a few comments about ignored directories in the eslint config file

eslint.config.js Outdated
'.next',
'**/dist',
'eslint.config.js',
'content',
Copy link
Contributor

Choose a reason for hiding this comment

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

dev-portal doesn't have a content directory so I think this can be removed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point! I guess my rip was more shameless than I thought :p

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed that in d3d638b

eslint.config.js Outdated
'eslint.config.js',
'content',
'public',
'vitest.config.mjs',
Copy link
Contributor

Choose a reason for hiding this comment

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

The vitest config file in dev-portal ends in mts instead of mjs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in a2b1e45

Devdot does not have a content directory, so there's no need to have it
in the ignore list
The vitest config file has an extension of `.mts`, not `.mjs`
@rmainwork rmainwork marked this pull request as ready for review March 6, 2025 16:24
@rmainwork rmainwork merged commit b444deb into rm/fix-linting Mar 6, 2025
7 of 9 checks passed
@rmainwork rmainwork deleted the rm/port-eslint-config branch March 6, 2025 16:33
@rmainwork rmainwork mentioned this pull request Mar 6, 2025
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