Skip to content

Commit 3da38b5

Browse files
committed
Fixed lint issues.
1 parent 6d42e11 commit 3da38b5

5 files changed

Lines changed: 34 additions & 34 deletions

File tree

package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,19 @@
55
"main": "build/index.js",
66
"types": "build/index.d.ts",
77
"scripts": {
8-
"c": "rm -rf build/*",
8+
"c": "npm run clean",
99
"clean": "rm -rf build/*",
10-
"b": "tsc",
10+
"b": "npm run build",
1111
"build": "tsc",
12-
"clean-build": "rm -rf build/* && tsc",
12+
"clean-build": "npm run clean && npm run build",
1313
"build:watch": "tsc --watch",
1414
"clean-build:watch": "rm -rf build/* && tsc --watch",
15-
"t": "nyc mocha --opts ./src/test/mocha.opts",
15+
"t": "npm run test",
1616
"test": "nyc mocha --opts ./src/test/mocha.opts",
1717
"test:watch": "mocha --watch --watch-extensions ts --opts ./src/test/mocha.opts",
18-
"tw": "mocha --watch --watch-extensions ts --opts ./src/test/mocha.opts",
19-
"prepublishOnly": "build.bat",
18+
"tw": "npm run test:watch",
19+
"prepublishOnly": "npm run lint && npm test && npm run clean && npm run build",
20+
"l": "npm run lint",
2021
"lint": "tslint -p tsconfig.json -t stylish",
2122
"fix-lint": "tslint --fix -p tsconfig.json -t stylish"
2223
},

src/chart-def.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { ISerializedDataFrame } from "data-forge/build/lib/dataframe";
2+
23
/**
34
* Defines the type of chart to output.
45
*/
@@ -100,16 +101,15 @@ export interface ILegendConfig {
100101
show?: boolean;
101102
}
102103

103-
104104
/**
105105
* Defines the chart.
106106
*/
107107
export interface IPlotConfig {
108108

109109
/**
110-
* The type of chart to render.
111-
* Default to "line".
112-
*/
110+
* The type of chart to render.
111+
* Default to "line".
112+
*/
113113
chartType?: ChartType;
114114

115115
/**

src/plot-api.ts

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export interface IRenderOptions {
5555
/**
5656
* Path to electron, so that electron can be installed separately to a different location and shared
5757
* between the various packages that need it.
58-
*
58+
*
5959
* Electron is used to render charts and capture them to images.
6060
*/
6161
electronPath?: string;
@@ -353,8 +353,8 @@ export abstract class AbstractPlotAPI implements IPlotAPI {
353353
electronPath: renderOptions && renderOptions.electronPath,
354354
inflateOptions: {
355355
inMemoryFiles: [
356-
{
357-
file: "chart-def.json",
356+
{
357+
file: "chart-def.json",
358358
content: JSON.stringify(chartDef, null, 4),
359359
},
360360
],
@@ -379,13 +379,13 @@ export abstract class AbstractPlotAPI implements IPlotAPI {
379379
const exportTemplateOptions: IExportOptions = {
380380
overwrite,
381381
inMemoryFiles: [
382-
{
383-
file: "chart-def.json",
382+
{
383+
file: "chart-def.json",
384384
content: JSON.stringify(chartDef, null, 4),
385385
},
386386
],
387387
};
388-
388+
389389
await exportTemplate(templatePath, { chartDef }, outputFolderPath, exportTemplateOptions);
390390

391391
if (exportOptions && exportOptions.openBrowser) {
@@ -396,7 +396,7 @@ export abstract class AbstractPlotAPI implements IPlotAPI {
396396
/**
397397
* Serialize the plot definition so that it can be converted to JSON.
398398
* The JSON definition of the chart can be used to instantiate the chart in a browser.
399-
*
399+
*
400400
* TODO: This function doesn't really belong in the abstract class, it would be better to live the concrete PlotAPI class.
401401
*/
402402
serialize(): IChartDef {
@@ -430,6 +430,15 @@ export abstract class AbstractPlotAPI implements IPlotAPI {
430430
*/
431431
export class PlotAPI extends AbstractPlotAPI {
432432

433+
/**
434+
* Deserialize an instance of PlotAPI from a previously serialize chart def.
435+
*
436+
* @param chartDef The chart definition to deserialize from.
437+
*/
438+
static deserialize(chartDef: IChartDef): IPlotAPI {
439+
return new PlotAPI(chartDef.data, chartDef.plotConfig, true, chartDef.axisMap);
440+
}
441+
433442
constructor(data: ISerializedDataFrame, plotConfig: IPlotConfig, showLegendDefault: boolean, globalAxisMap?: IAxisMap) {
434443
assert.isObject(data, "Expected 'data' parameter to PlotAPI constructor to be a serialized dataframe.");
435444

@@ -497,7 +506,7 @@ export class PlotAPI extends AbstractPlotAPI {
497506
}
498507

499508
//
500-
//TODO: I'm sure if the expansion should happen here in the serialization?
509+
// TODO: I'm sure if the expansion should happen here in the serialization?
501510
// I feel there should be another function that does this expansion and that made it should happen
502511
// separately when the chart is rendered.
503512
//
@@ -592,16 +601,6 @@ export class PlotAPI extends AbstractPlotAPI {
592601

593602
super(data, expandedPlotConfig, expandedGlobalAxisMap);
594603
}
595-
596-
/**
597-
* Deserialize an instance of PlotAPI from a previously serialize chart def.
598-
*
599-
* @param chartDef The chart definition to deserialize from.
600-
*/
601-
static deserialize(chartDef: IChartDef): IPlotAPI {
602-
return new PlotAPI(chartDef.data, chartDef.plotConfig, true, chartDef.axisMap);
603-
}
604-
605604
}
606605

607606
/**
@@ -787,7 +786,7 @@ class YAxisConfigAPI extends AxisConfigAPI<IYAxisConfigAPI, ISingleYAxisMap> imp
787786
* @param value The minimum value to render.
788787
*/
789788
min(value: number): IYAxisConfigAPI {
790-
//todo:
789+
// todo:
791790
return this;
792791
}
793792

@@ -796,7 +795,7 @@ class YAxisConfigAPI extends AxisConfigAPI<IYAxisConfigAPI, ISingleYAxisMap> imp
796795
* @param value The maximum value to render.
797796
*/
798797
max(value: number): IYAxisConfigAPI {
799-
//todo:
798+
// todo:
800799
return this;
801800
}
802801

src/test/serialization.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { expect } from "chai";
22
import "mocha";
3-
import { DataFrame } from "data-forge";
43
import "../index";
54
import { PlotAPI } from "../plot-api";
65
import { IChartDef, ChartType, AxisType } from "../chart-def";
@@ -95,6 +94,4 @@ describe("serialization", () => {
9594
const serialized = plot.serialize();
9695
expect(serialized.plotConfig.legend.show).to.eql(false);
9796
});
98-
99-
10097
});

tslint.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@
2323
],
2424
"member-access": false,
2525
"arrow-parens": [true, "ban-single-arg-parens"],
26-
"max-classes-per-file": false
26+
"max-classes-per-file": false,
27+
"interface-name": false,
28+
"max-line-length": false,
29+
"no-trailing-whitespace": false
2730
},
2831
"defaultSeverity": "warning"
2932
}

0 commit comments

Comments
 (0)