Skip to content

Commit

Permalink
Merge 2059424 into d19099a
Browse files Browse the repository at this point in the history
  • Loading branch information
julienben committed Oct 27, 2019
2 parents d19099a + 2059424 commit 8022dd8
Show file tree
Hide file tree
Showing 170 changed files with 7,939 additions and 7,448 deletions.
10 changes: 9 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ module.exports = {
'import/imports-first': 0,
'import/newline-after-import': 0,
'import/no-dynamic-require': 0,
'import/no-extraneous-dependencies': 0,
'import/no-named-as-default': 0,
'import/no-unresolved': 2,
'import/no-webpack-loader-syntax': 0,
Expand Down Expand Up @@ -69,6 +68,7 @@ module.exports = {
'react/forbid-prop-types': 0,
'react/jsx-first-prop-new-line': [2, 'multiline'],
'react/jsx-filename-extension': 0,
'react/jsx-props-no-spreading': 0,
'react/jsx-no-target-blank': 0,
'react/jsx-uses-vars': 2,
'react/require-default-props': 0,
Expand All @@ -79,6 +79,14 @@ module.exports = {
'redux-saga/yield-effects': 2,
'require-yield': 0,
},
overrides: [
{
files: ['internals/**/*.*', 'server/**/*.*'],
rules: {
'import/no-extraneous-dependencies': 0,
},
},
],
settings: {
'import/resolver': {
webpack: {
Expand Down
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Global owners
* @julienben @gretzky @justingreenberg @jwinn @Mensae
4 changes: 4 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# These are supported funding model platforms

github: [julienben, gretzky]
open_collective: react-boilerplate
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
---
name: Bug report
about: Create a report to help us improve

---

Before opening a new issue, please take a moment to review our [**community guidelines**](https://github.com/react-boilerplate/react-boilerplate/blob/master/CONTRIBUTING.md) to make the contribution process easy and effective for everyone involved.

## Description

A clear and concise description of what the bug is.

## Steps to reproduce

Steps to reproduce the behavior:

(Add link to a demo on https://jsfiddle.net or similar if possible)
Expand Down
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
name: Feature request
about: Suggest an idea for this project

---

**Is your feature request related to a problem? Please describe.**
Expand Down
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on something that might not end up being merged into the project.
Before opening a pull request, please ensure:

- [ ] You have followed our [**contributing guidelines**](https://github.com/react-boilerplate/react-boilerplate/blob/master/CONTRIBUTING.md)
- [ ] Double-check your branch is based on `dev` and targets `dev`
- [ ] Double-check your branch is based on `dev` and targets `dev`
- [ ] Pull request has tests (we are going for 100% coverage!)
- [ ] Code is well-commented, linted and follows project conventions
- [ ] Documentation is updated (if necessary)
Expand Down
23 changes: 14 additions & 9 deletions .github/issue-close-app.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
comment: This issue was automatically closed because it does not follow either one of our templates. Please open a new issue and fill out the template that appears instead of deleting it. If you're reporting an issue, it's especially important that you provide detailed steps for how to reproduce it.
comment: "This issue was automatically closed because it does not follow either one of react-boilerplate's templates.
issueConfigs:
If your issue is indeed a bug report or a feature request, please open a new issue and fill out the relevant template instead of deleting it.
If you're reporting a bug, it's especially important that you provide detailed steps for how to reproduce it.
Please note that requests for help should go to [our Spectrum channel](https://spectrum.chat/react-boilerplate?tab=posts)."

issueConfigs:
- content:
- Description
- Steps to reproduce
- Versions
- Description
- Steps to reproduce
- Versions

- content:
- Is your feature request related to a problem
- Describe the solution you'd like
- Describe alternatives you've considered
- Additional context
- Is your feature request related to a problem
- Describe the solution you'd like
- Describe alternatives you've considered
- Additional context
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
save-exact = true
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ node_js:
- 'node'
- 'lts/*'

services:
- xvfb

script:
- node ./internals/scripts/generate-templates-for-linting
- npm test -- --maxWorkers=4
Expand All @@ -12,7 +15,6 @@ script:
before_install:
- export CHROME_BIN=chromium-browser
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start

notifications:
email:
Expand Down
20 changes: 10 additions & 10 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ appearance, race, religion, or sexual identity and orientation.
Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
- The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities
Expand Down
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ experience the problem? What would you expect to be the outcome? All these detai
Example:

> ## Description
>
> A clear and concise description of what the bug is.
>
> Any other information you want to share that is relevant to the issue being
Expand All @@ -43,6 +44,7 @@ Example:
> merits).
>
> ## Steps to reproduce
>
> Steps to reproduce the behavior:
>
> 1. This is the first step
Expand Down
2 changes: 1 addition & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ We hope you enjoy this release and welcome any feedback, bug reports or feature
- Fix setup script for Windows environments (**@mensae**)
- Generate passing tests for components/containers (**@mjhost**)
- Rewrite generators code (**@mensae**)
- Complete rewrite or `generate-templates-for-linting.js` (**@mensae**)
- Complete rewrite of `generate-templates-for-linting.js` (**@mensae**)
- `webpack.DefinePlugin` => `webpack.EnvironmentPlugin` (**@nshimiye**)
- New Webpack code splitting config (**@julienben**)
- Remove `process.noDeprecation = true` (**@spawnia**)
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ But wait... there's more!
- _Catch problems:_ AppVeyor and TravisCI setups included by default, so your
tests get run automatically on Windows and Unix.

There’s also a <a href="https://vimeo.com/168648012">fantastic video</a> on how to structure your React.js apps with scalability in mind. It provides rationale for the majority of boilerplate's design decisions.
There’s also a <a href="https://vimeo.com/168648012">fantastic video</a> on how to structure your React apps with scalability in mind. It provides rationale for the majority of boilerplate's design decisions.

<sub><i>Keywords: React.js, Redux, Hot Reloading, ESNext, Babel, react-router, Offline First, ServiceWorker, `styled-components`, redux-saga, FontFaceObserver</i></sub>

Expand Down Expand Up @@ -134,7 +134,6 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d

This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!


## Supporters

This project would not be possible without the support of these amazing folks. [**Become a sponsor**](https://opencollective.com/react-boilerplate) to get your company in front of thousands of engaged react developers and help us out!
Expand Down
4 changes: 2 additions & 2 deletions app/.nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ server {
# To let nginx use its own DNS Resolver
# resolver <IP DNS resolver>;

# Set path
root /var/www/;

# Always serve index.html for any request
location / {
# Set path
root /var/www/;
try_files $uri /index.html;
}

Expand Down
11 changes: 7 additions & 4 deletions app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* code.
*/

// Needed for redux-saga es6 generator support
import '@babel/polyfill';
import 'react-app-polyfill/ie11';
import 'react-app-polyfill/stable';

// Import all the third party stuff
import React from 'react';
Expand All @@ -25,8 +25,9 @@ import LanguageProvider from 'containers/LanguageProvider';

// Load the favicon and the .htaccess file
import '!file-loader?name=[name].[ext]!./images/favicon.ico';
import 'file-loader?name=.htaccess!./.htaccess'; // eslint-disable-line import/extensions
import 'file-loader?name=.htaccess!./.htaccess';

import { HelmetProvider } from 'react-helmet-async';
import configureStore from './configureStore';

// Import i18n messages
Expand All @@ -51,7 +52,9 @@ const render = messages => {
<Provider store={store}>
<LanguageProvider messages={messages}>
<ConnectedRouter history={history}>
<App />
<HelmetProvider>
<App />
</HelmetProvider>
</ConnectedRouter>
</LanguageProvider>
</Provider>,
Expand Down
33 changes: 18 additions & 15 deletions app/components/A/tests/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,50 +3,53 @@
*/

import React from 'react';
import { render } from 'react-testing-library';
import { render } from '@testing-library/react';

import A from '../index';

const href = 'http://mxstbr.com/';
const children = <h1>Test</h1>;
const renderComponent = (props = {}) =>
render(
const renderComponent = (props = {}) => {
const utils = render(
<A href={href} {...props}>
{children}
</A>,
);
const link = utils.container.querySelector('a');
return { ...utils, link };
};

describe('<A />', () => {
it('should render an <a> tag', () => {
const { container } = renderComponent();
expect(container.querySelector('a')).not.toBeNull();
const { link } = renderComponent();
expect(link).toBeInTheDocument();
});

it('should have an href attribute', () => {
const { container } = renderComponent();
expect(container.querySelector('a').href).toEqual(href);
const { link } = renderComponent();
expect(link).toHaveAttribute('href', href);
});

it('should have children', () => {
const { container } = renderComponent();
expect(container.querySelector('a').children).toHaveLength(1);
const { link } = renderComponent();
expect(link.children).toHaveLength(1);
});

it('should have a class attribute', () => {
const className = 'test';
const { container } = renderComponent({ className });
expect(container.querySelector('a').classList).toContain(className);
const { link } = renderComponent({ className });
expect(link).toHaveClass(className);
});

it('should adopt a target attribute', () => {
const target = '_blank';
const { container } = renderComponent({ target });
expect(container.querySelector('a').target).toEqual(target);
const { link } = renderComponent({ target });
expect(link).toHaveAttribute('target', target);
});

it('should adopt a type attribute', () => {
const type = 'text/html';
const { container } = renderComponent({ type });
expect(container.querySelector('a').type).toEqual(type);
const { link } = renderComponent({ type });
expect(link).toHaveAttribute('type', type);
});
});
25 changes: 16 additions & 9 deletions app/components/Button/tests/A.test.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,34 @@
import React from 'react';
import { render } from 'react-testing-library';
import { render } from '@testing-library/react';

import A from '../A';

const renderComponent = (props = {}) => {
const utils = render(<A {...props}>Link</A>);
const link = utils.queryByText('Link');
return { ...utils, link };
};

describe('<A />', () => {
it('should render an <a> tag', () => {
const { container } = render(<A />);
expect(container.querySelector('a')).not.toBeNull();
const { link } = renderComponent();
expect(link).toBeInTheDocument();
expect(link.tagName).toBe('A');
});

it('should have a class attribute', () => {
const { container } = render(<A />);
expect(container.querySelector('a').hasAttribute('class')).toBe(true);
const { link } = renderComponent();
expect(link).toHaveAttribute('class');
});

it('should adopt a valid attribute', () => {
const id = 'test';
const { container } = render(<A id={id} />);
expect(container.querySelector('a').id).toEqual(id);
const { link } = renderComponent({ id });
expect(link).toHaveAttribute('id', id);
});

it('should not adopt an invalid attribute', () => {
const { container } = render(<A attribute="test" />);
expect(container.querySelector('a[attribute="test"]')).toBeNull();
const { link } = renderComponent({ attribute: 'test' });
expect(link).not.toHaveAttribute('attribute');
});
});
Loading

0 comments on commit 8022dd8

Please sign in to comment.