-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add import/order
rule
#180
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you're going to need to add path groups to cater for babel/tsconfig aliases. I couldn't find any docs as to whether import/order
is reading tsconfig settings or not.
We could probably identify any paths that start with src
or start with @
to be aliases EDIT: Maybe not @, node_modules has dibs on that for namespacing, and we're not alone on this issue.
P.S: Is it too late to switch over to ~
(unix has dibs on that)? Or $
? 😂
@abdullah-kasim Try it out in GOOP, the rule works well and picks up on tsconfig aliases. You can just copy and paste this into the
|
Wow, that's interesting! Sorry about that, should've tested it first. vip-go-api on trunk [📝] took 10s
[ 11:10:35 ] eslint /Users/uzer/Documents/Development/vip-go-api/src/inactive-users/inactive-users.e2e.spec.ts --fix
/Users/uzer/Documents/Development/vip-go-api/src/inactive-users/inactive-users.e2e.spec.ts
59:3 warning Disabled test jest/no-disabled-tests
158:21 warning Identifier name 'inactiveUserWithIgnoreInactiveCheckInThePast' is too long (> 40) id-length
✖ 2 problems (0 errors, 2 warnings) before import alerts from '@lib/utils/alerts';
import {
createTestApp,
createTestingModule,
TestApp,
} from '@src/shared/test-utils/modules.test-utils';
import { InactiveUsersRepository } from '@src/inactive-users/inactive-users.repository';
import { expectErrorResponseBody } from '@src/shared/test-utils/expect.test-utils';
import { AppModule } from '@src/app.module';
import { createApiUser, createApiUserToken } from '@fixtures/api-user/api-user';
import { createClient } from '@fixtures/client/client';
import moment from 'moment/moment';
import testUtils from '@fixtures/global-setup/test-utils';
import { UsersRepository } from '@src/users/users.repository';
import { EventsService } from '@src/events/events.service'; after import moment from 'moment/moment';
import { createApiUser, createApiUserToken } from '@fixtures/api-user/api-user';
import { createClient } from '@fixtures/client/client';
import testUtils from '@fixtures/global-setup/test-utils';
import alerts from '@lib/utils/alerts';
import { AppModule } from '@src/app.module';
import { EventsService } from '@src/events/events.service';
import { InactiveUsersRepository } from '@src/inactive-users/inactive-users.repository';
import { expectErrorResponseBody } from '@src/shared/test-utils/expect.test-utils';
import {
createTestApp,
createTestingModule,
TestApp,
} from '@src/shared/test-utils/modules.test-utils';
import { UsersRepository } from '@src/users/users.repository'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great. I propose that we either find a way to automatically insert and enforce the comment or comments ( hopefully not 3 lines each ) or we don't use them at all. I'm personally 100% ok with no comments, especially with the line break and automatic grouping.
8e840b3
to
4484166
Compare
Add the
import/order
rule to enforce the import grouping and order of imports / requires. Below is therefore the enforced structure: