Skip to content

Commit 3794967

Browse files
committed
infra: setup tslint
1 parent 80b0415 commit 3794967

File tree

4 files changed

+182
-19
lines changed

4 files changed

+182
-19
lines changed

package-lock.json

Lines changed: 156 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
},
66
"name": "json-2-csv",
77
"description": "A JSON to CSV and CSV to JSON converter that natively supports sub-documents and auto-generates the CSV heading.",
8-
"version": "3.4.0",
8+
"version": "3.4.1",
99
"repository": {
1010
"type": "git",
1111
"url": "https://github.com/mrodrig/json-2-csv.git"
@@ -20,9 +20,11 @@
2020
"main": "./src/converter.js",
2121
"types": "./src/converter.d.ts",
2222
"scripts": {
23-
"test": "./node_modules/.bin/mocha test/tests.js",
24-
"coverage": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha -- -R spec",
25-
"lint": "./node_modules/.bin/eslint src bin test"
23+
"test": "mocha test/tests.js",
24+
"coverage": "istanbul cover mocha -- -R spec",
25+
"lint": "npm run lint:eslint && npm run lint:tslint",
26+
"lint:eslint": "eslint src bin test",
27+
"lint:tslint": "tslint -c tslint.json 'src/**/*.ts'"
2628
},
2729
"keywords": [
2830
"json",
@@ -48,7 +50,9 @@
4850
"eslint": "5.11.1",
4951
"istanbul": "0.4.5",
5052
"mocha": "5.2.0",
51-
"should": "13.2.3"
53+
"should": "13.2.3",
54+
"tslint": "5.12.1",
55+
"typescript": "3.3.3"
5256
},
5357
"engines": {
5458
"node": ">= 6"

src/converter.d.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export interface ReadOptions {
1+
export interface ISharedOptions {
22
/**
33
* Specifies the different types of delimiters
44
*/
@@ -36,7 +36,7 @@ export interface ReadOptions {
3636
trimFieldValues?: boolean;
3737
}
3838

39-
export interface WriteOptions extends ReadOptions {
39+
export interface IFullOptions extends ISharedOptions {
4040
/**
4141
* Should all documents have the same schema?
4242
* @default false
@@ -68,10 +68,12 @@ export interface WriteOptions extends ReadOptions {
6868

6969
}
7070

71-
export function json2csv(data: object[], callback: (err?: Error, csv?: string) => void, options?: WriteOptions): void;
71+
export function json2csv(data: object[],
72+
callback: (err?: Error, csv?: string) => void, options?: IFullOptions): void;
7273

73-
export function json2csvAsync(data: object[], options?: WriteOptions): Promise<string>;
74+
export function json2csvAsync(data: object[], options?: IFullOptions): Promise<string>;
7475

75-
export function csv2json(csv: string, callback: (err?: Error, data?: unknown[]) => void, options?: ReadOptions): void;
76+
export function csv2json(csv: string,
77+
callback: (err?: Error, data?: Array<unknown>) => void, options?: ISharedOptions): void;
7678

77-
export function csv2jsonAsync(csv: string, options?: ReadOptions): Promise<unknown[]>;
79+
export function csv2jsonAsync(csv: string, options?: ISharedOptions): Promise<Array<unknown>>;

tslint.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"defaultSeverity": "error",
3+
"extends": [
4+
"tslint:recommended"
5+
],
6+
"jsRules": {},
7+
"rules": {},
8+
"rulesDirectory": []
9+
}

0 commit comments

Comments
 (0)