Skip to content

Commit 3636cba

Browse files
chore: Add linting
1 parent d9318eb commit 3636cba

File tree

8 files changed

+36
-31
lines changed

8 files changed

+36
-31
lines changed

package.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,22 @@
1010
"scripts": {
1111
"clean": "rimraf dist/",
1212
"clean-all": "rimraf dist/ node_modules/ package-lock.json",
13+
"lint": "tslint --fix './src/**/*.ts'",
1314
"docker": "docker-compose up --force-recreate &",
1415
"docker:kill": "docker-compose kill",
15-
"prebuild": "npm run clean",
16+
"prebuild": "npm run clean && npm run lint",
1617
"build": "tsc",
1718
"precopy-test-config": "rimraf dist/tests/integration/config",
1819
"copy-test-config": "cp -r src/tests/integration/config dist/tests/integration/config",
1920
"pretest": "npm run docker:kill && npm run build && npm run copy-test-config",
2021
"test": "npm run test:integration",
2122
"pretest:integration": "npm run docker",
2223
"test:integration": "wait-on --timeout 20000 http://localhost:8510 && node dist/tests/integration/bootstrap.js && CONSUL_ADDRESS='http://localhost:8510' CONSUL_DC='dc1' CONFIG_PATH='dist/tests/integration/config' lab --timeout 15000 --verbose -l -S -P spec dist/tests/integration",
23-
"posttest:integration": "npm run docker:kill"
24+
"posttest:integration": "npm run docker:kill",
25+
"release:patch": "npm version patch && npm run release:publish",
26+
"release:minor": "npm version minor && npm run release:publish",
27+
"release:major": "npm version major && npm run release:publish",
28+
"release:publish": "git push --follow-tags"
2429
},
2530
"author": "Credit Karma",
2631
"license": "Apache-2.0",

src/main/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
export * from './toggles'
2-
export * from './types'
2+
export * from './types'

src/main/schema.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,23 @@ export const toggleSchema: object = {
77
type: 'object',
88
properties: {
99
id: {
10-
type: 'string'
10+
type: 'string',
1111
},
1212
description: {
13-
type: 'string'
13+
type: 'string',
1414
},
1515
fraction: {
1616
type: 'number',
1717
minimum: 0.0,
18-
maximum: 1.0
18+
maximum: 1.0,
1919
},
2020
comment: {
21-
type: 'string'
22-
}
21+
type: 'string',
22+
},
2323
},
24-
required: [ 'id', 'fraction' ]
25-
}
26-
}
24+
required: [ 'id', 'fraction' ],
25+
},
26+
},
2727
},
28-
required: [ 'toggles' ]
29-
}
28+
required: [ 'toggles' ],
29+
}

src/main/toggles.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { config } from '@creditkarma/dynamic-config'
2-
import * as logger from './logger'
32
import { DEFAULT_TOGGLES_PATH } from './constants'
4-
import { objectMatchesSchema, memoize } from './utils'
3+
import * as logger from './logger'
54
import { toggleSchema } from './schema'
65
import {
7-
ToggleMap,
86
IToggleDescription,
97
Toggle,
8+
ToggleMap,
109
} from './types'
10+
import { memoize, objectMatchesSchema } from './utils'
1111

1212
const rawToggles: ToggleMap = new Map()
1313

@@ -43,4 +43,4 @@ export function toggleMap(key: string): Promise<Toggle> {
4343
}
4444
}
4545
})
46-
}
46+
}

src/main/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ export interface IToggleDescription {
77
comment?: string
88
}
99

10-
export type Toggle = () => boolean
10+
export type Toggle = () => boolean

src/main/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export function objectMatchesSchema(schema: object, data: any): boolean {
77
}
88

99
export function memoize<T>(fn: () => T): () => T {
10-
let cachedValue: any = undefined
10+
let cachedValue: any
1111

1212
return (): T => {
1313
if (cachedValue !== undefined) {
@@ -18,4 +18,4 @@ export function memoize<T>(fn: () => T): () => T {
1818
return cachedValue
1919
}
2020
}
21-
}
21+
}

src/tests/integration/bootstrap.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,20 @@ setTimeout(() => {
99
Promise.all([
1010
consulClient.set({ path: 'toggles' }, [
1111
{
12-
"id": "com.creditkarma.featureFlags.AlwaysEnabled",
13-
"description": "It's a feature toggle",
14-
"fraction": 1.0
12+
id: 'com.creditkarma.featureFlags.AlwaysEnabled',
13+
description: "It's a feature toggle",
14+
fraction: 1.0,
1515
},
1616
{
17-
"id": "com.creditkarma.featureFlags.AlwaysDisabled",
18-
"description": "It's a feature toggle",
19-
"fraction": 0
17+
id: 'com.creditkarma.featureFlags.AlwaysDisabled',
18+
description: "It's a feature toggle",
19+
fraction: 0,
2020
},
2121
{
22-
"id": "com.creditkarma.featureFlags.SometimesDisabled",
23-
"description": "It's a feature toggle",
24-
"fraction": 0.4
25-
}
22+
id: 'com.creditkarma.featureFlags.SometimesDisabled',
23+
description: "It's a feature toggle",
24+
fraction: 0.4,
25+
},
2626
]),
2727
]).then(
2828
(result: any) => {

src/tests/integration/index.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ describe('ToggleMap', () => {
1818
const toggle = await toggleMap('com.creditkarma.featureFlags.AlwaysEnabled')
1919
expect(toggle()).to.equal(true)
2020
})
21-
})
21+
})

0 commit comments

Comments
 (0)