aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichał Gołębiowski-Owczarek <m.goleb@gmail.com>2019-11-25 20:16:53 +0100
committerGitHub <noreply@github.com>2019-11-25 20:16:53 +0100
commit44ac8c8529173711b66046ae5cfefa5bd4892461 (patch)
tree5f00fbad19e0374fd79cefdb208ae2b328d9bc8d
parent075320149ae30a5c593c06b2fb015bdf033e0acf (diff)
downloadjquery-44ac8c8529173711b66046ae5cfefa5bd4892461.tar.gz
jquery-44ac8c8529173711b66046ae5cfefa5bd4892461.zip
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
-rw-r--r--package.json1
-rw-r--r--src/.eslintrc.json7
2 files changed, 8 insertions, 0 deletions
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",