Skip to content
This repository has been archived by the owner on Dec 30, 2018. It is now read-only.

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
vesparny committed May 11, 2017
1 parent d1b7c53 commit 6748a57
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 54 deletions.
15 changes: 6 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
"gh-pages": "gh-pages --dist build",
"release": "npm run test && npm run lint && npm run bump && npm run build && git push --follow-tags origin master && npm run gh-pages",
"precommit": "lint-staged",
"lint": "standard",
"format": "prettier --write --single-quote 'src/**/*.js'"
"lint": "standard"
},
"standard": {
"parser": "babel-eslint",
Expand All @@ -39,13 +38,11 @@
]
},
"lint-staged": {
"linters": {
"src/*/**/*.js": [
"npm run format",
"npm run lint -- --fix",
"git add ."
]
}
"*.js": [
"prettier --write --semi false --single-quote",
"standard --fix",
"git add"
]
},
"jest": {
"testEnvironment": "jsdom",
Expand Down
6 changes: 3 additions & 3 deletions src/components/Button.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import glamorous from 'glamorous';
import glamorous from 'glamorous'

const Button = glamorous.button(
{
Expand All @@ -9,6 +9,6 @@ const Button = glamorous.button(
cursor: 'pointer'
},
(p, t) => ({ backgroundColor: t.colors.blue })
);
)

export default Button;
export default Button
20 changes: 10 additions & 10 deletions src/components/Button.spec.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import React from 'react';
import { shallow } from 'enzyme';
import { matcher, serializer } from 'jest-glamor-react';
import Button from './Button';
import React from 'react'
import { shallow } from 'enzyme'
import { matcher, serializer } from 'jest-glamor-react'
import Button from './Button'

expect.addSnapshotSerializer(serializer);
expect.extend(matcher);
expect.addSnapshotSerializer(serializer)
expect.extend(matcher)

describe('<Button />', () => {
it('renders correctly', () => {
const wrapper = shallow(
<Button theme={{ colors: { blue: 'blue' } }}>hello</Button>
);
expect(wrapper).toMatchSnapshotWithGlamor();
});
});
)
expect(wrapper).toMatchSnapshotWithGlamor()
})
})
28 changes: 14 additions & 14 deletions src/components/Counter.spec.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import React from 'react';
import { mount } from 'enzyme';
import { matcher, serializer } from 'jest-glamor-react';
import { ThemeProvider } from 'glamorous';
import Counter from './Counter';
import React from 'react'
import { mount } from 'enzyme'
import { matcher, serializer } from 'jest-glamor-react'
import { ThemeProvider } from 'glamorous'
import Counter from './Counter'

expect.addSnapshotSerializer(serializer);
expect.extend(matcher);
expect.addSnapshotSerializer(serializer)
expect.extend(matcher)

describe('<Counter />', () => {
const onIncrement = jest.fn();
const onIncrement = jest.fn()
it('renders correctly', () => {
const wrapper = mount(
<ThemeProvider theme={{ colors: { green: '' } }}>
<Counter onIncrement={onIncrement} />
</ThemeProvider>
);
expect(wrapper).toMatchSnapshotWithGlamor();
wrapper.find('button').simulate('click');
expect(onIncrement).toHaveBeenCalled();
});
});
)
expect(wrapper).toMatchSnapshotWithGlamor()
wrapper.find('button').simulate('click')
expect(onIncrement).toHaveBeenCalled()
})
})
2 changes: 1 addition & 1 deletion src/components/Home.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const Ul = glamorous(Box)({
class Home extends Component {
state = {
counter: 0
};
}
increment () {
this.setState((prevState, props) => {
const count = (prevState.counter += 1)
Expand Down
32 changes: 16 additions & 16 deletions src/main.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
import 'sanitize.css/sanitize.css';
import React from 'react';
import ReactDOM from 'react-dom';
import 'sanitize.css/sanitize.css'
import React from 'react'
import ReactDOM from 'react-dom'

const rootEl = document.getElementById('root');
const rootEl = document.getElementById('root')

let render = () => {
const Root = require('./components/Root').default;
ReactDOM.render(<Root />, rootEl);
};
const Root = require('./components/Root').default
ReactDOM.render(<Root />, rootEl)
}

if (module.hot) {
const renderApp = render;
const renderApp = render
const renderError = err => {
const RedBox = require('redbox-react');
ReactDOM.render(<RedBox error={err} />, rootEl);
};
const RedBox = require('redbox-react')
ReactDOM.render(<RedBox error={err} />, rootEl)
}
render = () => {
try {
renderApp();
renderApp()
} catch (err) {
renderError(err);
renderError(err)
}
};
module.hot.accept('./components/Root', render);
}
module.hot.accept('./components/Root', render)
}

render();
render()
2 changes: 1 addition & 1 deletion src/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ export default {
blue: '#0074D9',
grey: 'rgba(0,0,0,.4)'
}
};
}

0 comments on commit 6748a57

Please sign in to comment.