Skip to content

Commit b373182

Browse files
committed
ESLint fixes
1 parent f7018bc commit b373182

File tree

12 files changed

+58
-20
lines changed

12 files changed

+58
-20
lines changed

src/core/components/response.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,15 @@ export default class Response extends React.Component {
7979
const ContentType = getComponent("contentType")
8080

8181
var sampleResponse
82+
var schema
8283

8384
if(isOAS3()) {
8485
let oas3SchemaForContentType = response.getIn(["content", this.state.responseContentType, "schema"])
8586
sampleResponse = oas3SchemaForContentType ? getSampleSchema(oas3SchemaForContentType.toJS(), this.state.responseContentType, { includeReadOnly: true }) : null
86-
var schema = oas3SchemaForContentType ? inferSchema(oas3SchemaForContentType.toJS()) : null
87+
schema = oas3SchemaForContentType ? inferSchema(oas3SchemaForContentType.toJS()) : null
8788
} else {
8889
sampleResponse = schema ? getSampleSchema(schema, contentType, { includeReadOnly: true }) : null
89-
var schema = inferSchema(response.toJS())
90+
schema = inferSchema(response.toJS())
9091
}
9192
let example = getExampleComponent( sampleResponse, examples, HighlightCode )
9293

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
import React from "react"
2+
import PropTypes from "prop-types"
23

3-
export default ({ version }) => {
4+
const VersionStamp = ({ version }) => {
45
return <small><pre className="version"> { version } </pre></small>
56
}
7+
8+
VersionStamp.propTypes = {
9+
version: PropTypes.string.isRequired
10+
}
11+
12+
export default VersionStamp

src/core/plugins/oas3/components/callbacks.jsx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
import React from "react"
2+
import PropTypes from "prop-types"
23

3-
export default (props) => {
4+
const Callbacks = (props) => {
45
let { callbacks, getComponent } = props
5-
const Markdown = getComponent("Markdown")
6+
// const Markdown = getComponent("Markdown")
67
const Operation = getComponent("operation", true)
78

89
if(!callbacks) {
910
return <span>No callbacks</span>
1011
}
1112

1213
let callbackElements = callbacks.map((callback, callbackName) => {
13-
return <div>
14+
return <div key={callbackName}>
1415
<h2>{callbackName}</h2>
1516
{ callback.map((pathItem, pathItemName) => {
16-
return <div>
17+
return <div key={pathItemName}>
1718
{ pathItem.map((operation, method) => {
1819
return <Operation
1920
operation={operation}
@@ -38,3 +39,11 @@ export default (props) => {
3839
{callbackElements}
3940
</div>
4041
}
42+
43+
Callbacks.propTypes = {
44+
getComponent: PropTypes.function.isRequired,
45+
callbacks: PropTypes.array.isRequired
46+
47+
}
48+
49+
export default Callbacks

src/core/plugins/oas3/components/operation-link.jsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import React, { Component } from "react"
2+
import PropTypes from "prop-types"
3+
import ImPropTypes from "react-immutable-proptypes"
24

3-
export default class OperationLink extends Component {
5+
class OperationLink extends Component {
46
render() {
57
const { link, name } = this.props
68

@@ -26,3 +28,10 @@ function padString(n, string) {
2628
.map((line, i) => i > 0 ? Array(n + 1).join(" ") + line : line)
2729
.join("\n")
2830
}
31+
32+
OperationLink.propTypes = {
33+
link: ImPropTypes.orderedMap.isRequired,
34+
name: PropTypes.String
35+
}
36+
37+
export default OperationLink

src/core/plugins/oas3/components/request-body.jsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import React from "react"
2+
import PropTypes from "prop-types"
3+
import ImPropTypes from "react-immutable-proptypes"
24
import { OrderedMap } from "immutable"
35
import { getSampleSchema } from "core/utils"
46

57

6-
export default ({ requestBody, getComponent, specSelectors, contentType }) => {
8+
const RequestBody = ({ requestBody, getComponent, specSelectors, contentType }) => {
79
const Markdown = getComponent("Markdown")
810
const ModelExample = getComponent("modelExample")
911
const HighlightCode = getComponent("highlightCode")
@@ -29,3 +31,12 @@ export default ({ requestBody, getComponent, specSelectors, contentType }) => {
2931
/>
3032
</div>
3133
}
34+
35+
RequestBody.propTypes = {
36+
requestBody: ImPropTypes.orderedMap.isRequired,
37+
getComponent: PropTypes.function.isRequired,
38+
specSelectors: PropTypes.object.isRequired,
39+
contentType: PropTypes.string.isRequired
40+
}
41+
42+
export default RequestBody

src/core/plugins/oas3/wrap-components/model.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import React, { Component, PropTypes } from "react"
1+
import React, { Component } from "react"
2+
import PropTypes from "prop-types"
23
import { OAS3ComponentWrapFactory } from "../helpers"
34
import { Model } from "core/components/model"
45

src/core/plugins/oas3/wrap-components/online-validator-badge.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import React from "react"
21
import { OAS3ComponentWrapFactory } from "../helpers"
32

43
// We're disabling the Online Validator Badge until the online validator

src/core/plugins/oas3/wrap-components/parameters.jsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
import React, { Component, PropTypes } from "react"
1+
import React, { Component } from "react"
2+
import PropTypes from "prop-types"
23
import Im, { Map } from "immutable"
34
import ImPropTypes from "react-immutable-proptypes"
45
import { OAS3ComponentWrapFactory } from "../helpers"
56

6-
const mapRequestBody = (iterable, fn) => iterable.entries().filter(Im.Map.isMap).map((val) => {
7-
return fn(val.get(0), val.get(1))
8-
})
9-
107
// More readable, just iterate over maps, only
118
const eachMap = (iterable, fn) => iterable.valueSeq().filter(Im.Map.isMap).map(fn)
129

src/core/plugins/oas3/wrap-components/try-it-out-button.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import React from "react"
21
import { OAS3ComponentWrapFactory } from "../helpers"
32

43
export default OAS3ComponentWrapFactory(() => {

src/core/plugins/spec/selectors.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,10 @@ export const spec = state => {
4949
export const isOAS3 = createSelector(
5050
// isOAS3 is stubbed out here to work around an issue with injecting more selectors
5151
// in the OAS3 plugin, and to ensure that the function is always available.
52+
// It's not perfect, but our hybrid (core+plugin code) implementation for OAS3
53+
// needs this. //KS
5254
spec,
53-
spec => false
55+
() => false
5456
)
5557

5658
export const info = createSelector(

0 commit comments

Comments
 (0)