Skip to content

Commit

Permalink
chore: Update prettier configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Romain Lenzotti committed Aug 31, 2020
1 parent 6a8e633 commit 0de5a4e
Show file tree
Hide file tree
Showing 438 changed files with 4,039 additions and 4,037 deletions.
4 changes: 3 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"printWidth": 140,
"bracketSpacing": false
"bracketSpacing": false,
"trailingComma": "none",
"arrowParens": "always"
}
2 changes: 1 addition & 1 deletion packages/ajv/src/pipes/AjvErrorFormatterPipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function defaultFormatter(error: AjvErrorObject, index: string | number) {
index !== undefined && error.modelName && isNaN(+index) && ".",
`${error.modelName || ""}`,
error.dataPath,
` ${error.message}. Given value: ${value}`,
` ${error.message}. Given value: ${value}`
]
// @ts-ignore
.filter<string>(Boolean)
Expand Down
50 changes: 25 additions & 25 deletions packages/ajv/src/pipes/AjvValidationPipe.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
QueryParams,
Required,
UseParam,
ValidationError,
ValidationError
} from "@tsed/common";
import {expect} from "chai";
import {AjvValidationPipe} from "./AjvValidationPipe";
Expand All @@ -32,8 +32,8 @@ describe("AjvValidationPipe", () => {
beforeEach(() =>
PlatformTest.create({
ajv: {
verbose: true,
},
verbose: true
}
})
);
afterEach(() => PlatformTest.reset());
Expand Down Expand Up @@ -66,14 +66,14 @@ describe("AjvValidationPipe", () => {
keyword: "type",
message: "should be object",
params: {
type: "object",
type: "object"
},
parentSchema: {
type: "object",
type: "object"
},
schema: "object",
schemaPath: "#/type",
},
schemaPath: "#/type"
}
]);
});
});
Expand Down Expand Up @@ -121,7 +121,7 @@ describe("AjvValidationPipe", () => {
}

const value = {
id: "hello",
id: "hello"
};
const result = await validate(value, ParamMetadata.get(Ctrl, "get", 0));

Expand Down Expand Up @@ -153,25 +153,25 @@ describe("AjvValidationPipe", () => {
message: "should have required property 'id'",
modelName: "Model",
params: {
missingProperty: "id",
missingProperty: "id"
},
parentSchema: {
definitions: {},
properties: {
id: {
type: "string",
},
type: "string"
}
},
required: ["id"],
type: "object",
type: "object"
},
schema: {
id: {
type: "string",
},
type: "string"
}
},
schemaPath: "#/required",
},
schemaPath: "#/required"
}
]);
});
it("should throw an error (deep property)", async () => {
Expand All @@ -194,7 +194,7 @@ describe("AjvValidationPipe", () => {

const value: any = {
id: "id",
user: {},
user: {}
};

const error = await validate(value, ParamMetadata.get(Ctrl, "get", 0));
Expand All @@ -218,8 +218,8 @@ describe("AjvValidationPipe", () => {

const value = [
{
id: "hello",
},
id: "hello"
}
];
const result = await validate(value, ParamMetadata.get(Ctrl, "get", 0));

Expand Down Expand Up @@ -265,8 +265,8 @@ describe("AjvValidationPipe", () => {
const value: any = [
{
id: "id",
user: {},
},
user: {}
}
];

const error = await validate(value, ParamMetadata.get(Ctrl, "get", 0));
Expand All @@ -290,8 +290,8 @@ describe("AjvValidationPipe", () => {

const value = {
key1: {
id: "hello",
},
id: "hello"
}
};
const result = await validate(value, ParamMetadata.get(Ctrl, "get", 0));

Expand Down Expand Up @@ -337,8 +337,8 @@ describe("AjvValidationPipe", () => {
const value: any = {
key1: {
id: "id",
user: {},
},
user: {}
}
};

const error = await validate(value, ParamMetadata.get(Ctrl, "get", 0));
Expand Down
2 changes: 1 addition & 1 deletion packages/ajv/src/pipes/AjvValidationPipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class AjvValidationPipe extends ValidationPipe implements IPipe {
const options = {
ignoreCallback: (obj: any, type: any) => type === Date,
checkRequiredValue: false,
additionalProperties: metadata.paramType === ParamTypes.QUERY ? "ignore" : undefined,
additionalProperties: metadata.paramType === ParamTypes.QUERY ? "ignore" : undefined
};

if (metadata.isCollection) {
Expand Down
10 changes: 5 additions & 5 deletions packages/ajv/src/services/Ajv.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ describe("Ajv", () => {
expect(
ajv.validate(
{
type: "object",
type: "object"
},
{}
)
).to.equal(true);

ajv.validate(
{
type: "object",
type: "object"
},
[]
);
Expand All @@ -32,10 +32,10 @@ describe("Ajv", () => {
keyword: "type",
message: "should be object",
params: {
type: "object",
type: "object"
},
schemaPath: "#/type",
},
schemaPath: "#/type"
}
]);
});
});
4 changes: 2 additions & 2 deletions packages/ajv/src/services/Ajv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ registerProvider({
return new Ajv({
verbose: false,
...props,
...options,
...options
});
},
}
});
36 changes: 18 additions & 18 deletions packages/common/src/config/services/ServerSettingsService.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,23 @@ describe("ServerSettingsService", () => {
version: "1.0.0",
uploadDir: "${rootDir}/uploads",
scopes: {
[ProviderType.CONTROLLER]: ProviderScope.SINGLETON,
[ProviderType.CONTROLLER]: ProviderScope.SINGLETON
},
logger: {
debug: false,
level: "info",
logRequest: true,
jsonIndentation: process.env.NODE_ENV === Env.PROD ? 0 : 2,
jsonIndentation: process.env.NODE_ENV === Env.PROD ? 0 : 2
},
errors: {
headerName: "errors",
headerName: "errors"
},
mount: {
"/rest": "${rootDir}/controllers/**/*.ts",
"/rest": "${rootDir}/controllers/**/*.ts"
},
exclude: ["**/*.spec.ts", "**/*.spec.js"],
componentsScan: ["${rootDir}/controllers/**/*.ts", "${rootDir}/services/**/*.ts", "${rootDir}/converters/**/*.ts"],
controllerScope: ProviderScope.SINGLETON,
controllerScope: ProviderScope.SINGLETON
}).forEach(([key, value]) => {
settings[key] = value;
});
Expand Down Expand Up @@ -89,14 +89,14 @@ describe("ServerSettingsService", () => {
it("should return httpsPort", () => {
expect(settings.getHttpsPort()).to.deep.equal({
address: "address",
port: 8080,
port: 8080
});
});

it("should return httpPort", () => {
expect(settings.getHttpPort()).to.deep.equal({
address: "address",
port: 8081,
port: 8081
});
});

Expand Down Expand Up @@ -180,14 +180,14 @@ describe("ServerSettingsService", () => {
it("should return address and port from a concatened address and port", () => {
expect((ServerSettingsService as any).buildAddressAndPort("0.0.0.0:9000")).to.deep.eq({
address: "0.0.0.0",
port: 9000,
port: 9000
});
});

it("should return address and port from a port number", () => {
expect((ServerSettingsService as any).buildAddressAndPort(9000)).to.deep.eq({
address: "0.0.0.0",
port: 9000,
port: 9000
});
});
});
Expand Down Expand Up @@ -216,26 +216,26 @@ describe("ServerSettingsService", () => {
const store = new Storage();
const result = settings.resolve({
path: "${rootDir}",
storage: store,
storage: store
});

expect(result).to.deep.eq({
path: process.cwd(),
storage: new Storage(),
storage: new Storage()
});
});

it("should replace rootDir", () => {
expect(settings.resolve({other: null, resolve: "${rootDir}"})).to.deep.eq({
other: null,
resolve: process.cwd(),
resolve: process.cwd()
});
});

it("should replace rootDir", () => {
expect(settings.resolve({other: 808, resolve: "${rootDir}"})).to.deep.eq({
other: 808,
resolve: process.cwd(),
resolve: process.cwd()
});
});
});
Expand All @@ -262,7 +262,7 @@ describe("ServerSettingsService", () => {
Sinon.stub($log.appenders, "set");

settings.logger = {
format: "format",
format: "format"
};
});

Expand All @@ -277,17 +277,17 @@ describe("ServerSettingsService", () => {
levels: ["info", "debug"],
layout: {
type: "pattern",
pattern: "format",
},
pattern: "format"
}
});

expect($log.appenders.set).to.have.been.calledWithExactly("stderr", {
levels: ["trace", "fatal", "error", "warn"],
type: "stderr",
layout: {
type: "pattern",
pattern: "format",
},
pattern: "format"
}
});
});
});
Expand Down
22 changes: 11 additions & 11 deletions packages/common/src/config/services/ServerSettingsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const rootDir = process.cwd();
*/
@Injectable({
scope: ProviderScope.SINGLETON,
global: true,
global: true
})
export class ServerSettingsService extends DIConfiguration {
constructor() {
Expand All @@ -24,27 +24,27 @@ export class ServerSettingsService extends DIConfiguration {
version: "1.0.0",
uploadDir: "${rootDir}/uploads",
scopes: {
[ProviderType.CONTROLLER]: ProviderScope.SINGLETON,
[ProviderType.CONTROLLER]: ProviderScope.SINGLETON
},
logger: {
debug: false,
level: "info",
logRequest: true,
jsonIndentation: process.env.NODE_ENV === Env.PROD ? 0 : 2,
jsonIndentation: process.env.NODE_ENV === Env.PROD ? 0 : 2
},
errors: {
headerName: "errors",
headerName: "errors"
},
mount: {
"/rest": "${rootDir}/controllers/**/*.ts",
"/rest": "${rootDir}/controllers/**/*.ts"
},
exclude: ["**/*.spec.ts", "**/*.spec.js"],
componentsScan: [
"${rootDir}/mvc/**/*.ts",
"${rootDir}/services/**/*.ts",
"${rootDir}/middlewares/**/*.ts",
"${rootDir}/converters/**/*.ts",
],
"${rootDir}/converters/**/*.ts"
]
});
}

Expand Down Expand Up @@ -209,17 +209,17 @@ export class ServerSettingsService extends DIConfiguration {
levels: ["info", "debug"],
layout: {
type: "pattern",
pattern: logger.format,
},
pattern: logger.format
}
});

$log.appenders.set("stderr", {
levels: ["trace", "fatal", "error", "warn"],
type: "stderr",
layout: {
type: "pattern",
pattern: logger.format,
},
pattern: logger.format
}
});
}
}
Expand Down
Loading

0 comments on commit 0de5a4e

Please sign in to comment.