Skip to content

Commit

Permalink
style: Switch to airbnb linting + prettier formatting 🎨 (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrchief authored Apr 6, 2018
1 parent 3b0753a commit de8e7c3
Show file tree
Hide file tree
Showing 36 changed files with 760 additions and 330 deletions.
63 changes: 47 additions & 16 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,37 +1,68 @@
{
"parser": "babel-eslint",
"extends": ["standard", "react-app", "eslint:recommended"],
"extends": "airbnb",
"plugins": ["react", "jsx-a11y", "import"],
"env": {
"browser": true,
"node": true,
"jest": true,
"es6": true
},
"rules": {
"react/jsx-filename-extension": [
1,
{
"extensions": [".js", ".jsx"]
}
],
"arrow-parens": [2, "as-needed"],
"comma-dangle": ["warn", "never"],
"global-require": 0,
"import/no-extraneous-dependencies": [
2,
{
"devDependencies": true
}
],
"import/no-named-as-default": 0,
"import/prefer-default-export": 0,
"object-curly-newline": [
"error",
"linebreak-style": 0,
"max-len": [
1,
150,
2,
{
"ObjectExpression": { "multiline": true, "minProperties": 3 },
"ObjectPattern": { "multiline": true, "minProperties": 3 },
"ImportDeclaration": { "multiline": true, "minProperties": 3 },
"ExportDeclaration": { "multiline": true, "minProperties": 3 }
"ignoreComments": true,
"ignoreTrailingComments": true,
"ignoreTemplateLiterals": true,
"ignoreStrings": true
}
],
"no-nested-ternary": 0,
"no-underscore-dangle": 0,
"no-console": 0,
"no-bitwise": [
2,
{
"allow": ["~"]
}
],
"no-param-reassign": 0,
"no-plusplus": 0,
"no-shadow": 0,
"no-param-reassign": 0,
"no-unused-expressions": [2, { "allowShortCircuit": true }],
"object-curly-newline": 0,
"react/forbid-prop-types": 0,
"react/require-default-props": 0,
"react/jsx-filename-extension": [
1,
{
"extensions": [".js", ".jsx"]
}
],
"react/jsx-wrap-multilines": 0,
"react/jsx-closing-tag-location": 0,
"react/sort-comp": 0,
"semi": [2, "never"],
"quotes": ["error", "single", { "avoidEscape": true }],
"jsx-a11y/href-no-hash": 0
"space-infix-ops": 0,
"jsx-a11y/anchor-is-valid": 0,
"jsx-a11y/label-has-for": 0,
"jsx-a11y/no-static-element-interactions": 0,
"jsx-a11y/click-events-have-key-events": 0
},
"globals": {
"document": true
Expand Down
15 changes: 15 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "webpack-dev-server",
"program": "${workspaceRoot}/node_modules/webpack-dev-server/bin/webpack-dev-server.js",
"cwd": "${workspaceFolder}/docs"
}
]
}
3 changes: 1 addition & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"spellright.documentTypes": [
"markdown",
"latex",
"plaintext",
"javascript"
"plaintext"
]
}
22 changes: 13 additions & 9 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<title>React Dropdown Tree Select Demo</title>
<link rel="stylesheet" href="./index.css" />
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
</head>
<body>
<div id="app"></div>
<script src="bundle.js"></script>
</body>

<head>
<title>React Dropdown Tree Select Demo</title>
<link rel="stylesheet" href="./index.css" />
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN"
crossorigin="anonymous">
</head>

<body>
<div id="app"></div>
<script src="bundle.js"></script>
</body>

</html>
5 changes: 5 additions & 0 deletions docs/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import React from 'react'
import ReactDOM from 'react-dom'
import Simple from './src/stories/Simple'

ReactDOM.render(<Simple />, document.getElementById('app'))
2 changes: 1 addition & 1 deletion docs/src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import ReactDOM from 'react-dom'

import App from './App.js'
import App from './App'

import './index.css'

Expand Down
16 changes: 10 additions & 6 deletions docs/src/stories/HOCReadme.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
import marked from 'marked'
import React from 'react'

import HOCReadme from '../../HOC.md'
import 'github-markdown-css/github-markdown.css'
import './utils/prism.js'

import './utils/prism'

import HOCReadme from '../../HOC.md'

export default class HOCStory extends React.Component {
render () {
componentDidMount() {
global.Prism && global.Prism.highlightAll()
}

render() {
return (
<div style={{ padding: '10px' }}>
<span
className="markdown-body"
// eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{ __html: marked(HOCReadme) }}
/>
</div>
)
}
componentDidMount () {
global.Prism && global.Prism.highlightAll()
}
}
4 changes: 2 additions & 2 deletions docs/src/stories/Options/Checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import React, { PureComponent } from 'react'
import PropTypes from 'prop-types'

class Checkbox extends PureComponent {
state = {isChecked: this.props.checked || false}
state = { isChecked: this.props.checked || false }

toggleCheckboxChange = () => {
const { onChange, value } = this.props

this.setState(({ isChecked }) => ({isChecked: !isChecked}))
this.setState(({ isChecked }) => ({ isChecked: !isChecked }))

onChange(value)
}
Expand Down
4 changes: 2 additions & 2 deletions docs/src/stories/Options/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ class WithOptions extends PureComponent {

render() {
const {
clearSearchOnChange, keepTreeOnSearch, simpleSelect, showPartiallySelected
} = this.state
clearSearchOnChange, keepTreeOnSearch, simpleSelect, showPartiallySelected
} = this.state

return (
<div>
Expand Down
16 changes: 10 additions & 6 deletions docs/src/stories/Readme.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
import marked from 'marked'
import React from 'react'

import Readme from '../../../README.md'
import 'github-markdown-css/github-markdown.css'
import './utils/prism.js'

import './utils/prism'

import Readme from '../../../README.md'

export default class Story extends React.Component {
render () {
componentDidMount() {
global.Prism && global.Prism.highlightAll()
}

render() {
return (
<div style={{ padding: '10px' }}>
<span
className="markdown-body"
// eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{ __html: marked(Readme) }}
/>
</div>
)
}
componentDidMount () {
global.Prism && global.Prism.highlightAll()
}
}
Loading

0 comments on commit de8e7c3

Please sign in to comment.