Skip to content

Commit

Permalink
chore: import order
Browse files Browse the repository at this point in the history
  • Loading branch information
radoslavirha committed Jan 6, 2024
1 parent dcf502e commit b09671e
Show file tree
Hide file tree
Showing 34 changed files with 228 additions and 121 deletions.
2 changes: 1 addition & 1 deletion api/authentication/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"scripts": {
"bootstrap": "pnpm run config:api && pnpm run keys",
"build": "pnpm run barrels && tsc --project tsconfig.compile.json",
"barrels": "barrelsby --config .barrelsby.json",
"barrels": "barrelsby --config .barrelsby.json && eslint --fix src/**/index.ts",
"start": "pnpm run copy:views && pnpm run barrels && NODE_ENV=localhost tsnd --inspect --exit-child --cls --ignore-watch node_modules --respawn --transpile-only -r tsconfig-paths/register src/index.ts",
"start:prod": "pnpm run copy:views && cross-env NODE_ENV=production node dist/index.js",
"format": "eslint --ext .ts --fix src",
Expand Down
2 changes: 1 addition & 1 deletion api/authentication/src/Server.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { join } from 'path';
import * as restCommon from '@hikers-book/tsed-common/controllers';
import { BaseServer, getServerDefaultConfig, getSwaggerHelmetDirectives } from '@hikers-book/tsed-common/server';
import '@tsed/ajv';
Expand All @@ -9,7 +10,6 @@ import '@tsed/platform-express'; // /!\ keep this import
import '@tsed/swagger';
import cookieSession from 'cookie-session';
import helmet from 'helmet';
import { join } from 'path';
import * as restAuth from './auth/controllers/index';
import { User } from './auth/models';
import './auth/protocols/EmailSignInProtocol';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import { TestAuthenticationApiContext } from '../../test/TestAuthenticationApiCo
import { EmailVerifyTokenHandler } from '../handlers';
import { EmailSendVerificationRequest, EmailSignUpRequest, EmailVerifyTokenRequest } from '../models';
import { EmailService } from '../services/EmailService';
import { ProtocolAuthService } from '../services/ProtocolAuthService';
import { RefreshTokenService } from '../services/RefreshTokenService';
import { CredentialsMongoService } from '../services/mongo/CredentialsMongoService';
import { EmailVerificationMongoService } from '../services/mongo/EmailVerificationMongoService';
import { ProtocolAuthService } from '../services/ProtocolAuthService';
import { RefreshTokenService } from '../services/RefreshTokenService';
import { CredentialsStub, EmailVerificationStub, TokensStub } from '../test/stubs';
import { CryptographyUtils } from '../utils';
import { AuthProviderEmailController } from './EmailController';
Expand Down
2 changes: 1 addition & 1 deletion api/authentication/src/auth/handlers/LogoutHandler.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { BaseHandler } from '@hikers-book/tsed-common/handlers';
import { Req } from '@tsed/common';
import { RefreshTokenService } from '../services/RefreshTokenService';
import { Injectable } from '@tsed/di';
import { RefreshTokenService } from '../services/RefreshTokenService';

@Injectable()
export class LogoutHandler extends BaseHandler<{ request: Req; refreshToken: string }, void> {
Expand Down
2 changes: 1 addition & 1 deletion api/authentication/src/auth/services/KeysService.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import path from 'path';
import { FSUtils } from '@hikers-book/tsed-common/utils';
import { PlatformTest } from '@tsed/common';
import { TestMongooseContext } from '@tsed/testing-mongoose';
import path from 'path';
import { KeysService } from './KeysService';

describe('KeysService', () => {
Expand Down
2 changes: 1 addition & 1 deletion api/authentication/src/auth/services/KeysService.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import path from 'path';
import { FSUtils } from '@hikers-book/tsed-common/utils';
import { Service } from '@tsed/di';
import { Algorithm } from 'jsonwebtoken';
import path from 'path';

@Service()
export class KeysService {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ import {
import { ProviderGithubPair } from '../types';
import { CryptographyUtils } from '../utils';
import { JWTService } from './JWTService';
import { ProtocolAuthService } from './ProtocolAuthService';
import { RefreshTokenService } from './RefreshTokenService';
import { CredentialsMongoService } from './mongo/CredentialsMongoService';
import { EmailVerificationMongoService } from './mongo/EmailVerificationMongoService';
import { UserMongoService } from './mongo/UserMongoService';
import { ProtocolAuthService } from './ProtocolAuthService';
import { RefreshTokenService } from './RefreshTokenService';

describe('ProtocolAuthService', () => {
let service: ProtocolAuthService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import { Credentials, EmailSignUpRequest, RefreshToken, TokensPair, User } from
import { AuthProviderPair, OAuth2ProviderPair } from '../types';
import { CryptographyUtils } from '../utils/CryptographyUtils';
import { JWTService } from './JWTService';
import { RefreshTokenService } from './RefreshTokenService';
import { CredentialsMongoService } from './mongo/CredentialsMongoService';
import { EmailVerificationMongoService } from './mongo/EmailVerificationMongoService';
import { UserMongoService } from './mongo/UserMongoService';
import { RefreshTokenService } from './RefreshTokenService';

@Service()
export class ProtocolAuthService {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import { TestAuthenticationApiContext } from '../../test/TestAuthenticationApiCo
import { CookieName, RefreshToken } from '../models';
import { CredentialsStubPopulated, RefreshTokenStub, TokensStub } from '../test/stubs';
import { JWTService } from './JWTService';
import { RefreshTokenService } from './RefreshTokenService';
import { CredentialsMongoService } from './mongo/CredentialsMongoService';
import { RefreshTokenMongoService } from './mongo/RefreshTokenMongoService';
import { RefreshTokenService } from './RefreshTokenService';

describe('RefreshTokenService', () => {
let service: RefreshTokenService;
Expand Down
3 changes: 2 additions & 1 deletion api/authentication/src/auth/utils/CryptographyUtils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { argon2id, hash, Options, verify } from 'argon2';
import { randomBytes } from 'crypto';
import { argon2id, hash, Options, verify } from 'argon2';
import { v4 } from 'uuid';

export class CryptographyUtils {
public static async argon2CreateHash(password: string): Promise<string> {
const hashingConfig: Partial<Options & { raw?: false }> = {
Expand Down
2 changes: 1 addition & 1 deletion api/authentication/src/global/services/ConfigService.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { resolve } from 'path';
import { ConfigLoaderOptions, ConfigLoder, SwaggerDocConfig } from '@hikers-book/tsed-common/config';
import { SwaggerDocsVersion, SwaggerSecurityScheme } from '@hikers-book/tsed-common/types';
import { Injectable } from '@tsed/di';
import { resolve } from 'path';
import { ConfigModel } from '../models/ConfigModel';

@Injectable()
Expand Down
2 changes: 1 addition & 1 deletion api/authentication/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { ConfigLoder } from '@hikers-book/tsed-common/config';
import { $log } from '@tsed/common';
import { PlatformExpress } from '@tsed/platform-express';
import { SwaggerSettings } from '@tsed/swagger';
import { Server } from './Server';
import { ConfigService } from './global/services/ConfigService';
import { Server } from './Server';

async function bootstrap() {
try {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { AT_PRIVATE_KEY, AT_PUBLIC_KEY, RT_PRIVATE_KEY, RT_PUBLIC_KEY } from '@hikers-book/tsed-common/stubs';
import { TestMongooseContext } from '@tsed/testing-mongoose';
import { createTransport } from 'nodemailer-mock';
import { Server } from '../Server';
import { KeysService } from '../auth/services/KeysService';
import { NODEMAILER_TOKEN } from '../global/connections/InjectionToken';
import { Server } from '../Server';

// istanbul ignore next
export class TestAuthenticationApiContext {
Expand Down
2 changes: 1 addition & 1 deletion api/graphql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"license": "MIT",
"scripts": {
"build": "pnpm run barrels && tsc --project tsconfig.compile.json",
"barrels": "barrelsby --config .barrelsby.json",
"barrels": "barrelsby --config .barrelsby.json && eslint --fix src/**/index.ts",
"start": "pnpm run barrels && NODE_ENV=localhost tsnd --inspect --exit-child --cls --ignore-watch node_modules --respawn --transpile-only -r tsconfig-paths/register src/index.ts",
"start:prod": "cross-env NODE_ENV=production node dist/index.js",
"format": "eslint --ext .ts --fix src",
Expand Down
2 changes: 1 addition & 1 deletion api/graphql/src/Server.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { resolve } from 'path';
import { BaseServer, getServerDefaultConfig } from '@hikers-book/tsed-common/server';
import '@tsed/ajv';
import { Configuration, Inject } from '@tsed/di';
import '@tsed/ioredis';
import '@tsed/platform-express'; // /!\ keep this import
import cookieSession from 'cookie-session';
import helmet from 'helmet';
import { resolve } from 'path';
import './global/connections/Redis';
import { ConfigService } from './global/services/ConfigService';
import * as v1Datasources from './v1/datasources';
Expand Down
2 changes: 1 addition & 1 deletion api/graphql/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ConfigLoder } from '@hikers-book/tsed-common/config';
import { $log } from '@tsed/common';
import { PlatformExpress } from '@tsed/platform-express';
import { Server } from './Server';
import { ConfigService } from './global/services/ConfigService';
import { Server } from './Server';

async function bootstrap() {
try {
Expand Down
2 changes: 1 addition & 1 deletion api/stages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"license": "MIT",
"scripts": {
"build": "pnpm run barrels && tsc --project tsconfig.compile.json",
"barrels": "barrelsby --config .barrelsby.json",
"barrels": "barrelsby --config .barrelsby.json && eslint --fix src/**/index.ts",
"start": "pnpm run copy:views && pnpm run barrels && NODE_ENV=localhost tsnd --inspect --exit-child --cls --ignore-watch node_modules --respawn --transpile-only -r tsconfig-paths/register src/index.ts",
"start:prod": "pnpm run copy:views && cross-env NODE_ENV=production node dist/index.js",
"format": "eslint --ext .ts --fix src",
Expand Down
2 changes: 1 addition & 1 deletion api/stages/src/Server.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { join } from 'path';
import * as global from '@hikers-book/tsed-common/controllers';
import { BaseServer, getServerDefaultConfig, getSwaggerHelmetDirectives } from '@hikers-book/tsed-common/server';
import '@tsed/ajv';
Expand All @@ -8,7 +9,6 @@ import '@tsed/platform-express'; // /!\ keep this import
import '@tsed/swagger';
import cookieSession from 'cookie-session';
import helmet from 'helmet';
import { join } from 'path';
import './global/connections/Redis';
import { ConfigService } from './global/services/ConfigService';
import * as rest from './v1/controllers/index';
Expand Down
2 changes: 1 addition & 1 deletion api/stages/src/global/services/ConfigService.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { resolve } from 'path';
import { ConfigLoaderOptions, ConfigLoder, SwaggerDocConfig } from '@hikers-book/tsed-common/config';
import { SwaggerDocsVersion, SwaggerSecurityScheme } from '@hikers-book/tsed-common/types';
import { Injectable } from '@tsed/di';
import { resolve } from 'path';
import { ConfigModel } from '../models/ConfigModel';

@Injectable()
Expand Down
2 changes: 1 addition & 1 deletion api/stages/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { ConfigLoder } from '@hikers-book/tsed-common/config';
import { $log } from '@tsed/common';
import { PlatformExpress } from '@tsed/platform-express';
import { SwaggerSettings } from '@tsed/swagger';
import { Server } from './Server';
import { ConfigService } from './global/services/ConfigService';
import { Server } from './Server';

async function bootstrap() {
try {
Expand Down
2 changes: 1 addition & 1 deletion api/trips/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"license": "MIT",
"scripts": {
"build": "pnpm run barrels && tsc --project tsconfig.compile.json",
"barrels": "barrelsby --config .barrelsby.json",
"barrels": "barrelsby --config .barrelsby.json && eslint --fix src/**/index.ts",
"start": "pnpm run copy:views && pnpm run barrels && NODE_ENV=localhost tsnd --inspect --exit-child --cls --ignore-watch node_modules --respawn --transpile-only -r tsconfig-paths/register src/index.ts",
"start:prod": "pnpm run copy:views && cross-env NODE_ENV=production node dist/index.js",
"format": "eslint --ext .ts --fix src",
Expand Down
2 changes: 1 addition & 1 deletion api/trips/src/Server.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { join } from 'path';
import * as global from '@hikers-book/tsed-common/controllers';
import { BaseServer, getServerDefaultConfig, getSwaggerHelmetDirectives } from '@hikers-book/tsed-common/server';
import '@tsed/ajv';
Expand All @@ -8,7 +9,6 @@ import '@tsed/platform-express'; // /!\ keep this import
import '@tsed/swagger';
import cookieSession from 'cookie-session';
import helmet from 'helmet';
import { join } from 'path';
import './global/connections/Redis';
import { ConfigService } from './global/services/ConfigService';
import * as rest from './v1/controllers/index';
Expand Down
2 changes: 1 addition & 1 deletion api/trips/src/global/services/ConfigService.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { resolve } from 'path';
import { ConfigLoaderOptions, ConfigLoder, SwaggerDocConfig } from '@hikers-book/tsed-common/config';
import { SwaggerDocsVersion, SwaggerSecurityScheme } from '@hikers-book/tsed-common/types';
import { Injectable } from '@tsed/di';
import { resolve } from 'path';
import { ConfigModel } from '../models/ConfigModel';

@Injectable()
Expand Down
2 changes: 1 addition & 1 deletion api/trips/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { ConfigLoder } from '@hikers-book/tsed-common/config';
import { $log } from '@tsed/common';
import { PlatformExpress } from '@tsed/platform-express';
import { SwaggerSettings } from '@tsed/swagger';
import { Server } from './Server';
import { ConfigService } from './global/services/ConfigService';
import { Server } from './Server';

async function bootstrap() {
try {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import chalk from 'chalk';
import Fs from 'fs';
import chalk from 'chalk';
import { mergeObjects } from 'json-merger';
import logSymbols from 'log-symbols';
import { CLIConfigOptions } from './types';
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/copy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Fs from 'fs';
import { globSync } from 'glob';
import path from 'path';
import { globSync } from 'glob';

export const copy = (): void => {
const viewsSource = path.join(__dirname, '../../tsed-common/src/views/');
Expand Down
8 changes: 7 additions & 1 deletion packages/eslint/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ module.exports = {
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:import/recommended',
'plugin:import/typescript',
'plugin:import/recommended',
'plugin:import/typescript'
],
plugins: [ '@stylistic' ],
Expand All @@ -11,8 +13,12 @@ module.exports = {
sourceType: 'module'
},
rules: {
'max-params': ['error', 3],
'import/no-named-as-default': 'off',
'max-params': ['error', 3],
'import/first': 'error',
'import/newline-after-import': 'error',
'import/no-duplicates': 'error',
'import/order': ['error', { alphabetize: { order: 'asc', caseInsensitive: true } }],
'@stylistic/comma-dangle': ['error', 'never'],
'@stylistic/eol-last': ['error', 'always'],
'@stylistic/function-call-spacing': ['error', 'never'],
Expand Down
3 changes: 2 additions & 1 deletion packages/eslint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"eslint-plugin-import": "^2.28.1"
},
"devDependencies": {
"@stylistic/eslint-plugin": "^1.5.1"
"@stylistic/eslint-plugin": "^1.5.1",
"eslint-plugin-import": "^2.29.1"
},
"engines": {
"node": ">= 18.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/tsed-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"scripts": {
"build": "pnpm run barrels && npx tsc",
"barrels": "barrelsby --config .barrelsby.json",
"barrels": "barrelsby --config .barrelsby.json && eslint --fix src/**/index.ts",
"format": "eslint --ext .ts --fix src",
"lint": "eslint --ext .ts src",
"test": "cross-env NODE_ENV=test jest",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { join } from 'path';
import { PlatformTest } from '@tsed/common';
import { minify } from 'html-minifier';
import { join } from 'path';
import SuperTest from 'supertest';
import { BaseServer } from '../server/ServerBase';
import { SwaggerController } from './SwaggerController';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { PlatformTest } from '@tsed/common';
import SuperTest from 'supertest';
import { BaseServer } from '../server/ServerBase';
import { AuthenticateService } from '../services/AuthenticateService';
import { TestController } from '../test/TestController';
import { ACCESS_TOKEN, BEARER_TOKEN, JWT_PAYLOAD } from '../test/stubs/AuthStubs';
import { TestController } from '../test/TestController';

describe('JWTProtocol', () => {
let request: SuperTest.SuperTest<SuperTest.Test>;
Expand Down
2 changes: 1 addition & 1 deletion packages/tsed-common/src/utils/CommonUtils.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import JWT from 'jsonwebtoken';
import { TestModel } from '../test/TestModel';
import { ACCESS_TOKEN, JWT_PAYLOAD } from '../test/stubs';
import { TestModel } from '../test/TestModel';
import { CommonUtils } from './CommonUtils';

describe('CommonUtils', () => {
Expand Down
Loading

0 comments on commit b09671e

Please sign in to comment.