Skip to content

Commit

Permalink
chore: fix lint issues (#857)
Browse files Browse the repository at this point in the history
  • Loading branch information
josephaxisa authored Oct 14, 2021
1 parent 9a9d9fe commit 55daf45
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 56 deletions.
9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,12 @@
]
},
"overrides": [
{
"files": ["packages/run-it/**/*.ts{,x}", "packages/api-explorer/**/*.ts{,x}", "packages/hackathon/**/*.ts{,x}"],
"rules": {
"no-restricted-imports": "off"
}
},
{
"files": [ "packages/sdk-codegen/**/*.ts", "packages/sdk-codegen-scripts/**/*.ts"],
"rules": {
Expand All @@ -195,7 +201,8 @@
"rules": {
"testing-library/render-result-naming-convention": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/ban-ts-comment": "off"
"@typescript-eslint/ban-ts-comment": "off",
"testing-library/prefer-screen-queries": "off"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@
SOFTWARE.
*/
import { renderWithTheme } from '@looker/components-test-utils'
import React from 'react'
import { renderWithTheme } from '@looker/components-test-utils'
import { screen } from '@testing-library/react'
import { SomethingWentWrong } from './SomethingWentWrong'

const getMockedComponent = (propOverrides = {}) => {
Expand All @@ -43,16 +44,16 @@ describe('SomethingWentWrong', () => {
const actionMessage = 'User please do this action. It might help'
const altText = '500 error graphic'

const { getByText, getByAltText } = renderWithTheme(
renderWithTheme(
getMockedComponent({
header,
actionMessage,
altText,
})
)

expect(getByText(header)).toBeVisible()
expect(getByText(actionMessage)).toBeVisible()
expect(getByAltText(altText)).toBeVisible()
expect(screen.getByText(header)).toBeVisible()
expect(screen.getByText(actionMessage)).toBeVisible()
expect(screen.getByAltText(altText)).toBeVisible()
})
})
35 changes: 20 additions & 15 deletions packages/code-editor/src/Markdown/common.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,24 @@ import { Paragraph, Table, Heading } from '@looker/components'
* Common styled components used by DocMarkdown
*/

export const MDHeading = styled(Heading)``
export const MDHeading = Object.assign(styled(Heading)``, {
defaultProps: {
mb: 'xsmall',
pt: 'xsmall',
},
})

MDHeading.defaultProps = {
mb: 'xsmall',
pt: 'xsmall',
}

export const MDParagraph = styled(Paragraph)`
color: ${({ theme }) => theme.colors.text5};
max-width: 600px;
`
MDParagraph.defaultProps = {
mb: 'large',
}
export const MDParagraph = Object.assign(
styled(Paragraph)`
color: ${({ theme }) => theme.colors.text5};
max-width: 600px;
`,
{
defaultProps: {
mb: 'large',
},
}
)

const OListInternal = styled.ol`
max-width: 600px;
Expand All @@ -65,5 +69,6 @@ export const MDListItem = styled.li`
margin-bottom: 4px;
`

export const MDTable = styled(Table)``
MDTable.defaultProps = { mb: 'large' }
export const MDTable = Object.assign(styled(Table)``, {
defaultProps: { mb: 'large' },
})
49 changes: 26 additions & 23 deletions packages/run-it/src/components/MethodBadge/MethodBadge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,26 +98,29 @@ export const cssForIntent = (intent: ApixIntentNames) =>
color: ${({ theme }) => generatePressed(theme.colors[intent])};
`

export const MethodBadge = styled.div<MethodBadgeProps>`
${typography}
${({ type }) => cssForIntent(pickBadgeIntent(type))};
background: ${({ type, titleStatus, theme: { colors } }) =>
titleStatus ? colors.ui1 : intentUIBlend(pickBadgeIntent(type), 1)};
border: 1px solid transparent;
border-radius: ${({ theme: { radii } }) => radii.medium};
/** NOTE: This is below minimum accessibility threshold font-size */
${({ compact }) => compact && `font-size: 9px;`}
min-width: ${({ minWidth }) => minWidth};
padding: ${({ compact, theme: { space } }) =>
`${space.xxsmall} ${compact ? space.none : space.xsmall}`};
`

MethodBadge.defaultProps = {
fontSize: 'xsmall',
fontWeight: 'semiBold',
minWidth: '2.5rem',
}
export const MethodBadge = Object.assign(
styled.div<MethodBadgeProps>`
${typography}
${({ type }) => cssForIntent(pickBadgeIntent(type))};
background: ${({ type, titleStatus, theme: { colors } }) =>
titleStatus ? colors.ui1 : intentUIBlend(pickBadgeIntent(type), 1)};
border: 1px solid transparent;
border-radius: ${({ theme: { radii } }) => radii.medium};
/** NOTE: This is below minimum accessibility threshold font-size */
${({ compact }) => compact && `font-size: 9px;`}
min-width: ${({ minWidth }) => minWidth};
padding: ${({ compact, theme: { space } }) =>
`${space.xxsmall} ${compact ? space.none : space.xsmall}`};
`,
{
defaultProps: {
fontSize: 'xsmall',
fontWeight: 'semiBold',
minWidth: '2.5rem',
},
}
)
22 changes: 10 additions & 12 deletions packages/run-it/src/components/common/common.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,13 @@ import { Heading, Span } from '@looker/components'
* Common styled components to be used across the whole library
*/

export const RunItHeading = styled(Heading)``

RunItHeading.defaultProps = {
mb: 'xsmall',
pt: 'xsmall',
}

export const DarkSpan = styled(Span)``

DarkSpan.defaultProps = {
color: 'text3', // `${({ theme }) => theme.colors.text3}`,
}
export const RunItHeading = Object.assign(styled(Heading)``, {
defaultProps: {
mb: 'xsmall',
pt: 'xsmall',
},
})

export const DarkSpan = Object.assign(styled(Span)``, {
color: 'text3',
})

0 comments on commit 55daf45

Please sign in to comment.