Skip to content

Commit

Permalink
Fix pattern value error handling (#15)
Browse files Browse the repository at this point in the history
* Fix pattern value error handling

* Allow _ argument
  • Loading branch information
tomoya authored May 4, 2020
1 parent 331b36c commit bfdd8d5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ module.exports = {
'error',
{ ignoreEnums: true, ignoreNumericLiteralTypes: true },
],
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'react/jsx-props-no-spreading': 'off',
'react/prop-types': 'off',
'jest/no-mocks-import': 'off',
Expand Down
3 changes: 2 additions & 1 deletion src/getComponentAndPattern.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ describe('getComponentAndPattern', () => {
component: ComponentMock,
matrix: {
pattern: {
color: 'string',
color: ['string'],
fontSize: 'string',
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion src/getComponentAndPattern.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function getComponentAndPattern({ parameters }: StoryContext): CoponentAn
if (
isObject(pattern) &&
Object.keys(pattern).length !== 0 &&
!Array.isArray(Object.entries(pattern)[0][1])
Object.entries(pattern).some(([_, v]) => !Array.isArray(v))
) {
errors.push('Parameter pattern value must be Array');
}
Expand Down

0 comments on commit bfdd8d5

Please sign in to comment.