Merge pull request #76 from netlify/lint-staged

Updated ESLint + added lint-staged
This commit is contained in:
Andrey Okonetchnikov
2016-09-13 18:50:35 +02:00
committed by GitHub
18 changed files with 77 additions and 59 deletions

View File

@ -9,8 +9,18 @@
"test:watch": "npm test -- --watch", "test:watch": "npm test -- --watch",
"build": "webpack --config webpack.config.js", "build": "webpack --config webpack.config.js",
"storybook": "start-storybook -p 9001", "storybook": "start-storybook -p 9001",
"storybook-build": "build-storybook -o dist" "storybook-build": "build-storybook -o dist",
"lint": "eslint .",
"lint:fix": "npm run lint -- --fix",
"lint:staged": "lint-staged"
}, },
"lint-staged": {
"*.@(js|jsx)": [
"eslint --fix",
"git add"
]
},
"pre-commit": "lint:staged",
"keywords": [ "keywords": [
"netlify", "netlify",
"cms" "cms"
@ -21,7 +31,7 @@
"@kadira/storybook": "^1.36.0", "@kadira/storybook": "^1.36.0",
"autoprefixer": "^6.3.3", "autoprefixer": "^6.3.3",
"babel-core": "^6.5.1", "babel-core": "^6.5.1",
"babel-eslint": "^4.1.8", "babel-eslint": "^6.1.2",
"babel-loader": "^6.2.2", "babel-loader": "^6.2.2",
"babel-plugin-lodash": "^3.2.0", "babel-plugin-lodash": "^3.2.0",
"babel-plugin-transform-class-properties": "^6.5.2", "babel-plugin-transform-class-properties": "^6.5.2",
@ -32,20 +42,21 @@
"babel-register": "^6.5.2", "babel-register": "^6.5.2",
"babel-runtime": "^6.5.0", "babel-runtime": "^6.5.0",
"css-loader": "^0.23.1", "css-loader": "^0.23.1",
"eslint": "^1.10.3", "eslint": "^3.5.0",
"eslint-loader": "^1.2.1",
"eslint-plugin-react": "^5.1.1", "eslint-plugin-react": "^5.1.1",
"exports-loader": "^0.6.3", "exports-loader": "^0.6.3",
"file-loader": "^0.8.5", "file-loader": "^0.8.5",
"immutable": "^3.7.6", "immutable": "^3.7.6",
"imports-loader": "^0.6.5", "imports-loader": "^0.6.5",
"js-yaml": "^3.5.3", "js-yaml": "^3.5.3",
"lint-staged": "^3.0.2",
"mocha": "^2.4.5", "mocha": "^2.4.5",
"moment": "^2.11.2", "moment": "^2.11.2",
"normalizr": "^2.0.0", "normalizr": "^2.0.0",
"postcss-cssnext": "^2.7.0", "postcss-cssnext": "^2.7.0",
"postcss-import": "^8.1.2", "postcss-import": "^8.1.2",
"postcss-loader": "^0.9.1", "postcss-loader": "^0.9.1",
"pre-commit": "^1.1.3",
"react": "^15.1.0", "react": "^15.1.0",
"react-dom": "^15.1.0", "react-dom": "^15.1.0",
"react-hot-loader": "^3.0.0-beta.2", "react-hot-loader": "^3.0.0-beta.2",

View File

@ -1,5 +1,4 @@
import React from 'react'; import React from 'react';
import Authenticator from '../../lib/netlify-auth';
export default class AuthenticationPage extends React.Component { export default class AuthenticationPage extends React.Component {
static propTypes = { static propTypes = {
@ -32,8 +31,8 @@ export default class AuthenticationPage extends React.Component {
} }
response.json().then((data) => { response.json().then((data) => {
this.setState({ loginError: data.msg }); this.setState({ loginError: data.msg });
}) });
}) });
} }
handleChange(key) { handleChange(key) {

View File

@ -62,4 +62,4 @@ export const SCHEMA = {
borderRadius: '4px' borderRadius: '4px'
} }
} }
} };

View File

@ -39,4 +39,4 @@ storiesOf('Card', module)
<p>header and footer elements are also not subject to margin</p> <p>header and footer elements are also not subject to margin</p>
<footer style={styles.footer}>&copy; Thousand Cats Corp</footer> <footer style={styles.footer}>&copy; Thousand Cats Corp</footer>
</Card> </Card>
)) ));

View File

@ -13,7 +13,12 @@ class FindBar extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
this._compiledCommands = []; this._compiledCommands = [];
this._searchCommand = { search: true, regexp:`(?:${SEARCH})?(.*)`, param:{ name:'searchTerm', display:'' }, token: SEARCH }; this._searchCommand = {
search: true,
regexp: `(?:${SEARCH})?(.*)`,
param: { name: 'searchTerm', display: '' },
token: SEARCH
};
this.state = { this.state = {
value: '', value: '',
placeholder: PLACEHOLDER, placeholder: PLACEHOLDER,
@ -144,6 +149,7 @@ class FindBar extends Component {
getSuggestions() { getSuggestions() {
return this._getSuggestions(this.state.value, this.state.activeScope, this._compiledCommands, this.props.defaultCommands); return this._getSuggestions(this.state.value, this.state.activeScope, this._compiledCommands, this.props.defaultCommands);
} }
// Memoized version // Memoized version
_getSuggestions(value, scope, commands, defaultCommands) { _getSuggestions(value, scope, commands, defaultCommands) {
if (scope) return []; // No autocomplete for scoped input if (scope) return []; // No autocomplete for scoped input
@ -299,7 +305,8 @@ class FindBar extends Component {
<span><Icon type="search"/>Search... </span> : <span><Icon type="search"/>Search... </span> :
<span className={styles.faded}><Icon type="search"/>Search for: </span> <span className={styles.faded}><Icon type="search"/>Search for: </span>
} }
<strong>{this.state.value}</strong></span> <strong>{this.state.value}</strong>
</span>
); );
} }
return ( return (
@ -358,6 +365,7 @@ class FindBar extends Component {
); );
} }
} }
FindBar.propTypes = { FindBar.propTypes = {
commands: PropTypes.arrayOf(PropTypes.shape({ commands: PropTypes.arrayOf(PropTypes.shape({
id: PropTypes.string.isRequired, id: PropTypes.string.isRequired,