Browse Source

ESLint fixes

bubble
Kyle Shockey 7 years ago
parent
commit
b373182afe
No known key found for this signature in database GPG Key ID: DC20D559FFBC0D36
12 changed files with 58 additions and 20 deletions
  1. +3
    -2
      src/core/components/response.jsx
  2. +8
    -1
      src/core/components/version-stamp.jsx
  3. +13
    -4
      src/core/plugins/oas3/components/callbacks.jsx
  4. +10
    -1
      src/core/plugins/oas3/components/operation-link.jsx
  5. +12
    -1
      src/core/plugins/oas3/components/request-body.jsx
  6. +2
    -1
      src/core/plugins/oas3/wrap-components/model.jsx
  7. +0
    -1
      src/core/plugins/oas3/wrap-components/online-validator-badge.js
  8. +2
    -5
      src/core/plugins/oas3/wrap-components/parameters.jsx
  9. +0
    -1
      src/core/plugins/oas3/wrap-components/try-it-out-button.jsx
  10. +3
    -1
      src/core/plugins/spec/selectors.js
  11. +3
    -0
      test/.eslintrc
  12. +2
    -2
      test/core/system/system.js

+ 3
- 2
src/core/components/response.jsx View File

@@ -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 )



+ 8
- 1
src/core/components/version-stamp.jsx View File

@@ -1,5 +1,12 @@
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

+ 13
- 4
src/core/plugins/oas3/components/callbacks.jsx View File

@@ -1,8 +1,9 @@
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

+ 10
- 1
src/core/plugins/oas3/components/operation-link.jsx View File

@@ -1,6 +1,8 @@
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

+ 12
- 1
src/core/plugins/oas3/components/request-body.jsx View File

@@ -1,9 +1,11 @@
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

+ 2
- 1
src/core/plugins/oas3/wrap-components/model.jsx View File

@@ -1,4 +1,5 @@
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"



+ 0
- 1
src/core/plugins/oas3/wrap-components/online-validator-badge.js View File

@@ -1,4 +1,3 @@
import React from "react"
import { OAS3ComponentWrapFactory } from "../helpers"

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


+ 2
- 5
src/core/plugins/oas3/wrap-components/parameters.jsx View File

@@ -1,12 +1,9 @@
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)



+ 0
- 1
src/core/plugins/oas3/wrap-components/try-it-out-button.jsx View File

@@ -1,4 +1,3 @@
import React from "react"
import { OAS3ComponentWrapFactory } from "../helpers"

export default OAS3ComponentWrapFactory(() => {


+ 3
- 1
src/core/plugins/spec/selectors.js View File

@@ -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(


+ 3
- 0
test/.eslintrc View File

@@ -1,2 +1,5 @@
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

+ 2
- 2
test/core/system/system.js View File

@@ -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"
}


Loading…
Cancel
Save