From eff7ecd690ae3bb1a8579ac0c9152d12d8f7b69e Mon Sep 17 00:00:00 2001 From: Grzegorz Ziolkowski Date: Thu, 29 Jul 2021 11:22:01 +0200 Subject: [PATCH 1/2] ESLint Plugin: Include .jsx extenstion when linting import statements --- packages/eslint-plugin/CHANGELOG.md | 4 ++++ .../eslint-plugin/configs/recommended-with-formatting.js | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index ad7c34feff655d..f51cbf7120e37f 100644 --- a/packages/eslint-plugin/CHANGELOG.md +++ b/packages/eslint-plugin/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Bug Fix + +- Include `.jsx` extension when linting import statements in case TypeScript not present ([#33746](https://github.com/WordPress/gutenberg/pull/33746)). + ## 9.1.0 (2021-07-21) ### Enhancement diff --git a/packages/eslint-plugin/configs/recommended-with-formatting.js b/packages/eslint-plugin/configs/recommended-with-formatting.js index 51970f2c238cf1..05dd9ee5313e60 100644 --- a/packages/eslint-plugin/configs/recommended-with-formatting.js +++ b/packages/eslint-plugin/configs/recommended-with-formatting.js @@ -16,6 +16,13 @@ module.exports = { document: true, wp: 'readonly', }, + settings: { + 'import/resolver': { + node: { + extensions: [ '.js', '.jsx' ], + }, + }, + }, rules: { 'import/no-extraneous-dependencies': [ 'error', From 104fc80490b0d3f62119eee709325447490bdd60 Mon Sep 17 00:00:00 2001 From: Grzegorz Ziolkowski Date: Fri, 30 Jul 2021 11:22:40 +0200 Subject: [PATCH 2/2] Move import settings to react config --- packages/eslint-plugin/configs/react.js | 3 +++ .../eslint-plugin/configs/recommended-with-formatting.js | 7 ------- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/packages/eslint-plugin/configs/react.js b/packages/eslint-plugin/configs/react.js index c86f1ec718a1c8..1f0add55d4473e 100644 --- a/packages/eslint-plugin/configs/react.js +++ b/packages/eslint-plugin/configs/react.js @@ -5,6 +5,9 @@ module.exports = { jsx: true, }, }, + settings: { + 'import/extensions': [ '.js', '.jsx' ], + }, plugins: [ '@wordpress', 'react', 'react-hooks' ], rules: { '@wordpress/no-unused-vars-before-return': [ diff --git a/packages/eslint-plugin/configs/recommended-with-formatting.js b/packages/eslint-plugin/configs/recommended-with-formatting.js index 05dd9ee5313e60..51970f2c238cf1 100644 --- a/packages/eslint-plugin/configs/recommended-with-formatting.js +++ b/packages/eslint-plugin/configs/recommended-with-formatting.js @@ -16,13 +16,6 @@ module.exports = { document: true, wp: 'readonly', }, - settings: { - 'import/resolver': { - node: { - extensions: [ '.js', '.jsx' ], - }, - }, - }, rules: { 'import/no-extraneous-dependencies': [ 'error',