From 44ac8c8529173711b66046ae5cfefa5bd4892461 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Go=C5=82=C4=99biowski-Owczarek?= Date: Mon, 25 Nov 2019 20:16:53 +0100 Subject: [PATCH] Build: Require extensions for ES6 imports, prevent import cycles jQuery source is now authored in ECMAScript modules. Native browser support for them requires full file names including extensions. Rollup works even if import paths don't specify extensions, though, so one import slipped through without such an extension, breaking native browser import of src/jquery.js. A new ESLint rule using eslint-plugin-import prevents us from regressing on that front. Also, eslint-plugin-import's no-cycle rule is used to avoid import cycles. Closes gh-4544 Ref gh-4541 Ref 075320149ae30a5c593c06b2fb015bdf033e0acf --- package.json | 1 + src/.eslintrc.json | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/package.json b/package.json index 106417d07..1bb21b7c9 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "commitplease": "3.2.0", "core-js-bundle": "3.0.0", "eslint-config-jquery": "2.0.0", + "eslint-plugin-import": "2.18.2", "grunt": "1.0.4", "grunt-babel": "8.0.0", "grunt-cli": "1.3.2", diff --git a/src/.eslintrc.json b/src/.eslintrc.json index 44cb3a179..4ac59e28b 100644 --- a/src/.eslintrc.json +++ b/src/.eslintrc.json @@ -8,6 +8,13 @@ "sourceType": "module" }, + "plugins": [ "import" ], + + "rules": { + "import/extensions": [ "error", "always" ], + "import/no-cycle": "error" + }, + "overrides": [ { "files": "wrapper.js",