Skip to content

Commit

Permalink
Add Prettier (Azure#33)
Browse files Browse the repository at this point in the history
* Add prettier and format files
* Turn off email notifications for builds
  • Loading branch information
southpolesteve authored Jul 12, 2018
1 parent b221948 commit 1bc6783
Show file tree
Hide file tree
Showing 161 changed files with 16,674 additions and 15,705 deletions.
4 changes: 4 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"printWidth": 120,
"tabWidth": 2
}
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
language: node_js
notifications:
email: false
node_js:
- 10
script:
Expand Down
40 changes: 11 additions & 29 deletions package-lock.json

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

9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,16 @@
"scripts": {
"clean": "rimraf lib",
"lint": "tslint --project tsconfig.json",
"format": "prettier --write --config .prettierrc.json \"src/**/*.ts\"",
"check-format": "prettier --list-different --config .prettierrc.json \"src/**/*.ts\"",
"compile": "echo Using TypeScript && tsc --version && tsc --pretty",
"docs": "typedoc --mode file --out ./lib/docs ./src",
"pack": "webpack",
"build": "npm run clean && npm run lint && npm run compile && npm run docs && npm run pack",
"build": "npm run clean && npm run check-format && npm run lint && npm run compile && npm run docs && npm run pack",
"test": "mocha -r ./src/test/common/setup.ts ./lib/test/ --recursive --timeout 100000 -i -g .*ignore.js",
"test-ts": "mocha -r ts-node/register -r ./src/test/common/setup.ts ./src/test/**/*.spec.ts --recursive --timeout 100000 -i -g .*ignore.js",
"test-browser": "karma start ./karma.config.js --single-run"
"test-browser": "karma start ./karma.config.js --single-run",
"tslint-check": "tslint-config-prettier-check ./tslint.json"
},
"devDependencies": {
"@types/mocha": "^5.2.0",
Expand All @@ -49,10 +52,12 @@
"mocha": "^5.1.1",
"mocha-junit-reporter": "^1.15.0",
"mocha-multi-reporters": "^1.1.6",
"prettier": "^1.13.7",
"requirejs": "^2.3.5",
"sinon": "^5.0.1",
"ts-node": "^6.2.0",
"tslint": "^5.9.1",
"tslint-config-prettier": "^1.13.0",
"typedoc": "^0.11.1",
"typescript": "^2.8.3",
"webpack": "^4.8.3",
Expand Down
44 changes: 22 additions & 22 deletions src/CosmosClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,30 @@ import { Response } from "./request";
* This client is used to configure and execute requests in the Azure Cosmos DB database service.
*/
export class CosmosClient {
public readonly databases: Databases;
public readonly offers: Offers;
public documentClient: DocumentClient; // TODO: This will go away.
constructor(private options: CosmosClientOptions) {
this.databases = new Databases(this);
this.offers = new Offers(this);
public readonly databases: Databases;
public readonly offers: Offers;
public documentClient: DocumentClient; // TODO: This will go away.
constructor(private options: CosmosClientOptions) {
this.databases = new Databases(this);
this.offers = new Offers(this);

this.documentClient = new DocumentClient(
options.endpoint,
options.auth,
options.connectionPolicy,
options.consistencyLevel,
);
}
this.documentClient = new DocumentClient(
options.endpoint,
options.auth,
options.connectionPolicy,
options.consistencyLevel
);
}

public async getDatabaseAccount(): Promise<Response<DatabaseAccount>> {
return this.documentClient.getDatabaseAccount();
}
public async getDatabaseAccount(): Promise<Response<DatabaseAccount>> {
return this.documentClient.getDatabaseAccount();
}

public database(id: string): Database {
return new Database(this, id);
}
public database(id: string): Database {
return new Database(this, id);
}

public offer(id: string) {
return new Offer(this, id);
}
public offer(id: string) {
return new Offer(this, id);
}
}
42 changes: 21 additions & 21 deletions src/CosmosClientOptions.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
import { ConnectionPolicy, ConsistencyLevel } from "./documents";

export interface CosmosClientOptions {
/** The service endpoint to use to create the client. */
endpoint: string;
/** An object that is used for authenticating requests and must contains one of the options */
auth: {
/** The authorization master key to use to create the client. */
masterKey?: string;
/** An array of {@link Permission} objects. */
permissionFeed?: any; // TODO: any
/** An object that contains resources tokens.
* Keys for the object are resource Ids and values are the resource tokens.
*/
resourceTokens?: any; // TODO: any
tokenProvider?: any; // TODO: any
};
/** An instance of {@link ConnectionPolicy} class.
* This parameter is optional and the default connectionPolicy will be used if omitted.
/** The service endpoint to use to create the client. */
endpoint: string;
/** An object that is used for authenticating requests and must contains one of the options */
auth: {
/** The authorization master key to use to create the client. */
masterKey?: string;
/** An array of {@link Permission} objects. */
permissionFeed?: any; // TODO: any
/** An object that contains resources tokens.
* Keys for the object are resource Ids and values are the resource tokens.
*/
connectionPolicy?: ConnectionPolicy;
/** An optional parameter that represents the consistency level.
* It can take any value from {@link ConsistencyLevel}.
*/
consistencyLevel?: ConsistencyLevel;
resourceTokens?: any; // TODO: any
tokenProvider?: any; // TODO: any
};
/** An instance of {@link ConnectionPolicy} class.
* This parameter is optional and the default connectionPolicy will be used if omitted.
*/
connectionPolicy?: ConnectionPolicy;
/** An optional parameter that represents the consistency level.
* It can take any value from {@link ConsistencyLevel}.
*/
consistencyLevel?: ConsistencyLevel;
}
Loading

0 comments on commit 1bc6783

Please sign in to comment.