Skip to content

Commit

Permalink
chore(prettier): change to 100 length and prettify existing files (#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
goldcaddy77 committed Jun 13, 2019
1 parent fdb5df4 commit 670cc7c
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 18 deletions.
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1 @@
**/generated/**/*
5 changes: 4 additions & 1 deletion examples/2-complex-example/src/modules/user/user.resolver.ts
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ export class UserResolver extends BaseResolver<User> {


@Authorized('user:update') @Authorized('user:update')
@Mutation(returns => User) @Mutation(returns => User)
async updateUser(@Args() { data, where }: UserUpdateArgs, @Ctx() ctx: BaseContext): Promise<User> { async updateUser(
@Args() { data, where }: UserUpdateArgs,
@Ctx() ctx: BaseContext
): Promise<User> {
return this.update(data, where, ctx.user.id); return this.update(data, where, ctx.user.id);
} }


Expand Down
13 changes: 11 additions & 2 deletions examples/3-one-to-many-relationship/src/post.resolver.ts
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ import { Repository } from 'typeorm';
import { InjectRepository } from 'typeorm-typedi-extensions'; import { InjectRepository } from 'typeorm-typedi-extensions';


import { BaseContext, BaseResolver, StandardDeleteResponse } from '../../../src'; import { BaseContext, BaseResolver, StandardDeleteResponse } from '../../../src';
import { PostCreateInput, PostUpdateArgs, PostWhereArgs, PostWhereInput, PostWhereUniqueInput } from '../generated'; import {
PostCreateInput,
PostUpdateArgs,
PostWhereArgs,
PostWhereInput,
PostWhereUniqueInput
} from '../generated';


import { Post } from './post.model'; import { Post } from './post.model';
import { User } from './user.model'; import { User } from './user.model';
Expand Down Expand Up @@ -42,7 +48,10 @@ export class PostResolver extends BaseResolver<Post> {
} }


@Mutation(returns => Post) @Mutation(returns => Post)
async updatePost(@Args() { data, where }: PostUpdateArgs, @Ctx() ctx: BaseContext): Promise<Post> { async updatePost(
@Args() { data, where }: PostUpdateArgs,
@Ctx() ctx: BaseContext
): Promise<Post> {
return this.update(data, where, ctx.user.id); return this.update(data, where, ctx.user.id);
} }


Expand Down
13 changes: 11 additions & 2 deletions examples/3-one-to-many-relationship/src/user.resolver.ts
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ import { Repository } from 'typeorm';
import { InjectRepository } from 'typeorm-typedi-extensions'; import { InjectRepository } from 'typeorm-typedi-extensions';


import { BaseContext, BaseResolver, StandardDeleteResponse } from '../../../src'; import { BaseContext, BaseResolver, StandardDeleteResponse } from '../../../src';
import { UserCreateInput, UserUpdateArgs, UserWhereArgs, UserWhereInput, UserWhereUniqueInput } from '../generated'; import {
UserCreateInput,
UserUpdateArgs,
UserWhereArgs,
UserWhereInput,
UserWhereUniqueInput
} from '../generated';


import { Post } from './post.model'; import { Post } from './post.model';
import { User } from './user.model'; import { User } from './user.model';
Expand Down Expand Up @@ -42,7 +48,10 @@ export class UserResolver extends BaseResolver<User> {
} }


@Mutation(returns => User) @Mutation(returns => User)
async updateUser(@Args() { data, where }: UserUpdateArgs, @Ctx() ctx: BaseContext): Promise<User> { async updateUser(
@Args() { data, where }: UserUpdateArgs,
@Ctx() ctx: BaseContext
): Promise<User> {
return this.update(data, where, ctx.user.id); return this.update(data, where, ctx.user.id);
} }


Expand Down
Original file line number Original file line Diff line number Diff line change
@@ -1,17 +1,35 @@
import { GraphQLResolveInfo } from 'graphql'; import { GraphQLResolveInfo } from 'graphql';
import { Arg, Args, ArgsType, Ctx, Field, FieldResolver, Mutation, Query, Resolver, Root } from 'type-graphql'; import {
Arg,
Args,
ArgsType,
Ctx,
Field,
FieldResolver,
Mutation,
Query,
Resolver,
Root
} from 'type-graphql';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { InjectRepository } from 'typeorm-typedi-extensions'; import { InjectRepository } from 'typeorm-typedi-extensions';


import { BaseContext, BaseResolver } from '../../../../src'; import { BaseContext, BaseResolver } from '../../../../src';
import { UserRoleCreateInput, UserRoleCreateManyArgs, UserRoleWhereArgs, UserRoleWhereInput } from '../../generated'; import {
UserRoleCreateInput,
UserRoleCreateManyArgs,
UserRoleWhereArgs,
UserRoleWhereInput
} from '../../generated';
import { Role } from './role.model'; import { Role } from './role.model';
import { UserRole } from './user-role.model'; import { UserRole } from './user-role.model';
import { User } from './user.model'; import { User } from './user.model';


@Resolver(UserRole) @Resolver(UserRole)
export class UserRoleResolver extends BaseResolver<UserRole> { export class UserRoleResolver extends BaseResolver<UserRole> {
constructor(@InjectRepository(UserRole) public readonly userRoleRepository: Repository<UserRole>) { constructor(
@InjectRepository(UserRole) public readonly userRoleRepository: Repository<UserRole>
) {
super(UserRole, userRoleRepository); super(UserRole, userRoleRepository);
} }


Expand All @@ -35,12 +53,18 @@ export class UserRoleResolver extends BaseResolver<UserRole> {
} }


@Mutation(returns => UserRole) @Mutation(returns => UserRole)
async createUserRole(@Arg('data') data: UserRoleCreateInput, @Ctx() ctx: BaseContext): Promise<UserRole> { async createUserRole(
@Arg('data') data: UserRoleCreateInput,
@Ctx() ctx: BaseContext
): Promise<UserRole> {
return this.create(data, ctx.user.id); return this.create(data, ctx.user.id);
} }


@Mutation(returns => [UserRole]) @Mutation(returns => [UserRole])
async createManyUserRoles(@Args() { data }: UserRoleCreateManyArgs, @Ctx() ctx: BaseContext): Promise<UserRole[]> { async createManyUserRoles(
@Args() { data }: UserRoleCreateManyArgs,
@Ctx() ctx: BaseContext
): Promise<UserRole[]> {
return this.createMany(data, ctx.user.id); return this.createMany(data, ctx.user.id);
} }
} }
7 changes: 4 additions & 3 deletions package.json
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"scripts": { "scripts": {
"build": "yarn tsc", "build": "yarn tsc",
"lint": "tslint --fix -c ./tslint.json -p ./tsconfig.json", "lint": "tslint --fix -c ./tslint.json -p ./tsconfig.json",
"prettify": "prettier ./{src,test,tools,!generated}/**/*.ts --write", "//prettier": "Note: ignores node_modules by default and 'generated' folder via .prettierignore",
"prettify": "yarn prettier './+(src|test|examples|tools)/**/*.ts' --write",
"semantic-release": "semantic-release", "semantic-release": "semantic-release",
"test": "jest --verbose --coverage", "test": "jest --verbose --coverage",
"test:watch": "jest --verbose --watch", "test:watch": "jest --verbose --watch",
Expand Down Expand Up @@ -106,7 +107,7 @@
"lint-staged": "^8.1.0", "lint-staged": "^8.1.0",
"nodemon": "^1.18.9", "nodemon": "^1.18.9",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"prettier": "^1.15.3", "prettier": "^1.18.2",
"semantic-release": "^15.13.2", "semantic-release": "^15.13.2",
"ts-jest": "^23.10.5", "ts-jest": "^23.10.5",
"tslint": "^5.12.0", "tslint": "^5.12.0",
Expand Down Expand Up @@ -138,7 +139,7 @@
"graphql-yoga/**/@types/graphql": "^14" "graphql-yoga/**/@types/graphql": "^14"
}, },
"prettier": { "prettier": {
"printWidth": 120, "printWidth": 100,
"singleQuote": true "singleQuote": true
}, },
"jest": { "jest": {
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2949,7 +2949,7 @@ fsevents@^1.2.2, fsevents@^1.2.3:
node-pre-gyp "^0.10.0" node-pre-gyp "^0.10.0"


fstream@^1.0.0, fstream@^1.0.2: fstream@^1.0.0, fstream@^1.0.2:
version "1.0.12" version "1.0.11"
resolved "https://registry.npmjs.org/fstream/-/fstream-1.0.11.tgz#5c1fb1f117477114f0632a0eb4b71b3cb0fd3171" resolved "https://registry.npmjs.org/fstream/-/fstream-1.0.11.tgz#5c1fb1f117477114f0632a0eb4b71b3cb0fd3171"
integrity sha1-XB+x8RdHcRTwYyoOtLcbPLD9MXE= integrity sha1-XB+x8RdHcRTwYyoOtLcbPLD9MXE=
dependencies: dependencies:
Expand Down Expand Up @@ -6427,10 +6427,10 @@ preserve@^0.2.0:
resolved "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" resolved "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b"
integrity sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks= integrity sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=


prettier@^1.15.3: prettier@^1.18.2:
version "1.15.3" version "1.18.2"
resolved "https://registry.npmjs.org/prettier/-/prettier-1.15.3.tgz#1feaac5bdd181237b54dbe65d874e02a1472786a" resolved "https://registry.npmjs.org/prettier/-/prettier-1.18.2.tgz#6823e7c5900017b4bd3acf46fe9ac4b4d7bda9ea"
integrity sha512-gAU9AGAPMaKb3NNSUUuhhFAS7SCO4ALTN4nRIn6PJ075Qd28Yn2Ig2ahEJWdJwJmlEBTUfC7mMUSFy8MwsOCfg== integrity sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw==


pretty-format@^23.6.0: pretty-format@^23.6.0:
version "23.6.0" version "23.6.0"
Expand Down

0 comments on commit 670cc7c

Please sign in to comment.