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: tweak lint config to allow for eslint --fix to fix import order #1827

Merged
merged 2 commits into from
Jun 18, 2024

Conversation

filmaj
Copy link
Contributor

@filmaj filmaj commented Jun 18, 2024

Small maintainer QoL fix: tweaked the eslint config to use a combination of ESLint's stock sort-imports rule and eslint-plugin-import's import/order rule to allow for eslint --fix to fix import ordering. This was driving me a bit crazy eyetwitch and I found this comment that showed off using the two rules in combo.

Also ensured all the lint npm run scripts use the --fix rule across all monorepo packages.

The only change worth reviewing is within lint-configs/ - all other file changes are simply style fixes.

@filmaj filmaj added semver:patch enhancement M-T: A feature request for new functionality tests M-T: Testing work only labels Jun 18, 2024
@filmaj filmaj requested a review from a team June 18, 2024 16:05
@filmaj filmaj self-assigned this Jun 18, 2024
Copy link

codecov bot commented Jun 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.85%. Comparing base (b1dad13) to head (8ec1793).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1827      +/-   ##
==========================================
+ Coverage   81.81%   81.85%   +0.04%     
==========================================
  Files          35       35              
  Lines        7763     7782      +19     
  Branches      317      317              
==========================================
+ Hits         6351     6370      +19     
  Misses       1400     1400              
  Partials       12       12              
Flag Coverage Δ
cli-hooks 95.07% <ø> (ø)
cli-test 54.13% <100.00%> (+0.23%) ⬆️
oauth 76.53% <100.00%> (+0.02%) ⬆️
socket-mode 59.59% <100.00%> (+0.17%) ⬆️
web-api 96.55% <100.00%> (+<0.01%) ⬆️
webhook 95.27% <100.00%> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Copy link
Member

@zimeg zimeg left a comment

Choose a reason for hiding this comment

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

Awesome PR 😭 The mental friction of "where do I put this import" shall no longer be. And this just looks a lot better. Thank you!

Left one comment with confusion on import ordering and one on comments, but neither are blocking! 🚀

Comment on lines +3 to 10
import stream from 'stream';

import { assert } from 'chai';
import sinon from 'sinon';

import { shell } from './shell';

import type { ShellProcess } from '../utils/types';
Copy link
Member

Choose a reason for hiding this comment

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

😱 Big fan of splitting stdlib from dependencies from local from types if that's what this rule is requiring!

@@ -1,4 +1,4 @@
import { createLogger, format, transports, Logger } from 'winston';
import { Logger, createLogger, format, transports } from 'winston';
Copy link
Member

Choose a reason for hiding this comment

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

Uppercase alphabetization is a big winston 🏆

Comment on lines 492 to 250
// Request types
import type {
Copy link
Member

Choose a reason for hiding this comment

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

🗒️ Might be nice to also swap 🪓 the request and response comments for these moving types!

LinkUnfurls,
MessageAttachment,
MessageMetadata,
} from '@slack/types';
Copy link
Member

Choose a reason for hiding this comment

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

This ordering seems unexpected to me - I'd've thought @slack/types finds a place before ./* imports - but no blocker if this is what the linter likes 🙏

Also only noticed this in a few web-api files... Not sure why though!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm also not sure why.... but I almost don't want to ask questions. Just tell me how to order the damn things and don't make me think!

@filmaj filmaj merged commit fc87d51 into main Jun 18, 2024
21 checks passed
@filmaj filmaj deleted the eslint-sort-imports branch June 18, 2024 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement M-T: A feature request for new functionality semver:patch tests M-T: Testing work only
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants