Autofix ESLint problems

This commit is contained in:
Kyle Shockey
2017-03-22 20:40:05 -07:00
parent 664e44d3d9
commit f195d01184
11 changed files with 35 additions and 35 deletions

View File

@@ -1,6 +1,6 @@
import React, { PropTypes } from "react" import React, { PropTypes } from "react"
import ImPropTypes from "react-immutable-proptypes" import ImPropTypes from "react-immutable-proptypes"
import { fromJS } from 'immutable' import { fromJS } from "immutable"
const noop = ()=>{} const noop = ()=>{}

View File

@@ -10,7 +10,7 @@ export default class Models extends Component {
render(){ render(){
let { specSelectors, getComponent, layoutSelectors, layoutActions } = this.props let { specSelectors, getComponent, layoutSelectors, layoutActions } = this.props
let definitions = specSelectors.definitions() let definitions = specSelectors.definitions()
let showModels = layoutSelectors.isShown('models', true) let showModels = layoutSelectors.isShown("models", true)
const Model = getComponent("model") const Model = getComponent("model")
const Collapse = getComponent("Collapse") const Collapse = getComponent("Collapse")
@@ -18,7 +18,7 @@ export default class Models extends Component {
if (!definitions.size) return null if (!definitions.size) return null
return <section className={ showModels ? "models is-open" : "models"}> return <section className={ showModels ? "models is-open" : "models"}>
<h4 onClick={() => layoutActions.show('models', !showModels)}> <h4 onClick={() => layoutActions.show("models", !showModels)}>
<span>Models</span> <span>Models</span>
<svg width="20" height="20"> <svg width="20" height="20">
<use xlinkHref="#large-arrow" /> <use xlinkHref="#large-arrow" />

View File

@@ -31,7 +31,7 @@ export default class OnlineValidatorBadge extends React.Component {
return null return null
} }
return (<span style={{ float: "right"}}> return (<span style={{ float: "right"}}>
<a target="_blank" href={`${ this.state.validatorUrl }/debug?url=${ this.state.url }`}> <a target="_blank" href={`${ this.state.validatorUrl }/debug?url=${ this.state.url }`}>
<img alt="Online validator badge" src={`${ this.state.validatorUrl }?url=${ this.state.url }`} /> <img alt="Online validator badge" src={`${ this.state.validatorUrl }?url=${ this.state.url }`} />
</a> </a>

View File

@@ -1,5 +1,5 @@
import React, { PropTypes } from "react" import React, { PropTypes } from "react"
import { fromJS } from 'immutable' import { fromJS } from "immutable"
import { getSampleSchema } from "core/utils" import { getSampleSchema } from "core/utils"
const getExampleComponent = ( sampleResponse, examples, HighlightCode ) => { const getExampleComponent = ( sampleResponse, examples, HighlightCode ) => {

View File

@@ -79,7 +79,7 @@ module.exports = function SwaggerUI(opts) {
if(!queryConfig.url && typeof mergedConfig.spec === "object" && Object.keys(mergedConfig.spec).length) { if(!queryConfig.url && typeof mergedConfig.spec === "object" && Object.keys(mergedConfig.spec).length) {
system.specActions.updateUrl("") system.specActions.updateUrl("")
system.specActions.updateLoadingStatus("success"); system.specActions.updateLoadingStatus("success")
system.specActions.updateSpec(JSON.stringify(mergedConfig.spec)) system.specActions.updateSpec(JSON.stringify(mergedConfig.spec))
} else if(system.specActions.download && mergedConfig.url) { } else if(system.specActions.download && mergedConfig.url) {
system.specActions.updateUrl(mergedConfig.url) system.specActions.updateUrl(mergedConfig.url)

View File

@@ -57,14 +57,14 @@ export default class SplitPaneMode extends React.Component {
const mode = layoutSelectors.whatMode(MODE_KEY) const mode = layoutSelectors.whatMode(MODE_KEY)
const left = mode === MODE_RIGHT ? <noscript/> : children[0] const left = mode === MODE_RIGHT ? <noscript/> : children[0]
const right = mode === MODE_LEFT ? <noscript/> : children[1] const right = mode === MODE_LEFT ? <noscript/> : children[1]
const size = this.sizeFromMode(mode, '50%') const size = this.sizeFromMode(mode, "50%")
return ( return (
<SplitPane <SplitPane
disabledClass={''} disabledClass={""}
ref={'splitPane'} ref={"splitPane"}
split='vertical' split='vertical'
defaultSize={'50%'} defaultSize={"50%"}
primary="second" primary="second"
minSize={0} minSize={0}
size={size} size={size}

View File

@@ -539,7 +539,7 @@ export const getSampleSchema = (schema, contentType="", config={}) => {
let match = schema.$$ref.match(/\S*\/(\S+)$/) let match = schema.$$ref.match(/\S*\/(\S+)$/)
schema.xml.name = match[1] schema.xml.name = match[1]
} else if (schema.type || schema.items || schema.properties || schema.additionalProperties) { } else if (schema.type || schema.items || schema.properties || schema.additionalProperties) {
return '<?xml version="1.0" encoding="UTF-8"?>\n<!-- XML example cannot be generated -->' return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!-- XML example cannot be generated -->"
} else { } else {
return null return null
} }
@@ -555,13 +555,13 @@ export const parseSeach = () => {
let search = window.location.search let search = window.location.search
if ( search != "" ) { if ( search != "" ) {
let params = search.substr(1).split("&"); let params = search.substr(1).split("&")
for (let i in params) { for (let i in params) {
i = params[i].split("="); i = params[i].split("=")
map[decodeURIComponent(i[0])] = decodeURIComponent(i[1]); map[decodeURIComponent(i[0])] = decodeURIComponent(i[1])
} }
} }
return map; return map
} }

View File

@@ -1,4 +1,4 @@
import Topbar from './topbar.jsx' import Topbar from "./topbar.jsx"
export default function () { export default function () {
return { return {

View File

@@ -1,5 +1,5 @@
import StandaloneLayout from './layout' import StandaloneLayout from "./layout"
import '../style/main.scss' import "../style/main.scss"
import TopbarPlugin from "plugins/topbar" import TopbarPlugin from "plugins/topbar"

View File

@@ -1,4 +1,4 @@
import React, { PropTypes } from 'react' import React, { PropTypes } from "react"
export default class StandaloneLayout extends React.Component { export default class StandaloneLayout extends React.Component {

View File

@@ -21,7 +21,7 @@ describe("curlify", function() {
let curlified = curl(Im.fromJS(req)) let curlified = curl(Im.fromJS(req))
expect(curlified).toEqual('curl -X POST http://example.com -H "Accept: application/json" -H "content-type: application/json" -d {"id":0,"name":"doggie","status":"available"}') expect(curlified).toEqual("curl -X POST http://example.com -H \"Accept: application/json\" -H \"content-type: application/json\" -d {\"id\":0,\"name\":\"doggie\",\"status\":\"available\"}")
}) })
it("does not change the case of header in curl", function() { it("does not change the case of header in curl", function() {
@@ -35,7 +35,7 @@ describe("curlify", function() {
let curlified = curl(Im.fromJS(req)) let curlified = curl(Im.fromJS(req))
expect(curlified).toEqual('curl -X POST http://example.com -H "conTenT Type: application/Moar"') expect(curlified).toEqual("curl -X POST http://example.com -H \"conTenT Type: application/Moar\"")
}) })
it("prints a curl statement with an array of query params", function() { it("prints a curl statement with an array of query params", function() {
@@ -46,7 +46,7 @@ describe("curlify", function() {
let curlified = curl(Im.fromJS(req)) let curlified = curl(Im.fromJS(req))
expect(curlified).toEqual('curl -X GET http://swaggerhub.com/v1/one?name=john|smith') expect(curlified).toEqual("curl -X GET http://swaggerhub.com/v1/one?name=john|smith")
}) })
it("prints a curl statement with an array of query params and auth", function() { it("prints a curl statement with an array of query params and auth", function() {
@@ -60,7 +60,7 @@ describe("curlify", function() {
let curlified = curl(Im.fromJS(req)) let curlified = curl(Im.fromJS(req))
expect(curlified).toEqual('curl -X GET http://swaggerhub.com/v1/one?name=john|smith -H "authorization: Basic Zm9vOmJhcg=="') expect(curlified).toEqual("curl -X GET http://swaggerhub.com/v1/one?name=john|smith -H \"authorization: Basic Zm9vOmJhcg==\"")
}) })
it("prints a curl statement with html", function() { it("prints a curl statement with html", function() {
@@ -71,13 +71,13 @@ describe("curlify", function() {
accept: "application/json" accept: "application/json"
}, },
body: { body: {
description: '<b>Test</b>' description: "<b>Test</b>"
} }
} }
let curlified = curl(Im.fromJS(req)) let curlified = curl(Im.fromJS(req))
expect(curlified).toEqual('curl -X GET http://swaggerhub.com/v1/one?name=john|smith -H "accept: application/json" -d {"description":"<b>Test</b>"}') expect(curlified).toEqual("curl -X GET http://swaggerhub.com/v1/one?name=john|smith -H \"accept: application/json\" -d {\"description\":\"<b>Test</b>\"}")
}) })
it("handles post body with html", function() { it("handles post body with html", function() {
@@ -88,13 +88,13 @@ describe("curlify", function() {
accept: "application/json" accept: "application/json"
}, },
body: { body: {
description: '<b>Test</b>' description: "<b>Test</b>"
} }
} }
let curlified = curl(Im.fromJS(req)) let curlified = curl(Im.fromJS(req))
expect(curlified).toEqual('curl -X POST http://swaggerhub.com/v1/one?name=john|smith -H "accept: application/json" -d {"description":"<b>Test</b>"}') expect(curlified).toEqual("curl -X POST http://swaggerhub.com/v1/one?name=john|smith -H \"accept: application/json\" -d {\"description\":\"<b>Test</b>\"}")
}) })
it("handles post body with special chars", function() { it("handles post body with special chars", function() {
@@ -102,14 +102,14 @@ describe("curlify", function() {
url: "http://swaggerhub.com/v1/one?name=john|smith", url: "http://swaggerhub.com/v1/one?name=john|smith",
method: "POST", method: "POST",
body: { body: {
description: '@prefix nif:<http://persistence.uni-leipzig.org/nlp2rdf/ontologies/nif-core#> .\n' + description: "@prefix nif:<http://persistence.uni-leipzig.org/nlp2rdf/ontologies/nif-core#> .\n" +
'@prefix itsrdf: <http://www.w3.org/2005/11/its/rdf#> .' "@prefix itsrdf: <http://www.w3.org/2005/11/its/rdf#> ."
} }
} }
let curlified = curl(Im.fromJS(req)) let curlified = curl(Im.fromJS(req))
expect(curlified).toEqual('curl -X POST http://swaggerhub.com/v1/one?name=john|smith -d {"description":"@prefix nif:<http://persistence.uni-leipzig.org/nlp2rdf/ontologies/nif-core#> .@prefix itsrdf: <http://www.w3.org/2005/11/its/rdf#> ."}') expect(curlified).toEqual("curl -X POST http://swaggerhub.com/v1/one?name=john|smith -d {\"description\":\"@prefix nif:<http://persistence.uni-leipzig.org/nlp2rdf/ontologies/nif-core#> .@prefix itsrdf: <http://www.w3.org/2005/11/its/rdf#> .\"}")
}) })
it("handles delete form with parameters", function() { it("handles delete form with parameters", function() {
@@ -123,7 +123,7 @@ describe("curlify", function() {
let curlified = curl(Im.fromJS(req)) let curlified = curl(Im.fromJS(req))
expect(curlified).toEqual('curl -X DELETE http://example.com -H "accept: application/x-www-form-urlencoded"') expect(curlified).toEqual("curl -X DELETE http://example.com -H \"accept: application/x-www-form-urlencoded\"")
}) })
it("should print a curl with formData", function() { it("should print a curl with formData", function() {
@@ -136,7 +136,7 @@ describe("curlify", function() {
let curlified = curl(Im.fromJS(req)) let curlified = curl(Im.fromJS(req))
expect(curlified).toEqual('curl -X POST http://example.com -H "content-type: multipart/form-data" -F id=123 -F name=Sahar') expect(curlified).toEqual("curl -X POST http://example.com -H \"content-type: multipart/form-data\" -F id=123 -F name=Sahar")
}) })
it("prints a curl post statement from an object", function() { it("prints a curl post statement from an object", function() {
@@ -153,7 +153,7 @@ describe("curlify", function() {
let curlified = curl(Im.fromJS(req)) let curlified = curl(Im.fromJS(req))
expect(curlified).toEqual('curl -X POST http://example.com -H "accept: application/json" -d {"id":10101}') expect(curlified).toEqual("curl -X POST http://example.com -H \"accept: application/json\" -d {\"id\":10101}")
}) })
it("prints a curl post statement from a string containing a single quote", function() { it("prints a curl post statement from a string containing a single quote", function() {
@@ -163,12 +163,12 @@ describe("curlify", function() {
headers: { headers: {
accept: "application/json" accept: "application/json"
}, },
body: '{"id":"foo\'bar"}' body: "{\"id\":\"foo'bar\"}"
} }
let curlified = curl(Im.fromJS(req)) let curlified = curl(Im.fromJS(req))
expect(curlified).toEqual('curl -X POST http://example.com -H "accept: application/json" -d "{\\"id\\":\\"foo\'bar\\"}"') expect(curlified).toEqual("curl -X POST http://example.com -H \"accept: application/json\" -d \"{\\\"id\\\":\\\"foo'bar\\\"}\"")
}) })
}) })