Skip to content

Commit

Permalink
chore: import문 정렬 린트 추가 및 적용, import prefix 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
Coalery committed Oct 3, 2024
1 parent 602ed12 commit 5fc8751
Show file tree
Hide file tree
Showing 117 changed files with 509 additions and 467 deletions.
21 changes: 20 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = {
tsconfigRootDir: __dirname,
sourceType: 'module',
},
plugins: ['@typescript-eslint/eslint-plugin'],
plugins: ['@typescript-eslint/eslint-plugin', 'simple-import-sort'],
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
Expand All @@ -27,5 +27,24 @@ module.exports = {
endOfLine: 'auto',
},
],
'simple-import-sort/imports': [
'error',
{
groups: [
['^\\u0000'],
['^node:'],
['^@?\\w'],
['^@khlug/core'],
['^@khlug/\\w+/infra'],
['^@khlug/\\w+/interface'],
['^@khlug/\\w+/application'],
['^@khlug/\\w+/domain'],
['^@khlug'],
['^'],
['^\\.'],
],
},
],
'simple-import-sort/exports': 'error',
},
};
11 changes: 11 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"eslint": "^8.42.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-simple-import-sort": "^12.1.1",
"jest": "^29.5.0",
"jest-date-mock": "^1.0.8",
"prettier": "^3.0.0",
Expand Down Expand Up @@ -79,7 +80,7 @@
"coverageDirectory": "../coverage",
"testEnvironment": "node",
"moduleNameMapper": {
"@sight/(.*)": "<rootDir>/$1"
"@khlug/(.*)": "<rootDir>/$1"
}
}
}
2 changes: 1 addition & 1 deletion src/__test__/fixtures/GroupBookmarkFixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { faker } from '@faker-js/faker';
import {
GroupBookmark,
GroupBookmarkConstructorParams,
} from '@sight/app/domain/group/model/GroupBookmark';
} from '@khlug/app/domain/group/model/GroupBookmark';

function generator(
params: Partial<GroupBookmarkConstructorParams> = {},
Expand Down
6 changes: 3 additions & 3 deletions src/__test__/fixtures/GroupFixture.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { faker } from '@faker-js/faker';

import {
CUSTOMER_SERVICE_GROUP_ID,
GroupAccessGrade,
GroupCategory,
GroupState,
PRACTICE_GROUP_ID,
} from '@sight/app/domain/group/model/constant';

} from '@khlug/app/domain/group/model/constant';
import {
Group,
GroupConstructorParams,
} from '@sight/app/domain/group/model/Group';
} from '@khlug/app/domain/group/model/Group';

function generator(params: Partial<GroupConstructorParams> = {}): Group {
return new Group({
Expand Down
4 changes: 2 additions & 2 deletions src/__test__/fixtures/domain/group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { faker } from '@faker-js/faker';
import {
GroupLog,
GroupLogConstructorParams,
} from '@sight/app/domain/group/model/GroupLog';
} from '@khlug/app/domain/group/model/GroupLog';
import {
GroupMember,
GroupMemberConstructorParams,
} from '@sight/app/domain/group/model/GroupMember';
} from '@khlug/app/domain/group/model/GroupMember';

export function generateGroupMember(
params?: Partial<GroupMemberConstructorParams>,
Expand Down
4 changes: 2 additions & 2 deletions src/__test__/fixtures/domain/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * from './user';
export * from './interest';
export * from './group';
export * from './interest';
export * from './user';
4 changes: 2 additions & 2 deletions src/__test__/fixtures/domain/interest.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { faker } from '@faker-js/faker';

import {
InterestConstructorParams,
Interest,
} from '@sight/app/domain/interest/model/Interest';
InterestConstructorParams,
} from '@khlug/app/domain/interest/model/Interest';

export function generateInterest(
params?: Partial<InterestConstructorParams>,
Expand Down
8 changes: 4 additions & 4 deletions src/__test__/fixtures/domain/user.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { faker } from '@faker-js/faker';

import { UserState } from '@sight/app/domain/user/model/constant';
import { Profile } from '@sight/app/domain/user/model/Profile';
import { User, UserConstructorParams } from '@sight/app/domain/user/model/User';
import { UserState } from '@khlug/app/domain/user/model/constant';
import {
PointHistory,
PointHistoryConstructorParams,
} from '@sight/app/domain/user/model/PointHistory';
} from '@khlug/app/domain/user/model/PointHistory';
import { Profile } from '@khlug/app/domain/user/model/Profile';
import { User, UserConstructorParams } from '@khlug/app/domain/user/model/User';

export function generateUser(params?: Partial<UserConstructorParams>): User {
return new User({
Expand Down
10 changes: 5 additions & 5 deletions src/__test__/fixtures/view/group.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { faker } from '@faker-js/faker';

import { GroupListView } from '@sight/app/application/group/query/view/GroupListView';
import { GroupMemberListView } from '@sight/app/application/group/query/view/GroupMemberListView';
import { GroupMemberView } from '@sight/app/application/group/query/view/GroupMemberView';
import { GroupView } from '@sight/app/application/group/query/view/GroupView';
import { GroupListView } from '@khlug/app/application/group/query/view/GroupListView';
import { GroupMemberListView } from '@khlug/app/application/group/query/view/GroupMemberListView';
import { GroupMemberView } from '@khlug/app/application/group/query/view/GroupMemberView';
import { GroupView } from '@khlug/app/application/group/query/view/GroupView';

import {
GroupCategory,
GroupState,
} from '@sight/app/domain/group/model/constant';
} from '@khlug/app/domain/group/model/constant';

export function generateGroupView(params?: Partial<GroupView>): GroupView {
return {
Expand Down
2 changes: 1 addition & 1 deletion src/__test__/fixtures/view/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from './user';
export * from './group';
export * from './user';
10 changes: 5 additions & 5 deletions src/__test__/fixtures/view/user.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { faker } from '@faker-js/faker';

import { InterestListView } from '@sight/app/application/interest/query/view/InterestListView';
import { InterestView } from '@sight/app/application/interest/query/view/InterestView';
import { UserListView } from '@sight/app/application/user/query/view/UserListView';
import { UserView } from '@sight/app/application/user/query/view/UserView';
import { InterestListView } from '@khlug/app/application/interest/query/view/InterestListView';
import { InterestView } from '@khlug/app/application/interest/query/view/InterestView';
import { UserListView } from '@khlug/app/application/user/query/view/UserListView';
import { UserView } from '@khlug/app/application/user/query/view/UserView';

import { UserState } from '@sight/app/domain/user/model/constant';
import { UserState } from '@khlug/app/domain/user/model/constant';

export function generateUserView(params?: Partial<UserView>): UserView {
return {
Expand Down
10 changes: 5 additions & 5 deletions src/app/application/group/authorizer/GroupAuthorizer.spec.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { Test } from '@nestjs/testing';
import { advanceTo, clear } from 'jest-date-mock';

import { GroupAuthorizer } from '@sight/app/application/group/authorizer/GroupAuthorizer';
import { GroupAuthorizer } from '@khlug/app/application/group/authorizer/GroupAuthorizer';

import { User } from '@sight/app/domain/user/model/User';
import {
GroupAccessGrade,
GroupCategory,
ManagerOnlyGroupAccessGrade,
ManagerOnlyGroupCategory,
} from '@sight/app/domain/group/model/constant';
} from '@khlug/app/domain/group/model/constant';
import { User } from '@khlug/app/domain/user/model/User';

import { DomainFixture } from '@sight/__test__/fixtures';
import { Message } from '@sight/constant/message';
import { DomainFixture } from '@khlug/__test__/fixtures';
import { Message } from '@khlug/constant/message';

describe('GroupAuthorizer', () => {
let authorizer: GroupAuthorizer;
Expand Down
6 changes: 3 additions & 3 deletions src/app/application/group/authorizer/GroupAuthorizer.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { ForbiddenException, Injectable } from '@nestjs/common';

import { User } from '@sight/app/domain/user/model/User';
import {
GroupAccessGrade,
GroupCategory,
ManagerOnlyGroupAccessGrade,
ManagerOnlyGroupCategory,
} from '@sight/app/domain/group/model/constant';
} from '@khlug/app/domain/group/model/constant';
import { User } from '@khlug/app/domain/user/model/User';

import { Message } from '@sight/constant/message';
import { Message } from '@khlug/constant/message';

type CreateGroupParams = {
user: User;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import { Test } from '@nestjs/testing';
import { advanceTo, clear } from 'jest-date-mock';

import { AddBookmarkCommand } from '@sight/app/application/group/command/addBookmark/AddBookmarkCommand';
import { AddBookmarkCommandHandler } from '@sight/app/application/group/command/addBookmark/AddBookmarkCommandHandler';
import { AddBookmarkCommand } from '@khlug/app/application/group/command/addBookmark/AddBookmarkCommand';
import { AddBookmarkCommandHandler } from '@khlug/app/application/group/command/addBookmark/AddBookmarkCommandHandler';

import { GroupBookmarkFactory } from '@sight/app/domain/group/GroupBookmarkFactory';
import { SlackSender } from '@khlug/app/domain/adapter/ISlackSender';
import { GroupBookmarkFactory } from '@khlug/app/domain/group/GroupBookmarkFactory';
import {
GroupBookmarkRepository,
IGroupBookmarkRepository,
} from '@sight/app/domain/group/IGroupBookmarkRepository';
} from '@khlug/app/domain/group/IGroupBookmarkRepository';
import {
GroupRepository,
IGroupRepository,
} from '@sight/app/domain/group/IGroupRepository';
} from '@khlug/app/domain/group/IGroupRepository';

import { Message } from '@sight/constant/message';
import { SlackSender } from '@sight/app/domain/adapter/ISlackSender';
import { GroupFixture } from '@sight/__test__/fixtures/GroupFixture';
import { GroupBookmarkFixture } from '@sight/__test__/fixtures/GroupBookmarkFixture';
import { GroupBookmarkFixture } from '@khlug/__test__/fixtures/GroupBookmarkFixture';
import { GroupFixture } from '@khlug/__test__/fixtures/GroupFixture';
import { Message } from '@khlug/constant/message';

describe('AddBookmarkCommandHandler', () => {
let handler: AddBookmarkCommandHandler;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
import { CommandHandler, ICommandHandler } from '@nestjs/cqrs';
import {
Inject,
NotFoundException,
UnprocessableEntityException,
} from '@nestjs/common';
import { CommandHandler, ICommandHandler } from '@nestjs/cqrs';

import { Transactional } from '@sight/core/persistence/transaction/Transactional';
import { MessageBuilder } from '@khlug/core/message/MessageBuilder';
import { Transactional } from '@khlug/core/persistence/transaction/Transactional';

import { AddBookmarkCommand } from '@sight/app/application/group/command/addBookmark/AddBookmarkCommand';
import { AddBookmarkCommandResult } from '@sight/app/application/group/command/addBookmark/AddBookmarkCommandResult';
import { AddBookmarkCommand } from '@khlug/app/application/group/command/addBookmark/AddBookmarkCommand';
import { AddBookmarkCommandResult } from '@khlug/app/application/group/command/addBookmark/AddBookmarkCommandResult';

import { GroupBookmarkFactory } from '@sight/app/domain/group/GroupBookmarkFactory';
import {
ISlackSender,
SlackSender,
} from '@khlug/app/domain/adapter/ISlackSender';
import { GroupBookmarkFactory } from '@khlug/app/domain/group/GroupBookmarkFactory';
import {
GroupBookmarkRepository,
IGroupBookmarkRepository,
} from '@sight/app/domain/group/IGroupBookmarkRepository';
} from '@khlug/app/domain/group/IGroupBookmarkRepository';
import {
GroupRepository,
IGroupRepository,
} from '@sight/app/domain/group/IGroupRepository';
} from '@khlug/app/domain/group/IGroupRepository';
import { SlackMessageCategory } from '@khlug/app/domain/message/model/constant';

import { Message } from '@sight/constant/message';
import { Template } from '@sight/constant/template';
import {
ISlackSender,
SlackSender,
} from '@sight/app/domain/adapter/ISlackSender';
import { SlackMessageCategory } from '@sight/app/domain/message/model/constant';
import { MessageBuilder } from '@sight/core/message/MessageBuilder';
import { Message } from '@khlug/constant/message';
import { Template } from '@khlug/constant/template';

@CommandHandler(AddBookmarkCommand)
export class AddBookmarkCommandHandler
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GroupBookmark } from '@sight/app/domain/group/model/GroupBookmark';
import { GroupBookmark } from '@khlug/app/domain/group/model/GroupBookmark';

export class AddBookmarkCommandResult {
constructor(readonly bookmark: GroupBookmark) {}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GroupState } from '@sight/app/domain/group/model/constant';
import { GroupState } from '@khlug/app/domain/group/model/constant';

type ChangeGroupStateRequester = {
userId: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import { Test } from '@nestjs/testing';
import { advanceTo, clear } from 'jest-date-mock';

import { ChangeGroupStateCommand } from '@sight/app/application/group/command/changeGroupState/ChangeGroupStateCommand';
import { ChangeGroupStateCommandHandler } from '@sight/app/application/group/command/changeGroupState/ChangeGroupStateCommandHandler';
import { ChangeGroupStateCommandResult } from '@sight/app/application/group/command/changeGroupState/ChangeGroupStateCommandResult';
import { ChangeGroupStateCommand } from '@khlug/app/application/group/command/changeGroupState/ChangeGroupStateCommand';
import { ChangeGroupStateCommandHandler } from '@khlug/app/application/group/command/changeGroupState/ChangeGroupStateCommandHandler';
import { ChangeGroupStateCommandResult } from '@khlug/app/application/group/command/changeGroupState/ChangeGroupStateCommandResult';

import { GroupState } from '@sight/app/domain/group/model/constant';
import { Group } from '@sight/app/domain/group/model/Group';
import {
GroupLogger,
IGroupLogger,
} from '@sight/app/domain/group/IGroupLogger';
} from '@khlug/app/domain/group/IGroupLogger';
import {
GroupRepository,
IGroupRepository,
} from '@sight/app/domain/group/IGroupRepository';
} from '@khlug/app/domain/group/IGroupRepository';
import { GroupState } from '@khlug/app/domain/group/model/constant';
import { Group } from '@khlug/app/domain/group/model/Group';

import { generateEmptyProviders } from '@sight/__test__/util';
import { Message } from '@sight/constant/message';
import { GroupFixture } from '@sight/__test__/fixtures/GroupFixture';
import { GroupFixture } from '@khlug/__test__/fixtures/GroupFixture';
import { generateEmptyProviders } from '@khlug/__test__/util';
import { Message } from '@khlug/constant/message';

describe('ChangeGroupStateCommandHandler', () => {
let handler: ChangeGroupStateCommandHandler;
Expand Down
Loading

0 comments on commit 5fc8751

Please sign in to comment.