Skip to content

Commit f6474b3

Browse files
committed
Merge branch 'master' of github.com:facebookincubator/create-react-app into add-stylelint
2 parents a031b66 + e7c113e commit f6474b3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1834
-898
lines changed

.eslintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
},
1212
"rules": {
1313
"no-console": "off",
14-
"strict": ["error", "global"]
14+
"strict": ["error", "global"],
15+
"curly": "warn"
1516
}
1617
}

.travis.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,7 @@ matrix:
2424
include:
2525
- node_js: 0.10
2626
env: TEST_SUITE=simple
27-
- node_js: 6
28-
env: USE_YARN=yes TEST_SUITE=simple
27+
# There's a weird Yarn/Lerna bug related to prerelease versions.
28+
# TODO: reenable after we ship 1.0.
29+
# - node_js: 6
30+
# env: USE_YARN=yes TEST_SUITE=simple

CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ cd my-app
8888

8989
and then run `npm start` or `npm run build`.
9090

91+
*Note: if you are using yarn, we suggest that you use `yarn install --no-lockfile` instead of the bare `yarn` or `yarn install` because we [intentionally](https://github.com/facebookincubator/create-react-app/pull/2014#issuecomment-300811661) do not ignore or add yarn.lock to our repo.*
92+
9193
## Cutting a Release
9294

9395
1. Tag all merged pull requests that go into the release with the relevant milestone. Each merged PR should also be labeled with one of the [labels](https://github.com/facebookincubator/create-react-app/labels) named `tag: ...` to indicate what kind of change it is.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"precommit": "lint-staged"
1414
},
1515
"devDependencies": {
16-
"eslint": "3.16.1",
16+
"eslint": "3.19.0",
1717
"husky": "^0.13.2",
1818
"lerna": "2.0.0-beta.38",
1919
"lerna-changelog": "^0.2.3",

packages/babel-preset-react-app/index.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
*/
99
'use strict';
1010

11-
var path = require('path');
12-
1311
const plugins = [
1412
// class { handleClick = () => { } }
1513
require.resolve('babel-plugin-transform-class-properties'),
@@ -36,8 +34,6 @@ const plugins = [
3634
helpers: false,
3735
polyfill: false,
3836
regenerator: true,
39-
// Resolve the Babel runtime relative to the config.
40-
moduleName: path.dirname(require.resolve('babel-runtime/package')),
4137
},
4238
],
4339
];
Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "babel-preset-react-app",
3-
"version": "2.1.1",
3+
"version": "3.0.0",
44
"description": "Babel preset used by Create React App",
55
"repository": "facebookincubator/create-react-app",
66
"license": "BSD-3-Clause",
@@ -11,18 +11,20 @@
1111
"index.js"
1212
],
1313
"dependencies": {
14-
"babel-plugin-dynamic-import-node": "1.0.0",
14+
"babel-plugin-dynamic-import-node": "1.0.2",
1515
"babel-plugin-syntax-dynamic-import": "6.18.0",
16-
"babel-plugin-transform-class-properties": "6.23.0",
16+
"babel-plugin-transform-class-properties": "6.24.1",
1717
"babel-plugin-transform-object-rest-spread": "6.23.0",
1818
"babel-plugin-transform-react-constant-elements": "6.23.0",
19-
"babel-plugin-transform-react-jsx": "6.23.0",
19+
"babel-plugin-transform-react-jsx": "6.24.1",
2020
"babel-plugin-transform-react-jsx-self": "6.22.0",
2121
"babel-plugin-transform-react-jsx-source": "6.22.0",
22-
"babel-plugin-transform-regenerator": "6.22.0",
22+
"babel-plugin-transform-regenerator": "6.24.1",
2323
"babel-plugin-transform-runtime": "6.23.0",
24-
"babel-preset-env": "1.2.1",
25-
"babel-preset-react": "6.23.0",
26-
"babel-runtime": "6.23.0"
24+
"babel-preset-env": "1.4.0",
25+
"babel-preset-react": "6.24.1"
26+
},
27+
"peerDependencies": {
28+
"babel-runtime": "^6.23.0"
2729
}
2830
}

packages/eslint-config-react-app/README.md

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ Please refer to its documentation:
88

99
## Usage in Create React App Projects
1010

11-
The easiest way to use this configuration is with [Create React App](https://github.com/facebookincubator/create-react-app), which includes it by default. **You don’t need to install it separately in Create React App projects.**
11+
The easiest way to use this configuration is with [Create React App](https://github.com/facebookincubator/create-react-app), which includes it by default.
12+
13+
**You don’t need to install it separately in Create React App projects.**
1214

1315
## Usage Outside of Create React App
1416

@@ -17,7 +19,7 @@ If you want to use this ESLint configuration in a project not built with Create
1719
First, install this package, ESLint and the necessary plugins.
1820

1921
```sh
20-
npm install --save-dev eslint-config-react-app babel-eslint@7.1.1 eslint@3.16.1 eslint-plugin-flowtype@2.21.0 eslint-plugin-import@2.0.1 eslint-plugin-jsx-a11y@4.0.0 eslint-plugin-react@6.4.1
22+
npm install --save-dev eslint-config-react-app babel-eslint@7.2.3 eslint@3.19.0 eslint-plugin-flowtype@2.33.0 eslint-plugin-import@2.2.0 eslint-plugin-jsx-a11y@5.0.1 eslint-plugin-react@7.0.1
2123
```
2224

2325
Then create a file named `.eslintrc` with following contents in the root folder of your project:
@@ -29,3 +31,37 @@ Then create a file named `.eslintrc` with following contents in the root folder
2931
```
3032

3133
That's it! You can override the settings from `eslint-config-react-app` by editing the `.eslintrc` file. Learn more about [configuring ESLint](http://eslint.org/docs/user-guide/configuring) on the ESLint website.
34+
35+
## Accessibility Checks
36+
37+
The following rules from the [eslint-plugin-jsx-a11y](https://github.com/evcohen/eslint-plugin-jsx-a11y) plugin are activated:
38+
39+
- [accessible-emoji](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/accessible-emoji.md)
40+
- [alt-text](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/alt-text.md)
41+
- [anchor-has-content](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-has-content.md)
42+
- [aria-activedescendant-has-tabindex](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-activedescendant-has-tabindex.md)
43+
- [aria-props](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-props.md)
44+
- [aria-proptypes](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-proptypes.md)
45+
- [aria-role](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-role.md)
46+
- [aria-unsupported-elements](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-unsupported-elements.md)
47+
- [heading-has-content](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/heading-has-content.md)
48+
- [href-no-hash](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/href-no-hash.md)
49+
- [iframe-has-title](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/iframe-has-title.md)
50+
- [img-redundant-alt](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/img-redundant-alt.md)
51+
- [no-access-key](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-access-key.md)
52+
- [no-distracting-elements](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-distracting-elements.md)
53+
- [no-redundant-roles](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-redundant-roles.md)
54+
- [role-has-required-aria-props](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/role-has-required-aria-props.md)
55+
- [role-supports-aria-props](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/role-supports-aria-props.md)
56+
- [scope](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/scope.md)
57+
58+
If you want to enable even more accessibility rules, you can create an `.eslintrc` file in the root of your project with this content:
59+
60+
```json
61+
{
62+
"extends": ["react-app", "plugin:jsx-a11y/recommended"],
63+
"plugins": ["jsx-a11y"]
64+
}
65+
```
66+
67+
However, if you are using [Create React App](https://github.com/facebookincubator/create-react-app) and have not ejected, any additional rules will only be displayed in the [IDE integrations](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#displaying-lint-output-in-the-editor), but not in the browser or the terminal.

packages/eslint-config-react-app/index.js

Lines changed: 95 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,72 @@
1818
// In the future, we might create a separate list of rules for production.
1919
// It would probably be more strict.
2020

21+
// The ESLint browser environment defines all browser globals as valid,
22+
// even though most people don't know some of them exist (e.g. `name` or `status`).
23+
// This is dangerous as it hides accidentally undefined variables.
24+
// We blacklist the globals that we deem potentially confusing.
25+
// To use them, explicitly reference them, e.g. `window.name` or `window.status`.
26+
var restrictedGlobals = [
27+
'addEventListener',
28+
'blur',
29+
'close',
30+
'closed',
31+
'confirm',
32+
'defaultStatus',
33+
'defaultstatus',
34+
'event',
35+
'external',
36+
'find',
37+
'focus',
38+
'frameElement',
39+
'frames',
40+
'history',
41+
'innerHeight',
42+
'innerWidth',
43+
'length',
44+
'location',
45+
'locationbar',
46+
'menubar',
47+
'moveBy',
48+
'moveTo',
49+
'name',
50+
'onblur',
51+
'onerror',
52+
'onfocus',
53+
'onload',
54+
'onresize',
55+
'onunload',
56+
'open',
57+
'opener',
58+
'opera',
59+
'outerHeight',
60+
'outerWidth',
61+
'pageXOffset',
62+
'pageYOffset',
63+
'parent',
64+
'print',
65+
'removeEventListener',
66+
'resizeBy',
67+
'resizeTo',
68+
'screen',
69+
'screenLeft',
70+
'screenTop',
71+
'screenX',
72+
'screenY',
73+
'scroll',
74+
'scrollbars',
75+
'scrollBy',
76+
'scrollTo',
77+
'scrollX',
78+
'scrollY',
79+
'self',
80+
'status',
81+
'statusbar',
82+
'stop',
83+
'toolbar',
84+
'top',
85+
];
86+
2187
module.exports = {
2288
root: true,
2389

@@ -43,16 +109,6 @@ module.exports = {
43109
},
44110
},
45111

46-
settings: {
47-
'import/ignore': ['node_modules'],
48-
'import/extensions': ['.js'],
49-
'import/resolver': {
50-
node: {
51-
extensions: ['.js', '.json'],
52-
},
53-
},
54-
},
55-
56112
rules: {
57113
// http://eslint.org/docs/rules/
58114
'array-callback-return': 'warn',
@@ -121,7 +177,7 @@ module.exports = {
121177
'no-this-before-super': 'warn',
122178
'no-throw-literal': 'warn',
123179
'no-undef': 'error',
124-
'no-restricted-globals': ['error', 'event'],
180+
'no-restricted-globals': ['error'].concat(restrictedGlobals),
125181
'no-unexpected-multiline': 'warn',
126182
'no-unreachable': 'warn',
127183
'no-unused-expressions': [
@@ -164,51 +220,29 @@ module.exports = {
164220
'valid-typeof': 'warn',
165221
'no-restricted-properties': [
166222
'error',
167-
{
168-
object: 'require',
169-
property: 'ensure',
170-
message: 'Please use import() instead. More info: https://webpack.js.org/guides/code-splitting-import/#dynamic-import',
171-
},
223+
// TODO: reenable once import() is no longer slow.
224+
// https://github.com/facebookincubator/create-react-app/issues/2176
225+
// {
226+
// object: 'require',
227+
// property: 'ensure',
228+
// message: 'Please use import() instead. More info: https://webpack.js.org/guides/code-splitting-import/#dynamic-import',
229+
// },
172230
{
173231
object: 'System',
174232
property: 'import',
175233
message: 'Please use import() instead. More info: https://webpack.js.org/guides/code-splitting-import/#dynamic-import',
176234
},
177235
],
178236

179-
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/
180-
181-
// TODO: import rules are temporarily disabled because they don't play well
182-
// with how eslint-loader only checks the file you change. So if module A
183-
// imports module B, and B is missing a default export, the linter will
184-
// record this as an issue in module A. Now if you fix module B, the linter
185-
// will not be aware that it needs to re-lint A as well, so the error
186-
// will stay until the next restart, which is really confusing.
187-
188-
// This is probably fixable with a patch to eslint-loader.
189-
// When file A is saved, we want to invalidate all files that import it
190-
// *and* that currently have lint errors. This should fix the problem.
191-
// (As an exception, import/no-webpack-loader-syntax can be enabled already
192-
// because it doesn't depend on whether the file exists, so this issue
193-
// doesn't apply to it.)
194-
195-
// 'import/default': 'warn',
196-
// 'import/export': 'warn',
197-
// 'import/named': 'warn',
198-
// 'import/namespace': 'warn',
199-
// 'import/no-amd': 'warn',
200-
// 'import/no-duplicates': 'warn',
201-
// 'import/no-extraneous-dependencies': 'warn',
202-
// 'import/no-named-as-default': 'warn',
203-
// 'import/no-named-as-default-member': 'warn',
204-
// 'import/no-unresolved': ['warn', { commonjs: true }],
205-
// We don't support configuring Webpack using import source strings, so this
206-
// is always an error.
237+
// https://github.com/benmosher/eslint-plugin-import/tree/master/docs/rules
238+
'import/first': 'error',
239+
'import/no-amd': 'error',
207240
'import/no-webpack-loader-syntax': 'error',
208241

209242
// https://github.com/yannickcr/eslint-plugin-react/tree/master/docs/rules
210-
'react/jsx-equals-spacing': ['warn', 'never'],
243+
'react/jsx-no-comment-textnodes': 'warn',
211244
'react/jsx-no-duplicate-props': ['warn', { ignoreCase: true }],
245+
'react/jsx-no-target-blank': 'warn',
212246
'react/jsx-no-undef': 'error',
213247
'react/jsx-pascal-case': [
214248
'warn',
@@ -224,14 +258,28 @@ module.exports = {
224258
'react/no-direct-mutation-state': 'warn',
225259
'react/no-is-mounted': 'warn',
226260
'react/react-in-jsx-scope': 'error',
227-
'react/require-render-return': 'warn',
261+
'react/require-render-return': 'error',
228262
'react/style-prop-object': 'warn',
229263

230264
// https://github.com/evcohen/eslint-plugin-jsx-a11y/tree/master/docs/rules
265+
'jsx-a11y/accessible-emoji': 'warn',
266+
'jsx-a11y/alt-text': 'warn',
267+
'jsx-a11y/anchor-has-content': 'warn',
268+
'jsx-a11y/aria-activedescendant-has-tabindex': 'warn',
269+
'jsx-a11y/aria-props': 'warn',
270+
'jsx-a11y/aria-proptypes': 'warn',
231271
'jsx-a11y/aria-role': 'warn',
232-
'jsx-a11y/img-has-alt': 'warn',
272+
'jsx-a11y/aria-unsupported-elements': 'warn',
273+
'jsx-a11y/heading-has-content': 'warn',
274+
'jsx-a11y/href-no-hash': 'warn',
275+
'jsx-a11y/iframe-has-title': 'warn',
233276
'jsx-a11y/img-redundant-alt': 'warn',
234277
'jsx-a11y/no-access-key': 'warn',
278+
'jsx-a11y/no-distracting-elements': 'warn',
279+
'jsx-a11y/no-redundant-roles': 'warn',
280+
'jsx-a11y/role-has-required-aria-props': 'warn',
281+
'jsx-a11y/role-supports-aria-props': 'warn',
282+
'jsx-a11y/scope': 'warn',
235283

236284
// https://github.com/gajus/eslint-plugin-flowtype
237285
'flowtype/define-flow-type': 'warn',
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eslint-config-react-app",
3-
"version": "0.6.1",
3+
"version": "1.0.0",
44
"description": "ESLint configuration used by Create React App",
55
"repository": "facebookincubator/create-react-app",
66
"license": "BSD-3-Clause",
@@ -11,11 +11,11 @@
1111
"index.js"
1212
],
1313
"peerDependencies": {
14-
"babel-eslint": "^7.0.0",
15-
"eslint": "^3.16.1",
16-
"eslint-plugin-flowtype": "^2.21.0",
17-
"eslint-plugin-import": "^2.0.1",
18-
"eslint-plugin-jsx-a11y": "^2.0.0 || ^3.0.0 || ^4.0.0",
19-
"eslint-plugin-react": "^6.4.1"
14+
"babel-eslint": "^7.2.3",
15+
"eslint": "^3.19.0",
16+
"eslint-plugin-flowtype": "^2.33.0",
17+
"eslint-plugin-import": "^2.2.0",
18+
"eslint-plugin-jsx-a11y": "^5.0.1",
19+
"eslint-plugin-react": "^7.0.1"
2020
}
2121
}

0 commit comments

Comments
 (0)