Skip to content

Commit 56b173d

Browse files
authored
build(storybook): add ts check on storybook on linting (#132)
This PR add a ts checks also on typescript stories to avoid having a broken master.
1 parent 092e7f4 commit 56b173d

File tree

3 files changed

+25
-17
lines changed

3 files changed

+25
-17
lines changed

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,18 @@
2020
"start": "yarn storybook",
2121
"storybook": "start-storybook -p 9001 -c .storybook",
2222
"storybook:build": "rm -rf .out && build-storybook -c .storybook -o .out",
23-
"lint": "yarn build:ts --noEmit && tslint -c ./tslint.yaml -p ./tsconfig.json",
23+
"lint": "yarn typecheck:all && tslint -c ./tslint.yaml -p ./tsconfig.json",
2424
"lint:fix": "yarn lint --fix",
2525
"prettier": "prettier --check --debug-check \"**/*.{ts,tsx}\"",
2626
"prettier:fix": "prettier --write \"{,!(node_modules)/}**/*.{ts,tsx}\"",
2727
"test": "jest --config jest.config.json",
2828
"watch": "yarn test --watch",
2929
"format:fix": "yarn prettier:fix && yarn lint:fix",
3030
"format:check": "yarn prettier && yarn lint",
31-
"style:fix": "tsc -p ./tsconfig.json --noEmit && yarn prettier-tslint fix \"{,!(node_modules)/}**/*.{ts,tsx}\"",
32-
"semantic-release": "semantic-release"
31+
"style:fix": "yarn typecheck:src && yarn prettier-tslint fix \"{,!(node_modules)/}**/*.{ts,tsx}\"",
32+
"semantic-release": "semantic-release",
33+
"typecheck:src": "yarn build:ts --noEmit",
34+
"typecheck:all": "tsc -p ./tsconfig.all.json --noEmit"
3335
},
3436
"files": [
3537
"dist/**/*",

stories/interactions.tsx

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,6 @@ storiesOf('Interactions', module)
194194
linear: ScaleType.Linear,
195195
log: ScaleType.Log,
196196
};
197-
198-
const xScaleType = ScaleType.Linear;
199197
const yScaleType = select('yScaleType', yScaleTypeOptions, ScaleType.Linear, specChange);
200198

201199
const xAccessorOptions = { x: 'x', y1: 'y1', y2: 'y2' };
@@ -215,19 +213,14 @@ storiesOf('Interactions', module)
215213

216214
const data = hasAdditionalG1Value ? [...seriesData, additionalG1Value] : seriesData;
217215

218-
const barSeriesProps = {
219-
xScaleType,
220-
yScaleType,
221-
xAccessor,
222-
yAccessors,
223-
splitSeriesAccessors,
224-
data,
225-
yScaleToDataExtent,
226-
};
227-
228216
return (
229217
<Chart renderer="canvas" className={'story-chart'}>
230-
<Settings showLegend={true} legendPosition={Position.Right} {...onLegendItemListeners} xDomain={xDomain} />
218+
<Settings
219+
showLegend={true}
220+
legendPosition={Position.Right}
221+
{...onLegendItemListeners}
222+
xDomain={xDomain}
223+
/>
231224
<Axis
232225
id={getAxisId('bottom')}
233226
position={Position.Bottom}
@@ -242,7 +235,16 @@ storiesOf('Interactions', module)
242235
domain={yDomain}
243236
/>
244237

245-
<BarSeries id={getSpecId('bars')} {...barSeriesProps} />
238+
<BarSeries
239+
id={getSpecId('bars')}
240+
xScaleType={ScaleType.Linear}
241+
yScaleType={yScaleType}
242+
xAccessor={xAccessor}
243+
yAccessors={yAccessors}
244+
splitSeriesAccessors={splitSeriesAccessors}
245+
data={data}
246+
yScaleToDataExtent={yScaleToDataExtent}
247+
/>
246248
</Chart>
247249
);
248250
})

tsconfig.all.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"extends": "./tsconfig",
3+
"include": ["stories/**/*"]
4+
}

0 commit comments

Comments
 (0)