Skip to content

Commit 3c2f2d4

Browse files
authored
Add import/no-anonymous-default-export lint rule (#8926)
1 parent 4974a20 commit 3c2f2d4

Some content is hidden

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

41 files changed

+93
-40
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ module.exports = {
253253
// https://github.com/benmosher/eslint-plugin-import/tree/master/docs/rules
254254
'import/first': 'error',
255255
'import/no-amd': 'error',
256+
'import/no-anonymous-default-export': 'warn',
256257
'import/no-webpack-loader-syntax': 'error',
257258

258259
// https://github.com/yannickcr/eslint-plugin-react/tree/master/docs/rules

packages/react-scripts/fixtures/kitchensink/template/src/absoluteLoad.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
export default () => [
8+
const absoluteLoad = () => [
99
{ id: 1, name: '1' },
1010
{ id: 2, name: '2' },
1111
{ id: 3, name: '3' },
1212
{ id: 4, name: '4' },
1313
];
14+
15+
export default absoluteLoad;

packages/react-scripts/fixtures/kitchensink/template/src/features/config/BaseUrl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import React, { Component } from 'react';
99
import PropTypes from 'prop-types';
1010
import load from 'absoluteLoad';
1111

12-
export default class extends Component {
12+
export default class BaseUrl extends Component {
1313
static propTypes = {
1414
onReady: PropTypes.func.isRequired,
1515
};

packages/react-scripts/fixtures/kitchensink/template/src/features/env/ExpandEnvVariables.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import React from 'react';
99

10-
export default () => (
10+
const ExpandEnvVariables = () => (
1111
<span>
1212
<span id="feature-expand-env-1">{process.env.REACT_APP_BASIC}</span>
1313
<span id="feature-expand-env-2">{process.env.REACT_APP_BASIC_EXPAND}</span>
@@ -19,3 +19,5 @@ export default () => (
1919
</span>
2020
</span>
2121
);
22+
23+
export default ExpandEnvVariables;

packages/react-scripts/fixtures/kitchensink/template/src/features/env/FileEnvVariables.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import React from 'react';
99

10-
export default () => (
10+
const FileEnvVariables = () => (
1111
<span>
1212
<span id="feature-file-env-original-1">
1313
{process.env.REACT_APP_ORIGINAL_1}
@@ -22,3 +22,5 @@ export default () => (
2222
<span id="feature-file-env-x">{process.env.REACT_APP_X}</span>
2323
</span>
2424
);
25+
26+
export default FileEnvVariables;

packages/react-scripts/fixtures/kitchensink/template/src/features/env/PublicUrl.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
import React from 'react';
99

10-
export default () => (
10+
const PublicUrl = () => (
1111
<span id="feature-public-url">{process.env.PUBLIC_URL}.</span>
1212
);
13+
14+
export default PublicUrl;

packages/react-scripts/fixtures/kitchensink/template/src/features/env/ShellEnvVariables.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77

88
import React from 'react';
99

10-
export default () => (
10+
const ShellEnvVariables = () => (
1111
<span id="feature-shell-env-variables">
1212
{process.env.REACT_APP_SHELL_ENV_MESSAGE}.
1313
</span>
1414
);
15+
16+
export default ShellEnvVariables;

packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/ArrayDestructuring.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function load() {
1717
];
1818
}
1919

20-
export default class extends Component {
20+
export default class ArrayDestructuring extends Component {
2121
static propTypes = {
2222
onReady: PropTypes.func.isRequired,
2323
};

packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/ArraySpread.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function load(users) {
1717
];
1818
}
1919

20-
export default class extends Component {
20+
export default class ArraySpread extends Component {
2121
static propTypes = {
2222
onReady: PropTypes.func.isRequired,
2323
};

packages/react-scripts/fixtures/kitchensink/template/src/features/syntax/AsyncAwait.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const x = async (
2727
};
2828
/* eslint-enable */
2929

30-
export default class extends Component {
30+
export default class AsyncAwait extends Component {
3131
static propTypes = {
3232
onReady: PropTypes.func.isRequired,
3333
};

0 commit comments

Comments
 (0)