mirror of
https://github.com/Redocly/redoc.git
synced 2025-08-07 13:44:54 +03:00
linting
This commit is contained in:
parent
8364fade0c
commit
26e676efb7
|
@ -28,16 +28,16 @@ export const StyledDropdown = styled(Dropdown)`
|
||||||
width: auto;
|
width: auto;
|
||||||
background: white;
|
background: white;
|
||||||
color: #263238;
|
color: #263238;
|
||||||
font-family: ${(props) => props.theme.typography.headings.fontFamily};
|
font-family: ${props => props.theme.typography.headings.fontFamily};
|
||||||
font-size: 0.929em;
|
font-size: 0.929em;
|
||||||
line-height: 1.5em;
|
line-height: 1.5em;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: border 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
|
transition: border 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
|
||||||
&:hover,
|
&:hover,
|
||||||
&:focus-within {
|
&:focus-within {
|
||||||
border: 1px solid ${(props) => props.theme.colors.primary.main};
|
border: 1px solid ${props => props.theme.colors.primary.main};
|
||||||
color: ${(props) => props.theme.colors.primary.main};
|
color: ${props => props.theme.colors.primary.main};
|
||||||
box-shadow: 0px 0px 0px 1px ${(props) => props.theme.colors.primary.main};
|
box-shadow: 0px 0px 0px 1px ${props => props.theme.colors.primary.main};
|
||||||
}
|
}
|
||||||
.dropdown-selector {
|
.dropdown-selector {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
|
@ -48,7 +48,7 @@ export const StyledDropdown = styled(Dropdown)`
|
||||||
margin-bottom: 5px;
|
margin-bottom: 5px;
|
||||||
}
|
}
|
||||||
.dropdown-selector-value {
|
.dropdown-selector-value {
|
||||||
font-family: ${(props) => props.theme.typography.headings.fontFamily};
|
font-family: ${props => props.theme.typography.headings.fontFamily};
|
||||||
position: relative;
|
position: relative;
|
||||||
font-size: 0.929em;
|
font-size: 0.929em;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
@ -63,7 +63,7 @@ export const StyledDropdown = styled(Dropdown)`
|
||||||
right: 3px;
|
right: 3px;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
transform: translateY(-50%);
|
transform: translateY(-50%);
|
||||||
border-color: ${(props) => props.theme.colors.primary.main} transparent transparent;
|
border-color: ${props => props.theme.colors.primary.main} transparent transparent;
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
border-width: 0.35em 0.35em 0;
|
border-width: 0.35em 0.35em 0;
|
||||||
width: 0;
|
width: 0;
|
||||||
|
@ -128,8 +128,8 @@ export const SimpleDropdown = styled(StyledDropdown)`
|
||||||
border: none;
|
border: none;
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
.dropdown-selector-value {
|
.dropdown-selector-value {
|
||||||
color: ${(props) => props.theme.colors.primary.main};
|
color: ${props => props.theme.colors.primary.main};
|
||||||
text-shadow: 0px 0px 0px ${(props) => props.theme.colors.primary.main};
|
text-shadow: 0px 0px 0px ${props => props.theme.colors.primary.main};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,10 +48,10 @@ const CallbackTitleWrapper = styled.button`
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const CallbackName = styled.span<{ deprecated?: boolean }>`
|
const CallbackName = styled.span<{ deprecated?: boolean }>`
|
||||||
text-decoration: ${(props) => (props.deprecated ? 'line-through' : 'none')};
|
text-decoration: ${props => (props.deprecated ? 'line-through' : 'none')};
|
||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const OperationBadgeStyled = styled(OperationBadge)`
|
const OperationBadgeStyled = styled(OperationBadge)`
|
||||||
margin: 0px 5px 0px 0px;
|
margin: 0 5px 0 0;
|
||||||
`;
|
`;
|
||||||
|
|
|
@ -34,11 +34,11 @@ class Json extends React.PureComponent<JsonProps> {
|
||||||
<button onClick={this.collapseAll}> Collapse all </button>
|
<button onClick={this.collapseAll}> Collapse all </button>
|
||||||
</SampleControls>
|
</SampleControls>
|
||||||
<OptionsContext.Consumer>
|
<OptionsContext.Consumer>
|
||||||
{(options) => (
|
{options => (
|
||||||
<PrismDiv
|
<PrismDiv
|
||||||
className={this.props.className}
|
className={this.props.className}
|
||||||
// tslint:disable-next-line
|
// tslint:disable-next-line
|
||||||
ref={(node) => (this.node = node!)}
|
ref={node => (this.node = node!)}
|
||||||
dangerouslySetInnerHTML={{
|
dangerouslySetInnerHTML={{
|
||||||
__html: jsonToHTML(this.props.data, options.jsonSampleExpandLevel),
|
__html: jsonToHTML(this.props.data, options.jsonSampleExpandLevel),
|
||||||
}}
|
}}
|
||||||
|
|
|
@ -6,8 +6,8 @@ export const jsonStyles = css`
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
font-family: ${(props) => props.theme.typography.code.fontFamily};
|
font-family: ${props => props.theme.typography.code.fontFamily};
|
||||||
font-size: ${(props) => props.theme.typography.code.fontSize};
|
font-size: ${props => props.theme.typography.code.fontSize};
|
||||||
|
|
||||||
white-space: ${({ theme }) => (theme.typography.code.wrap ? 'pre-wrap' : 'pre')};
|
white-space: ${({ theme }) => (theme.typography.code.wrap ? 'pre-wrap' : 'pre')};
|
||||||
contain: content;
|
contain: content;
|
||||||
|
@ -51,8 +51,8 @@ export const jsonStyles = css`
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
border: 0;
|
border: 0;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
font-family: ${(props) => props.theme.typography.code.fontFamily};
|
font-family: ${props => props.theme.typography.code.fontFamily};
|
||||||
font-size: ${(props) => props.theme.typography.code.fontSize};
|
font-size: ${props => props.theme.typography.code.fontSize};
|
||||||
padding-right: 6px;
|
padding-right: 6px;
|
||||||
padding-left: 6px;
|
padding-left: 6px;
|
||||||
padding-top: 0;
|
padding-top: 0;
|
||||||
|
|
|
@ -42,7 +42,7 @@ export class Operation extends React.Component<OperationProps> {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<OptionsContext.Consumer>
|
<OptionsContext.Consumer>
|
||||||
{(options) => (
|
{options => (
|
||||||
<OperationRow>
|
<OperationRow>
|
||||||
<MiddlePanel>
|
<MiddlePanel>
|
||||||
<H2>
|
<H2>
|
||||||
|
|
|
@ -14,13 +14,13 @@ export const StyledResponseTitle = styled(ResponseTitle)`
|
||||||
background-color: #f2f2f2;
|
background-color: #f2f2f2;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
color: ${(props) => props.theme.colors.responses[props.type].color};
|
color: ${props => props.theme.colors.responses[props.type].color};
|
||||||
background-color: ${(props) => props.theme.colors.responses[props.type].backgroundColor};
|
background-color: ${props => props.theme.colors.responses[props.type].backgroundColor};
|
||||||
&:focus {
|
&:focus {
|
||||||
outline: auto;
|
outline: auto;
|
||||||
outline-color: ${(props) => props.theme.colors.responses[props.type].color};
|
outline-color: ${props => props.theme.colors.responses[props.type].color};
|
||||||
}
|
}
|
||||||
${(props) =>
|
${props =>
|
||||||
(props.empty &&
|
(props.empty &&
|
||||||
`
|
`
|
||||||
cursor: default;
|
cursor: default;
|
||||||
|
|
|
@ -7,8 +7,8 @@ import { SecurityRequirementModel } from '../../services/models/SecurityRequirem
|
||||||
import { linksCss } from '../Markdown/styled.elements';
|
import { linksCss } from '../Markdown/styled.elements';
|
||||||
|
|
||||||
const ScopeName = styled.code`
|
const ScopeName = styled.code`
|
||||||
font-size: ${(props) => props.theme.typography.code.fontSize};
|
font-size: ${props => props.theme.typography.code.fontSize};
|
||||||
font-family: ${(props) => props.theme.typography.code.fontFamily};
|
font-family: ${props => props.theme.typography.code.fontFamily};
|
||||||
border: 1px solid ${({ theme }) => theme.colors.border.dark};
|
border: 1px solid ${({ theme }) => theme.colors.border.dark};
|
||||||
margin: 0 3px;
|
margin: 0 3px;
|
||||||
padding: 0.2em;
|
padding: 0.2em;
|
||||||
|
@ -67,12 +67,12 @@ export class SecurityRequirement extends React.PureComponent<SecurityRequirement
|
||||||
return (
|
return (
|
||||||
<SecurityRequirementOrWrap>
|
<SecurityRequirementOrWrap>
|
||||||
{security.schemes.length ? (
|
{security.schemes.length ? (
|
||||||
security.schemes.map((scheme) => {
|
security.schemes.map(scheme => {
|
||||||
return (
|
return (
|
||||||
<SecurityRequirementAndWrap key={scheme.id}>
|
<SecurityRequirementAndWrap key={scheme.id}>
|
||||||
<Link to={scheme.sectionId}>{scheme.id}</Link>
|
<Link to={scheme.sectionId}>{scheme.id}</Link>
|
||||||
{scheme.scopes.length > 0 && ' ('}
|
{scheme.scopes.length > 0 && ' ('}
|
||||||
{scheme.scopes.map((scope) => (
|
{scheme.scopes.map(scope => (
|
||||||
<ScopeName key={scope}>{scope}</ScopeName>
|
<ScopeName key={scope}>{scope}</ScopeName>
|
||||||
))}
|
))}
|
||||||
{scheme.scopes.length > 0 && ') '}
|
{scheme.scopes.length > 0 && ') '}
|
||||||
|
@ -92,7 +92,7 @@ const AuthHeaderColumn = styled.div`
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const SecuritiesColumn = styled.div`
|
const SecuritiesColumn = styled.div`
|
||||||
width: ${(props) => props.theme.schema.defaultDetailsWidth};
|
width: ${props => props.theme.schema.defaultDetailsWidth};
|
||||||
${media.lessThan('small')`
|
${media.lessThan('small')`
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
`}
|
`}
|
||||||
|
|
|
@ -72,7 +72,7 @@ export class RedocNormalizedOptions {
|
||||||
}
|
}
|
||||||
if (typeof value === 'string') {
|
if (typeof value === 'string') {
|
||||||
const res = {};
|
const res = {};
|
||||||
value.split(',').forEach((code) => {
|
value.split(',').forEach(code => {
|
||||||
res[code.trim()] = true;
|
res[code.trim()] = true;
|
||||||
});
|
});
|
||||||
return res;
|
return res;
|
||||||
|
@ -138,7 +138,7 @@ export class RedocNormalizedOptions {
|
||||||
case 'false':
|
case 'false':
|
||||||
return false;
|
return false;
|
||||||
default:
|
default:
|
||||||
return value.split(',').map((ext) => ext.trim());
|
return value.split(',').map(ext => ext.trim());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,7 +266,7 @@ export class RedocNormalizedOptions {
|
||||||
this.maxDisplayedEnumValues = argValueToNumber(raw.maxDisplayedEnumValues);
|
this.maxDisplayedEnumValues = argValueToNumber(raw.maxDisplayedEnumValues);
|
||||||
const ignoreNamedSchemas = Array.isArray(raw.ignoreNamedSchemas)
|
const ignoreNamedSchemas = Array.isArray(raw.ignoreNamedSchemas)
|
||||||
? raw.ignoreNamedSchemas
|
? raw.ignoreNamedSchemas
|
||||||
: raw.ignoreNamedSchemas?.split(',').map((s) => s.trim());
|
: raw.ignoreNamedSchemas?.split(',').map(s => s.trim());
|
||||||
this.ignoreNamedSchemas = new Set(ignoreNamedSchemas);
|
this.ignoreNamedSchemas = new Set(ignoreNamedSchemas);
|
||||||
this.hideSchemaPattern = argValueToBoolean(raw.hideSchemaPattern);
|
this.hideSchemaPattern = argValueToBoolean(raw.hideSchemaPattern);
|
||||||
this.generatedPayloadSamplesMaxDepth =
|
this.generatedPayloadSamplesMaxDepth =
|
||||||
|
|
|
@ -142,9 +142,9 @@ describe('Utils', () => {
|
||||||
object: ['maxProperties', 'minProperties', 'required', 'additionalProperties', 'properties'],
|
object: ['maxProperties', 'minProperties', 'required', 'additionalProperties', 'properties'],
|
||||||
};
|
};
|
||||||
|
|
||||||
Object.keys(tests).forEach((name) => {
|
Object.keys(tests).forEach(name => {
|
||||||
it(`Should detect ${name} if ${name} properties are present`, () => {
|
it(`Should detect ${name} if ${name} properties are present`, () => {
|
||||||
tests[name].forEach((propName) => {
|
tests[name].forEach(propName => {
|
||||||
expect(
|
expect(
|
||||||
detectType({
|
detectType({
|
||||||
[propName]: 0,
|
[propName]: 0,
|
||||||
|
@ -727,11 +727,11 @@ describe('Utils', () => {
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
testCases.forEach((locationTestGroup) => {
|
testCases.forEach(locationTestGroup => {
|
||||||
describe(locationTestGroup.description, () => {
|
describe(locationTestGroup.description, () => {
|
||||||
locationTestGroup.cases.forEach((valueTypeTestGroup) => {
|
locationTestGroup.cases.forEach(valueTypeTestGroup => {
|
||||||
describe(valueTypeTestGroup.description, () => {
|
describe(valueTypeTestGroup.description, () => {
|
||||||
valueTypeTestGroup.cases.forEach((testCase) => {
|
valueTypeTestGroup.cases.forEach(testCase => {
|
||||||
it(`should serialize correctly when style is ${testCase.style} and explode is ${testCase.explode}`, () => {
|
it(`should serialize correctly when style is ${testCase.style} and explode is ${testCase.explode}`, () => {
|
||||||
const parameter: OpenAPIParameter = {
|
const parameter: OpenAPIParameter = {
|
||||||
name: locationTestGroup.name,
|
name: locationTestGroup.name,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user