Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: format code with PHP CS Fixer, Prettier and Yapf #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 42 additions & 38 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,45 @@
module.exports = {
env: {
browser: true,
es6: true,
node: true,
jest: true,
},
extends: 'airbnb',
globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly',
},
parserOptions: {
ecmaFeatures: {
jsx: true,
env: {
browser: true,
es6: true,
node: true,
jest: true,
},
ecmaVersion: 2018,
sourceType: 'module',
},
plugins: [
'react',
],
rules: {
"semi":[2, "never"],
"implicit-arrow-linebreak": 0,
"eol-last": 0,
"no-multiple-empty-lines": ["error", { "max": 2, "maxEOF": 1 }],
"jsx-a11y/label-has-for": [ 2, {
"components": [ "Label" ],
"required": {
"every": [ "id" ]
extends: 'airbnb',
globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly',
},
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 2018,
sourceType: 'module',
},
plugins: ['react'],
rules: {
semi: [2, 'never'],
'implicit-arrow-linebreak': 0,
'eol-last': 0,
'no-multiple-empty-lines': ['error', { max: 2, maxEOF: 1 }],
'jsx-a11y/label-has-for': [
2,
{
components: ['Label'],
required: {
every: ['id'],
},
allowChildren: false,
},
"allowChildren": false
}],
"jsx-a11y/label-has-associated-control": [ 2, {
"labelComponents": ["label"],
"labelAttributes": ["htmlFor"],
"controlComponents": ["input"]
}]
},
};
],
'jsx-a11y/label-has-associated-control': [
2,
{
labelComponents: ['label'],
labelAttributes: ['htmlFor'],
controlComponents: ['input'],
},
],
},
}
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ A collection of components for building the http://ninjawars.net webgame.

## Deploy

yarn deploy
yarn deploy

Deploys to http://nw-shuriken.surge.sh

Expand All @@ -33,4 +33,3 @@ No production deployment yet.
yarn publish

view at: https://www.npmjs.com/package/nw-shuriken

48 changes: 27 additions & 21 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<!--
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<meta name="theme-color" content="#000000" />
<!--
manifest.json provides metadata used when your web app is added to the
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500"
/>
<link
rel="stylesheet"
href="https://fonts.googleapis.com/icon?family=Material+Icons"
/>

<!--
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Expand All @@ -22,14 +31,12 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
</head>
<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<div id="root"></div>
<!--
<title>React App</title>
</head>
<body>
<noscript> You need to enable JavaScript to run this app. </noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.

Expand All @@ -38,6 +45,5 @@

To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
--></body>
</html>
26 changes: 15 additions & 11 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
.App {
text-align: center;
text-align: center;
}

.App-logo {
animation: App-logo-spin infinite 20s linear;
height: 80px;
animation: App-logo-spin infinite 20s linear;
height: 80px;
}

.App-header {
background-color: #222;
height: 150px;
padding: 20px;
color: white;
background-color: #222;
height: 150px;
padding: 20px;
color: white;
}

.App-title {
font-size: 1.5em;
font-size: 1.5em;
}

.App-intro {
font-size: large;
font-size: large;
}

@keyframes App-logo-spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
76 changes: 38 additions & 38 deletions src/components/Shuriken/Shuriken.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,54 +3,54 @@ import PropTypes from 'prop-types'
import { withStyles } from '@material-ui/core/styles'
import Button from '@material-ui/core/Button'

const styles = theme => ({
button: {
margin: theme.spacing.unit,
},
input: {
display: 'none',
},
const styles = (theme) => ({
button: {
margin: theme.spacing.unit,
},
input: {
display: 'none',
},
})

/**
* Just a simple buttons container for now
*
*/
function Shuriken(props) {
const { classes } = props
return (
<form>
<Button className={classes.button}>Default</Button>
<Button color="primary" className={classes.button}>
Primary
</Button>
<Button color="secondary" className={classes.button}>
Secondary
</Button>
<Button disabled className={classes.button}>
Disabled
</Button>
<Button href="#flat-buttons" className={classes.button}>
Link
</Button>
<input
accept="image/*"
className={classes.input}
id="flat-button-file"
multiple
type="file"
/>
<label htmlFor="flat-button-file">
<Button component="span" className={classes.button}>
Upload
</Button>
</label>
</form>
)
const { classes } = props
return (
<form>
<Button className={classes.button}>Default</Button>
<Button color="primary" className={classes.button}>
Primary
</Button>
<Button color="secondary" className={classes.button}>
Secondary
</Button>
<Button disabled className={classes.button}>
Disabled
</Button>
<Button href="#flat-buttons" className={classes.button}>
Link
</Button>
<input
accept="image/*"
className={classes.input}
id="flat-button-file"
multiple
type="file"
/>
<label htmlFor="flat-button-file">
<Button component="span" className={classes.button}>
Upload
</Button>
</label>
</form>
)
}

Shuriken.propTypes = {
classes: PropTypes.shape({}).isRequired,
classes: PropTypes.shape({}).isRequired,
}

export default withStyles(styles)(Shuriken)
6 changes: 3 additions & 3 deletions src/index.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
body {
margin: 0;
padding: 0;
font-family: sans-serif;
margin: 0;
padding: 0;
font-family: sans-serif;
}
16 changes: 8 additions & 8 deletions tests/NWSets.test.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from 'react';
import ReactDOM from 'react-dom';
import React from 'react'
import ReactDOM from 'react-dom'
import Shuriken from '../components'

describe('Overall Acceptance Testing', () => {
it('renders a shuriken component without crashing', () => {
const div = document.createElement('div');
ReactDOM.render(<Shuriken />, div);
ReactDOM.unmountComponentAtNode(div);
});
});
it('renders a shuriken component without crashing', () => {
const div = document.createElement('div')
ReactDOM.render(<Shuriken />, div)
ReactDOM.unmountComponentAtNode(div)
})
})