Skip to content

Latest commit

 

History

History
92 lines (79 loc) · 1.38 KB

help.md

File metadata and controls

92 lines (79 loc) · 1.38 KB
layout title
default
Help

Table of Contents

How to write inputs / outputs

  • Write only one statement
// bad
const inputs = [
  `
    $.isArray(foobar)
    throw Error()
  `
]
const outputs = [
  `
    Array.isArray(foobar)
    throw new Error()
  `
]

// good
const inputs = [
  "$.isArray(foobar);"
]
const outputs = [
  "Array.isArray(foobar);"
]
  • Write same node type
// bad
const inputs = [
  "$.isArray(foobar)",
  "throw Error()",
]
const outputs = [
  "Array.isArray(foobar)",
  "throw new Error()",
]

// good
const inputs = [
  "$.isArray(foobar)",
  "$.isArray(array)",
]
const outputs = [
  "Array.isArray(foobar)",
  "Array.isArray(array)",
]
  • Write as small as possible
// bad
const inputs = [
  `
    class PasswordField extends React.Component {
      render() {
        return <Field name="password" type="password" />
      }
    }
  `
]
const outputs = [
  `
    class PasswordField extends React.Component {
      render() {
        return <Field name="password" type="password" autoComplete="current-password" />
      }
    }
  `
]

// good
const inputs = ['<Field name="password" type="password" />']
const outputs = ['<Field name="password" type="password" autoComplete="current-password" />']