Skip to content
This repository has been archived by the owner on Sep 7, 2020. It is now read-only.

Commit

Permalink
Updated: eslint config
Browse files Browse the repository at this point in the history
Close #26
Ref #21
  • Loading branch information
MoOx committed Oct 20, 2015
1 parent d9b61e0 commit 35df492
Show file tree
Hide file tree
Showing 18 changed files with 134 additions and 138 deletions.
1 change: 1 addition & 0 deletions .eslintignore
78 changes: 0 additions & 78 deletions .eslintrc

This file was deleted.

6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
node_modules

# build
lib

# demo build
dist
demo/node_modules
demo/dist
demo/statinamic-static.js
1 change: 1 addition & 0 deletions demo/.eslintignore
1 change: 1 addition & 0 deletions demo/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
dist
statinamic-static*
2 changes: 1 addition & 1 deletion demo/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const webpackConfig = {
})
)
),
...config.dev && [ "eslint-loader" ],
...config.dev && [ "eslint-loader?fix" ],
],
exclude: /node_modules/,
},
Expand Down
8 changes: 5 additions & 3 deletions demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
"babel-loader": "^5.3.2",
"babel-plugin-react-transform": "^1.0.1",
"css-loader": "^0.17.0",
"eslint": "^1.1.0",
"eslint-loader": "^1.0.0",
"eslint-plugin-react": "^3.2.2",
"eslint": "^1.7.2",
"eslint-loader": "^1.1.0",
"eslint-plugin-react": "^3.6.2",
"extract-text-webpack-plugin": "^0.8.2",
"file-loader": "^0.8.1",
"gh-pages": "^0.4.0",
Expand All @@ -53,6 +53,8 @@
"start": "babel-node build --server --open --dev",
"static+start": "babel-node build --static --server --open --dev",
"ci-deploy": "if [ \"$TRAVIS_PULL_REQUEST\" = \"false\" ] && [ \"$TRAVIS_BRANCH\" = \"master\" ]; then gh-pages -d dist; fi;",
"lint": "eslint --fix .",
"pretest": "npm run lint",
"test": "npm run static && npm run ci-deploy"
},
"babel": {
Expand Down
2 changes: 1 addition & 1 deletion demo/web_modules/Collection/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Collection extends Component {
{
Boolean(!collection || !collection.length) &&
<div>
No entry
{ "No entry" }
</div>
}
{
Expand Down
17 changes: 0 additions & 17 deletions demo/web_modules/Home/index.js

This file was deleted.

40 changes: 21 additions & 19 deletions demo/web_modules/Layout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,26 +43,28 @@ export default class Layout extends Component {

render() {
return (
<div className={styles.wrapper}>
<nav className={styles.nav}>
<Link to="/statinamic/">Home</Link>
{" | "}
<Link to="/statinamic/docs/setup/">Setup</Link>
{" | "}
<Link to="/statinamic/docs/usage/">Usage</Link>
{" | "}
<Link to="/statinamic/docs/faq/">FAQ</Link>
{" | "}
<a href="https://github.com/MoOx/statinamic">GitHub</a>
{" | "}
<a href="https://twitter.com/MoOx">Twitter</a>
<div className={ styles.wrapper }>
<nav className={ styles.nav }>
<Link to="/statinamic/">{ "Home" }</Link>
{ " | " }
<Link to="/statinamic/docs/setup/">{ "Setup" }</Link>
{ " | " }
<Link to="/statinamic/docs/usage/">{ "Usage" }</Link>
{ " | " }
<Link to="/statinamic/docs/faq/">{ "FAQ" }</Link>
{ " | " }
<a href="https://github.com/MoOx/statinamic">{ "GitHub" }</a>
{ " | " }
<a href="https://twitter.com/MoOx">{ "Twitter" }</a>
</nav>
{this.props.children}
<footer className={styles.footer}>
{"© 2015 - "}
<a href="http://moox.io/">@MoOx</a>
{" | "}
<a href="https://github.com/MoOx/statinamic">Check out on GitHub</a>
{ this.props.children }
<footer className={ styles.footer }>
{ "© 2015 - " }
<a href="http://moox.io/">{ "@MoOx" }</a>
{ " |  " }
<a href="https://github.com/MoOx/statinamic">
{ "Check out on GitHub" }
</a>
</footer>
<GoogleAnalyticsInitiailizer />
</div>
Expand Down
2 changes: 1 addition & 1 deletion demo/web_modules/NotFound/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default class NotFound extends Component {
render() {
return (
<div>
404 Not Found
{ "404 Not Found" }
</div>
)
}
Expand Down
2 changes: 1 addition & 1 deletion demo/web_modules/Page/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default class Page extends Component {
{
body &&
<div
dangerouslySetInnerHTML={{ __html: body }}
dangerouslySetInnerHTML={ { __html: body } }
/>
}
{ this.props.children }
Expand Down
2 changes: 1 addition & 1 deletion demo/web_modules/Post/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default class Post extends Component {
render() {
return (
<div>
{ "Post !"}
{ "Post ! " }
<Page { ...this.props } />
</div>
)
Expand Down
1 change: 0 additions & 1 deletion demo/web_modules/app/pageComponents.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@

export Page from "Page" // default layout

export Home from "Home"
export Post from "Post"
export Collection from "Collection"
4 changes: 2 additions & 2 deletions demo/web_modules/app/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Layout from "Layout"

// routes
export default (
<Route component={Layout}>
<Route path="*" component={PageContainer} />
<Route component={ Layout }>
<Route path="*" component={ PageContainer } />
</Route>
)
87 changes: 84 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
"dependencies": {
"chalk": "^1.1.0",
"connect-history-api-fallback": "^1.1.0",
"eslint": "^1.1.0",
"eslint-plugin-react": "^3.2.2",
"express": "^4.13.3",
"gray-matter": "^2.0.0",
"loader-utils": "^0.2.11",
Expand All @@ -28,7 +26,9 @@
"devDependencies": {
"babel": "^5.8.23",
"babel-core": "^5.8.22",
"babel-eslint": "^4.0.6"
"babel-eslint": "^4.0.6",
"eslint": "^1.7.2",
"eslint-plugin-react": "^3.6.2"
},
"peerDependencies": {
"react": "^0.13.3",
Expand All @@ -45,9 +45,90 @@
"prebabelify": "rimraf lib",
"babelify": "babel --copy-files src --out-dir lib",
"prepublish": "npm run babelify",
"lint": "eslint --fix src",
"pretest": "npm run lint",
"test": "cd demo && npm install && npm test"
},

"babel": {
"stage": 0
},

"eslintConfig": {
"root": true,
"extends": "eslint:recommended",
"#parser": "babel-eslint support more syntax stuff than eslint for now",
"parser": "babel-eslint",
"ecmaFeatures": {
"jsx": true,
"modules": true,
"experimentalObjectRestSpread": true
},

"env": {
"es6": true,
"browser": true,
"node": true
},
"rules": {
"no-console": 0,
"indent": [ 2, 2 ],
"max-len": [ 2, 80, 4 ],
"no-multiple-empty-lines": [ 2, { "max": 1 } ],
"quotes": [ 2, "double" ],
"jsx-quotes": [ 2, "prefer-double" ],
"semi": [ 2, "never" ],
"comma-dangle": [ 2, "always-multiline" ],
"comma-style": [ 2, "last" ],
"brace-style": [ 2, "stroustrup" ],
"dot-location": [ 2, "property" ],
"computed-property-spacing": [ 2, "never" ],
"object-curly-spacing": [ 2, "always" ],
"array-bracket-spacing": [ 2, "always" ],
"space-after-keywords": [ 2, "always" ],
"space-before-blocks": [ 2, "always" ],
"space-before-function-paren": [ 2, "never" ],
"space-in-parens": [ 2, "never" ],
"space-unary-ops": [ 2, { "words": true, "nonwords": false } ],
"spaced-comment": [ 2, "always" ],

"one-var": [ 2, "never" ],
"no-var": [ 2 ],
"no-bitwise": [ 2 ],
"prefer-const": [ 2 ],

"react/jsx-closing-bracket-location": [ 2, "tag-aligned" ],
"react/jsx-curly-spacing": [ 2, "always" ],
"react/jsx-indent-props": [ 2, 2 ],
"react/jsx-no-duplicate-props": 2,
"react/jsx-no-literals": 2,
"react/jsx-no-undef": 2,
"react/jsx-uses-react": 2,
"react/jsx-uses-vars": 2,
"react/no-did-mount-set-state": 2,
"react/no-did-update-set-state": 2,
"react/no-multi-comp": 2,
"react/no-unknown-property": 2,
"react/prop-types": 2,
"react/react-in-jsx-scope": 2,
"react/require-extension": 2,
"react/self-closing-comp": 2,
"react/sort-comp": 2,
"react/wrap-multilines": 2
},
"globals": {
"__DEV__": true,
"__DEVTOOLS__": true,
"__SERVER__": true,
"__PROD__": true,
"__SERVER_PROTOCOL__": true,
"__SERVER_HOSTNAME__": true,
"__SERVER_PORT__": true,
"__SERVER_HOST__": true,
"__SERVER_URL__": true
},
"plugins": [
"react"
]
}
}
6 changes: 3 additions & 3 deletions src/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default function statinamic({
} = require("redux-devtools/lib/react")
devtools = (
<DebugPanel top right bottom>
<DevTools store={store} monitor={LogMonitor} />
<DevTools store={ store } monitor={ LogMonitor } />
</DebugPanel>
)
}
Expand All @@ -43,8 +43,8 @@ export default function statinamic({

React.render(
<div id="statinamic-container">
<Provider store={store}>
{() => <Router history={history} children={routes} />}
<Provider store={ store }>
{ () => <Router history={ history } children={ routes } /> }
</Provider>
{ __DEVTOOLS__ && devtools }
</div>,
Expand Down
Loading

0 comments on commit 35df492

Please sign in to comment.