diff --git a/.eslintrc.js b/.eslintrc.js index c51b9a24f745f..3f7520de8674e 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -54,6 +54,8 @@ module.exports = { }, ], '@wordpress/no-unsafe-wp-apis': 'off', + 'import/default': 'error', + 'import/named': 'error', 'no-restricted-imports': [ 'error', { @@ -152,6 +154,7 @@ module.exports = { rules: { 'import/no-extraneous-dependencies': 'off', 'import/no-unresolved': 'off', + 'import/named': 'off', }, }, { diff --git a/package-lock.json b/package-lock.json index 850098ae04608..5a35fae54dcf1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28598,9 +28598,9 @@ "dev": true }, "is-callable": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.2.tgz", - "integrity": "sha512-dnMqspv5nU3LoewK2N/y7KLtxtakvTuaCsU9FU50/QDmdbHNy/4/JuRtMHqRU22o3q+W89YQndQEeCVwK+3qrA==", + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.3.tgz", + "integrity": "sha512-J1DcMe8UYTBSrKezuIUTUwjXsho29693unXM2YhJUTR2txK/eG47bvNa/wipPFmZFgr/N6f1GA66dv0mEyTIyQ==", "dev": true }, "is-regex": { diff --git a/package.json b/package.json index 4da9869b0b28a..87c75304b1c41 100644 --- a/package.json +++ b/package.json @@ -158,6 +158,7 @@ "enzyme": "3.11.0", "equivalent-key-map": "0.2.2", "eslint-plugin-eslint-comments": "3.1.2", + "eslint-plugin-import": "2.22.1", "execa": "4.0.2", "fast-glob": "2.2.7", "glob": "7.1.2", diff --git a/packages/block-editor/src/store/test/actions.js b/packages/block-editor/src/store/test/actions.js index 8bbc93386e277..f36192a4e2e33 100644 --- a/packages/block-editor/src/store/test/actions.js +++ b/packages/block-editor/src/store/test/actions.js @@ -21,7 +21,10 @@ import { import * as selectors from '../selectors'; import reducer from '../reducer'; -import actions, { +import * as actions from '../actions'; +import '../..'; + +const { clearSelectedBlock, enterFormattedText, exitFormattedText, @@ -55,8 +58,7 @@ import actions, { updateSettings, selectionChange, validateBlocksToTemplate, -} from '../actions'; -import '../..'; +} = actions; describe( 'actions', () => { const defaultBlockSettings = { diff --git a/packages/components/src/form-token-field/test/lib/token-field-wrapper.js b/packages/components/src/form-token-field/test/lib/token-field-wrapper.js index 8262b86f1a6bb..813c97c6143c6 100644 --- a/packages/components/src/form-token-field/test/lib/token-field-wrapper.js +++ b/packages/components/src/form-token-field/test/lib/token-field-wrapper.js @@ -52,4 +52,4 @@ class TokenFieldWrapper extends Component { } } -module.exports = TokenFieldWrapper; +export default TokenFieldWrapper; diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index b36fcd9618930..f2c6f8060a964 100644 --- a/packages/eslint-plugin/CHANGELOG.md +++ b/packages/eslint-plugin/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### New Features + +- Enabled `import/default` and `import/named` rules in the `recommended` ruleset. [#28513](https://github.com/WordPress/gutenberg/pull/28513) + ## 8.0.1 (2021-01-28) ### Bug Fix diff --git a/packages/eslint-plugin/configs/recommended-with-formatting.js b/packages/eslint-plugin/configs/recommended-with-formatting.js index 16700c2c51ec5..51970f2c238cf 100644 --- a/packages/eslint-plugin/configs/recommended-with-formatting.js +++ b/packages/eslint-plugin/configs/recommended-with-formatting.js @@ -24,6 +24,8 @@ module.exports = { }, ], 'import/no-unresolved': 'error', + 'import/default': 'warn', + 'import/named': 'warn', }, overrides: [ {