Skip to content

Commit

Permalink
build(lint): better linting with typechecking
Browse files Browse the repository at this point in the history
  • Loading branch information
arusanov committed May 31, 2017
1 parent c19769b commit 2993fbc
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 26 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"node": ">=6.0.0"
},
"scripts": {
"lint": "tslint -e **/node_modules/** -e **/dist/** -e **/lib/** -t codeFrame **/*.ts ",
"lint": "tslint --type-check -p tsconfig.test.json -e **/node_modules/** -e **/dist/** -e **/lib/** -t codeFrame **/*.ts ",
"prebuild": "rimraf dist && rimraf docs && rimraf lib",
"build": "npm run bundle && npm run optimize && npm run minify && npm run size",
"bundle": "tsc && rollup -f umd -m dist/typedash.dev.js.map -n typedash -o dist/typedash.dev.js lib/typedash.js",
Expand Down
4 changes: 2 additions & 2 deletions src/objects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function keys<T extends object> (item: T): (keyof T)[] {
* @param item The object to check
* @returns {boolean}
*/
export function isEmpty (item?: Object | Array<any>): boolean {
export function isEmpty (item?: Object | Array<any> | null): boolean {
return !item || (isArray(item) && !item.length) || !keys(item).length
}

Expand Down Expand Up @@ -197,7 +197,7 @@ export function patch<T extends object> (old: T, patch: Partial<T>): Partial<T>
* @param objB
* @returns {boolean}
*/
export function shallowEqual (objA: Object, objB: Object) {
export function shallowEqual (objA: Object | null | undefined, objB: Object | null | undefined) {
if (objA === objB) {
return true
}
Expand Down
4 changes: 1 addition & 3 deletions test/objects.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,7 @@ describe('Objects test', () => {
})

it('should treat objects created by `Object.create(null)` like any other plain object', () => {
function Foo () { this.a = 1 }

Foo.prototype.constructor = null
class Foo { a = 1 }

const object2 = {'a': 1}
expect(shallowequal(new Foo(), object2)).toEqual(true)
Expand Down
23 changes: 3 additions & 20 deletions tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,7 @@
{
"compilerOptions": {
"outDir": "lib",
"declaration": true,
"moduleResolution": "node",
"module": "es6",
"target": "es5",
"noUnusedLocals": true,
"noUnusedParameters": true,
"importHelpers": true,
"lib": [
"es5",
"dom"
],
"strict": true,
"sourceMap": true,
"typeRoots": [
"node_modules/@types"
]
},
"extends":"./tsconfig.json",
"include": [
"src"
"src",
"test"
]
}

0 comments on commit 2993fbc

Please sign in to comment.