Skip to content

Commit

Permalink
refactor: enable tslint rules (#664)
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeckwith committed Mar 22, 2020
1 parent 47b506a commit 69839cd
Show file tree
Hide file tree
Showing 30 changed files with 1,559 additions and 1,477 deletions.
4 changes: 2 additions & 2 deletions samples/document-snippets/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,10 @@ const snippets = {
.on('error', err => {
// Handle the error.
})
.on('data', function(row) {
.on('data', row => {
// `row` is a Row object.
})
.on('end', function() {
.on('end', () => {
// All rows retrieved.
});
//-
Expand Down
2 changes: 1 addition & 1 deletion samples/test/app-profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const appProfileSnippets = require('./app-profile.js');

const instance = bigtable.instance(INSTANCE_ID);

describe.skip('App Profile Snippets', function() {
describe.skip('App Profile Snippets', () => {
before(() => {
instance.create({
clusters: [
Expand Down
4 changes: 2 additions & 2 deletions samples/test/instance.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const TABLE_ID = `nodejs-bigtable-samples-${uuid.v4()}`.substr(0, 30); // Bigtab

const instanceSnippets = require('./instance.js');

describe.skip('Instance Snippets', function() {
describe.skip('Instance Snippets', () => {
after(async () => {
try {
const instance = await bigtable.instance(INSTANCE_ID);
Expand All @@ -47,7 +47,7 @@ describe.skip('Instance Snippets', function() {
// instanceSnippets.createCluster(INSTANCE_ID, CLUSTER_ID);
// });

// it('should create an app-profile', function(done) {
// it('should create an app-profile', done => {
// instanceSnippets.createAppProfile(INSTANCE_ID, APP_PROFILE_ID, done);
// });

Expand Down
2 changes: 1 addition & 1 deletion samples/test/row.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const rowSnippets = require('./row.js');

const instance = bigtable.instance(INSTANCE_ID);

describe.skip('Row Snippets', function() {
describe.skip('Row Snippets', () => {
before(async () => {
try {
await instance.create({
Expand Down
2 changes: 1 addition & 1 deletion samples/test/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const tableSnippets = require('./table.js');

const instance = bigtable.instance(INSTANCE_ID);

describe.skip('Table Snippets', function() {
describe.skip('Table Snippets', () => {
before(async () => {
try {
await instance.create({
Expand Down
6 changes: 3 additions & 3 deletions samples/test/write.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,19 @@ describe('writes', async () => {
assert.match(stdout, /Successfully wrote row .*/);
});

it('should do a conditional write', function() {
it('should do a conditional write', () => {
const stdout = execSync(
`node writeConditionally ${INSTANCE_ID} ${TABLE_ID}`
);
assert.match(stdout, /Successfully updated row's os_name/);
});

it('should do an increment', function() {
it('should do an increment', () => {
const stdout = execSync(`node writeIncrement ${INSTANCE_ID} ${TABLE_ID}`);
assert.match(stdout, /Successfully updated row .*/);
});

it('should do a batch write', function() {
it('should do a batch write', () => {
const stdout = execSync(`node writeBatch ${INSTANCE_ID} ${TABLE_ID}`);
assert.match(stdout, /Successfully wrote 2 rows: .*/);
});
Expand Down
12 changes: 6 additions & 6 deletions src/app-profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,9 @@ Please use the format 'my-app-profile' or '${instance.name}/appProfiles/my-app-p
const options =
typeof optionsOrCallback === 'object' ? optionsOrCallback : {};

const reqOpts: any = {
const reqOpts = {
name: this.name,
};
} as google.bigtable.admin.v2.IDeleteAppProfileRequest;

if (is.boolean(options.ignoreWarnings)) {
reqOpts.ignoreWarnings = options.ignoreWarnings;
Expand Down Expand Up @@ -443,12 +443,12 @@ Please use the format 'my-app-profile' or '${instance.name}/appProfiles/my-app-p
typeof optionsOrCallback === 'function' ? optionsOrCallback : cb!;
const gaxOptions =
typeof optionsOrCallback === 'object' ? optionsOrCallback : {};
const reqOpts: any = {
const reqOpts = {
appProfile: AppProfile.formatAppProfile_(metadata as AppProfileOptions),
updateMask: {
paths: [],
},
};
} as google.bigtable.admin.v2.IUpdateAppProfileRequest;
reqOpts.appProfile!.name = this.name;
const fieldsForMask = [
'description',
Expand All @@ -457,8 +457,8 @@ Please use the format 'my-app-profile' or '${instance.name}/appProfiles/my-app-p
'allowTransactionalWrites',
];
fieldsForMask.forEach(field => {
if (reqOpts.appProfile[field]) {
reqOpts.updateMask.paths.push(snakeCase(field));
if (reqOpts.appProfile![field]) {
reqOpts.updateMask!.paths!.push(snakeCase(field));
}
});

Expand Down
12 changes: 7 additions & 5 deletions src/chunktransformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ class TransformError extends Error {
* ROW_IN_PROGRESS: state after first valid chunk without commitRow or resetRow
* CELL_IN_PROGRESS: state when valueSize > 0(partial cell)
*/
export const RowStateEnum = Object.freeze({
NEW_ROW: 1,
ROW_IN_PROGRESS: 2,
CELL_IN_PROGRESS: 3,
});
export enum RowStateEnum {
NEW_ROW = 1,
ROW_IN_PROGRESS = 2,
CELL_IN_PROGRESS = 3,
}

/**
* ChunkTransformer formats all incoming chunks in to row
Expand Down Expand Up @@ -143,6 +143,8 @@ export class ChunkTransformer extends Transform {
case RowStateEnum.CELL_IN_PROGRESS:
this.processCellInProgress(chunk);
break;
default:
break;
}
if (this._destroyed) {
return;
Expand Down
3 changes: 3 additions & 0 deletions src/filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export interface Time {
end: Date;
}

// tslint:disable-next-line no-any
export type RawFilter = any;

export interface Condition {
Expand Down Expand Up @@ -255,6 +256,7 @@ export class Filter {
[index: string]: Function;
}
const filter = new Filter();
// tslint:disable-next-line no-any
arrify(filters).forEach((filterObj: any) => {
const key = Object.keys(filterObj)[0];
if (typeof ((filter as {}) as Fn)[key] !== 'function') {
Expand Down Expand Up @@ -434,6 +436,7 @@ export class Filter {
}

if (col.start || col.end) {
// tslint:disable-next-line no-any
const range: any = Filter.createRange(col.start!, col.end!, 'Qualifier');

range.familyName = col.family;
Expand Down
Loading

0 comments on commit 69839cd

Please sign in to comment.