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

eslint: configure import sorting rules #647

Merged
merged 1 commit into from
Jul 3, 2024

Conversation

jelly
Copy link
Member

@jelly jelly commented Jul 3, 2024

This more or less enforces existing practice, but cleans up many places where we've deviated from that. We sort into these groups:

  • 'react', if present, always first
  • external (node_modules/) imports
  • cockpitlib (pkg/lib/) imports
  • parent (../) imports
  • sibling (./) imports

@jelly jelly requested a review from martinpitt July 3, 2024 12:16
@martinpitt
Copy link
Member

Still some complaints about build.js

This more or less enforces existing practice, but cleans up many places
where we've deviated from that.  We sort into these groups:

- 'react', if present, always first
- external (`node_modules/`) imports
- cockpitlib (`pkg/lib/`) imports
- parent (`../`) imports
- sibling (`./`) imports
@jelly
Copy link
Member Author

jelly commented Jul 3, 2024

Still some complaints about build.js

Yeah, npm run eslint does not lint build.js which makes sense but then fails to autofix :)

Comment on lines -9 to +13
import { cleanPlugin } from './pkg/lib/esbuild-cleanup-plugin.js';
import { cockpitCompressPlugin } from './pkg/lib/esbuild-compress-plugin.js';
import { cockpitPoEsbuildPlugin } from './pkg/lib/cockpit-po-plugin.js';
import { cockpitRsyncEsbuildPlugin } from './pkg/lib/cockpit-rsync-plugin.js';
import { cleanPlugin } from './pkg/lib/esbuild-cleanup-plugin.js';
import { esbuildStylesPlugins } from './pkg/lib/esbuild-common.js';
import { cockpitCompressPlugin } from './pkg/lib/esbuild-compress-plugin.js';
Copy link
Member

Choose a reason for hiding this comment

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

This is weird -- it was sorted before, and now it unsorted it?!

Copy link
Member

Choose a reason for hiding this comment

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

Oh, it sorted it by file name, not by imported names.. 🤷‍♂️

Copy link
Member

@martinpitt martinpitt left a comment

Choose a reason for hiding this comment

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

Green → good, thanks!

@jelly jelly merged commit 7739e63 into cockpit-project:main Jul 3, 2024
7 checks passed
@jelly jelly deleted the import-order branch July 3, 2024 13:10
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