Skip to content

Commit

Permalink
yarn run fix
Browse files Browse the repository at this point in the history
  • Loading branch information
frenzzy authored and langpavel committed Jul 13, 2017
1 parent 12e25a1 commit a5e2f4d
Show file tree
Hide file tree
Showing 51 changed files with 807 additions and 503 deletions.
35 changes: 20 additions & 15 deletions .stylelintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
// stylelint configuration
// https://stylelint.io/user-guide/configuration/
module.exports = {

// The standard config based on a handful of CSS style guides
// https://github.com/stylelint/stylelint-config-standard
extends: 'stylelint-config-standard',
Expand All @@ -22,21 +21,27 @@ module.exports = {
],

rules: {
'property-no-unknown': [true, {
ignoreProperties: [
// CSS Modules composition
// https://github.com/css-modules/css-modules#composition
'composes',
],
}],
'property-no-unknown': [
true,
{
ignoreProperties: [
// CSS Modules composition
// https://github.com/css-modules/css-modules#composition
'composes',
],
},
],

'selector-pseudo-class-no-unknown': [true, {
ignorePseudoClasses: [
// CSS Modules :global scope
// https://github.com/css-modules/css-modules#exceptions
'global',
],
}],
'selector-pseudo-class-no-unknown': [
true,
{
ignorePseudoClasses: [
// CSS Modules :global scope
// https://github.com/css-modules/css-modules#exceptions
'global',
],
},
],

// Opinionated rule, you can disable it if you want
'string-quotes': 'single',
Expand Down
12 changes: 9 additions & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ module.exports = {
// collectCoverage: false, // [boolean]

// https://facebook.github.io/jest/docs/en/configuration.html#collectcoveragefrom-array
collectCoverageFrom: ['src/**/*.{js,jsx}', '!**/node_modules/**', '!**/vendor/**'],
collectCoverageFrom: [
'src/**/*.{js,jsx}',
'!**/node_modules/**',
'!**/vendor/**',
],

// https://facebook.github.io/jest/docs/en/configuration.html#coveragedirectory-string
coverageDirectory: '<rootDir>/coverage', // [string]
Expand All @@ -48,7 +52,8 @@ module.exports = {
// like images or styles with a single module.
moduleNameMapper: {
'\\.(css|less|scss|sss)$': 'identity-obj-proxy',
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': 'GlobalImageStub',
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'GlobalImageStub',
},

// modulePathIgnorePatterns: // [array<string>]
Expand Down Expand Up @@ -77,7 +82,8 @@ module.exports = {

transform: {
'\\.jsx?$': 'babel-jest',
'\\.(jpe?g|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '<rootDir>/jest/fileTransformer.js',
'\\.(jpe?g|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'<rootDir>/jest/fileTransformer.js',
},

// transformIgnorePatterns: // [array<string>]
Expand Down
4 changes: 3 additions & 1 deletion src/DOMUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
*/

export function updateTag(tagName, keyName, keyValue, attrName, attrValue) {
const node = document.head.querySelector(`${tagName}[${keyName}="${keyValue}"]`);
const node = document.head.querySelector(
`${tagName}[${keyName}="${keyValue}"]`,
);
if (node && node.getAttribute(attrName) === attrValue) return;

// Remove and create a new tag in order to make it work with bookmarks in Safari
Expand Down
8 changes: 6 additions & 2 deletions src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ const context = {
insertCss: (...styles) => {
// eslint-disable-next-line no-underscore-dangle
const removeCss = styles.map(x => x._insertCss());
return () => { removeCss.forEach(f => f()); };
return () => {
removeCss.forEach(f => f());
};
},
// Universal HTTP client
fetch: createFetch(self.fetch, {
Expand Down Expand Up @@ -125,7 +127,9 @@ async function onLocationChange(location, action) {
}

appInstance = ReactDOM.render(
<App context={context}>{route.component}</App>,
<App context={context}>
{route.component}
</App>,
container,
() => onRenderComplete(route, location),
);
Expand Down
2 changes: 0 additions & 2 deletions src/components/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ const ContextType = {
* );
*/
class App extends React.PureComponent {

static propTypes = {
context: PropTypes.shape(ContextType).isRequired,
children: PropTypes.element.isRequired,
Expand All @@ -58,7 +57,6 @@ class App extends React.PureComponent {
// please do that inside the Layout component.
return React.Children.only(this.props.children);
}

}

export default App;
8 changes: 6 additions & 2 deletions src/components/Feedback/Feedback.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,16 @@ class Feedback extends React.Component {
<a
className={s.link}
href="https://gitter.im/kriasoft/react-starter-kit"
>Ask a question</a>
>
Ask a question
</a>
<span className={s.spacer}>|</span>
<a
className={s.link}
href="https://github.com/kriasoft/react-starter-kit/issues/new"
>Report an issue</a>
>
Report an issue
</a>
</div>
</div>
);
Expand Down
16 changes: 12 additions & 4 deletions src/components/Footer/Footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,21 @@ class Footer extends React.Component {
<div className={s.container}>
<span className={s.text}>© Your Company</span>
<span className={s.spacer}>·</span>
<Link className={s.link} to="/">Home</Link>
<Link className={s.link} to="/">
Home
</Link>
<span className={s.spacer}>·</span>
<Link className={s.link} to="/admin">Admin</Link>
<Link className={s.link} to="/admin">
Admin
</Link>
<span className={s.spacer}>·</span>
<Link className={s.link} to="/privacy">Privacy</Link>
<Link className={s.link} to="/privacy">
Privacy
</Link>
<span className={s.spacer}>·</span>
<Link className={s.link} to="/not-found">Not Found</Link>
<Link className={s.link} to="/not-found">
Not Found
</Link>
</div>
</div>
);
Expand Down
8 changes: 7 additions & 1 deletion src/components/Header/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@ class Header extends React.Component {
<div className={s.container}>
<Navigation />
<Link className={s.brand} to="/">
<img src={logoUrl} srcSet={`${logoUrl2x} 2x`} width="38" height="38" alt="React" />
<img
src={logoUrl}
srcSet={`${logoUrl2x} 2x`}
width="38"
height="38"
alt="React"
/>
<span className={s.brandTxt}>Your Company</span>
</Link>
<div className={s.banner}>
Expand Down
47 changes: 30 additions & 17 deletions src/components/Html.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ class Html extends React.Component {
static propTypes = {
title: PropTypes.string.isRequired,
description: PropTypes.string.isRequired,
styles: PropTypes.arrayOf(PropTypes.shape({
id: PropTypes.string.isRequired,
cssText: PropTypes.string.isRequired,
}).isRequired),
styles: PropTypes.arrayOf(
PropTypes.shape({
id: PropTypes.string.isRequired,
cssText: PropTypes.string.isRequired,
}).isRequired,
),
scripts: PropTypes.arrayOf(PropTypes.string.isRequired),
app: PropTypes.object, // eslint-disable-line
children: PropTypes.string.isRequired,
Expand All @@ -39,33 +41,44 @@ class Html extends React.Component {
<head>
<meta charSet="utf-8" />
<meta httpEquiv="x-ua-compatible" content="ie=edge" />
<title>{title}</title>
<title>
{title}
</title>
<meta name="description" content={description} />
<meta name="viewport" content="width=device-width, initial-scale=1" />
{scripts.map(script => <link key={script} rel="preload" href={script} as="script" />)}
{scripts.map(script =>
<link key={script} rel="preload" href={script} as="script" />,
)}
<link rel="apple-touch-icon" href="apple-touch-icon.png" />
{styles.map(style => (
{styles.map(style =>
<style
key={style.id}
id={style.id}
dangerouslySetInnerHTML={{ __html: style.cssText }}
/>
))}
/>,
)}
</head>
<body>
<div id="app" dangerouslySetInnerHTML={{ __html: children }} />
<script dangerouslySetInnerHTML={{ __html: `window.App=${serialize(app)}` }} />
<script
dangerouslySetInnerHTML={{ __html: `window.App=${serialize(app)}` }}
/>
{scripts.map(script => <script key={script} src={script} />)}
{config.analytics.googleTrackingId &&
<script
dangerouslySetInnerHTML={{ __html:
'window.ga=function(){ga.q.push(arguments)};ga.q=[];ga.l=+new Date;' +
`ga('create','${config.analytics.googleTrackingId}','auto');ga('send','pageview')` }}
/>
}
dangerouslySetInnerHTML={{
__html:
'window.ga=function(){ga.q.push(arguments)};ga.q=[];ga.l=+new Date;' +
`ga('create','${config.analytics
.googleTrackingId}','auto');ga('send','pageview')`,
}}
/>}
{config.analytics.googleTrackingId &&
<script src="https://www.google-analytics.com/analytics.js" async defer />
}
<script
src="https://www.google-analytics.com/analytics.js"
async
defer
/>}
</body>
</html>
);
Expand Down
18 changes: 9 additions & 9 deletions src/components/Layout/Layout.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ import App from '../App';
import Layout from './Layout';

describe('Layout', () => {

it('renders children correctly', () => {
const wrapper = renderer.create(
<App context={{ insertCss: () => {} }}>
<Layout>
<div className="child" />
</Layout>
</App>,
).toJSON();
const wrapper = renderer
.create(
<App context={{ insertCss: () => {} }}>
<Layout>
<div className="child" />
</Layout>
</App>,
)
.toJSON();

expect(wrapper).toMatchSnapshot();
});

});
8 changes: 6 additions & 2 deletions src/components/Link/Link.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Link extends React.Component {
onClick: null,
};

handleClick = (event) => {
handleClick = event => {
if (this.props.onClick) {
this.props.onClick(event);
}
Expand All @@ -49,7 +49,11 @@ class Link extends React.Component {

render() {
const { to, children, ...props } = this.props;
return <a href={to} {...props} onClick={this.handleClick}>{children}</a>;
return (
<a href={to} {...props} onClick={this.handleClick}>
{children}
</a>
);
}
}

Expand Down
16 changes: 12 additions & 4 deletions src/components/Navigation/Navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,20 @@ class Navigation extends React.Component {
render() {
return (
<div className={s.root} role="navigation">
<Link className={s.link} to="/about">About</Link>
<Link className={s.link} to="/contact">Contact</Link>
<Link className={s.link} to="/about">
About
</Link>
<Link className={s.link} to="/contact">
Contact
</Link>
<span className={s.spacer}> | </span>
<Link className={s.link} to="/login">Log in</Link>
<Link className={s.link} to="/login">
Log in
</Link>
<span className={s.spacer}>or</span>
<Link className={cx(s.link, s.highlight)} to="/register">Sign up</Link>
<Link className={cx(s.link, s.highlight)} to="/register">
Sign up
</Link>
</div>
);
}
Expand Down
4 changes: 3 additions & 1 deletion src/components/Page/Page.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ class Page extends React.Component {
return (
<div className={s.root}>
<div className={s.container}>
<h1>{title}</h1>
<h1>
{title}
</h1>
<div
// eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{ __html: html }}
Expand Down
Loading

0 comments on commit a5e2f4d

Please sign in to comment.