ESLint fixes

上级 f7018bc7
......@@ -79,14 +79,15 @@ export default class Response extends React.Component {
const ContentType = getComponent("contentType")
var sampleResponse
var schema
if(isOAS3()) {
let oas3SchemaForContentType = response.getIn(["content", this.state.responseContentType, "schema"])
sampleResponse = oas3SchemaForContentType ? getSampleSchema(oas3SchemaForContentType.toJS(), this.state.responseContentType, { includeReadOnly: true }) : null
var schema = oas3SchemaForContentType ? inferSchema(oas3SchemaForContentType.toJS()) : null
schema = oas3SchemaForContentType ? inferSchema(oas3SchemaForContentType.toJS()) : null
} else {
sampleResponse = schema ? getSampleSchema(schema, contentType, { includeReadOnly: true }) : null
var schema = inferSchema(response.toJS())
schema = inferSchema(response.toJS())
}
let example = getExampleComponent( sampleResponse, examples, HighlightCode )
......
import React from "react"
import PropTypes from "prop-types"
export default ({ version }) => {
const VersionStamp = ({ version }) => {
return <small><pre className="version"> { version } </pre></small>
}
VersionStamp.propTypes = {
version: PropTypes.string.isRequired
}
export default VersionStamp
import React from "react"
import PropTypes from "prop-types"
export default (props) => {
const Callbacks = (props) => {
let { callbacks, getComponent } = props
const Markdown = getComponent("Markdown")
// const Markdown = getComponent("Markdown")
const Operation = getComponent("operation", true)
if(!callbacks) {
......@@ -10,10 +11,10 @@ export default (props) => {
}
let callbackElements = callbacks.map((callback, callbackName) => {
return <div>
return <div key={callbackName}>
<h2>{callbackName}</h2>
{ callback.map((pathItem, pathItemName) => {
return <div>
return <div key={pathItemName}>
{ pathItem.map((operation, method) => {
return <Operation
operation={operation}
......@@ -38,3 +39,11 @@ export default (props) => {
{callbackElements}
</div>
}
Callbacks.propTypes = {
getComponent: PropTypes.function.isRequired,
callbacks: PropTypes.array.isRequired
}
export default Callbacks
import React, { Component } from "react"
import PropTypes from "prop-types"
import ImPropTypes from "react-immutable-proptypes"
export default class OperationLink extends Component {
class OperationLink extends Component {
render() {
const { link, name } = this.props
......@@ -26,3 +28,10 @@ function padString(n, string) {
.map((line, i) => i > 0 ? Array(n + 1).join(" ") + line : line)
.join("\n")
}
OperationLink.propTypes = {
link: ImPropTypes.orderedMap.isRequired,
name: PropTypes.String
}
export default OperationLink
import React from "react"
import PropTypes from "prop-types"
import ImPropTypes from "react-immutable-proptypes"
import { OrderedMap } from "immutable"
import { getSampleSchema } from "core/utils"
export default ({ requestBody, getComponent, specSelectors, contentType }) => {
const RequestBody = ({ requestBody, getComponent, specSelectors, contentType }) => {
const Markdown = getComponent("Markdown")
const ModelExample = getComponent("modelExample")
const HighlightCode = getComponent("highlightCode")
......@@ -29,3 +31,12 @@ export default ({ requestBody, getComponent, specSelectors, contentType }) => {
/>
</div>
}
RequestBody.propTypes = {
requestBody: ImPropTypes.orderedMap.isRequired,
getComponent: PropTypes.function.isRequired,
specSelectors: PropTypes.object.isRequired,
contentType: PropTypes.string.isRequired
}
export default RequestBody
import React, { Component, PropTypes } from "react"
import React, { Component } from "react"
import PropTypes from "prop-types"
import { OAS3ComponentWrapFactory } from "../helpers"
import { Model } from "core/components/model"
......
import React from "react"
import { OAS3ComponentWrapFactory } from "../helpers"
// We're disabling the Online Validator Badge until the online validator
......
import React, { Component, PropTypes } from "react"
import React, { Component } from "react"
import PropTypes from "prop-types"
import Im, { Map } from "immutable"
import ImPropTypes from "react-immutable-proptypes"
import { OAS3ComponentWrapFactory } from "../helpers"
const mapRequestBody = (iterable, fn) => iterable.entries().filter(Im.Map.isMap).map((val) => {
return fn(val.get(0), val.get(1))
})
// More readable, just iterate over maps, only
const eachMap = (iterable, fn) => iterable.valueSeq().filter(Im.Map.isMap).map(fn)
......
import React from "react"
import { OAS3ComponentWrapFactory } from "../helpers"
export default OAS3ComponentWrapFactory(() => {
......
......@@ -49,8 +49,10 @@ export const spec = state => {
export const isOAS3 = createSelector(
// isOAS3 is stubbed out here to work around an issue with injecting more selectors
// in the OAS3 plugin, and to ensure that the function is always available.
// It's not perfect, but our hybrid (core+plugin code) implementation for OAS3
// needs this. //KS
spec,
spec => false
() => false
)
export const info = createSelector(
......
env:
mocha: true
rules:
"react/prop-types": 1 # bah humbug
"no-unused-vars": 1 # unused vars in tests can be useful for indicating a full signature
......@@ -326,7 +326,7 @@ describe("bound system", function(){
})
describe('wrapSelectors', () => {
describe("wrapSelectors", () => {
it("should wrap a selector and provide a reference to the original", function(){
// Given
......@@ -427,7 +427,7 @@ describe("bound system", function(){
wrapSelectors: {
wow: (ori, system) => (dogeState) => {
// Then
expect(dogeState.toJS().abc).toEqual('123')
expect(dogeState.toJS().abc).toEqual("123")
done()
return ori() + " wrapper"
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册