From 8612018d4eb570b39532fca8344a187d2e95f98e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Go=C5=82=C4=99biowski-Owczarek?= Date: Wed, 2 Sep 2020 17:24:55 +0200 Subject: [PATCH] Build: Make the import/no-unused-modules ESLint rule work in WebStorm When run via WebStorm, the root path against which paths in the config of the `import/no-unused-modules` ESLint rule are resolved is the path where the ESLint config file that defines the rule lies, i.e. `src`. When run via the command line, it's usually the root folder of the jQuery repository. This pattern intends to catch both. Note that we cannot specify two patterns here: ```js [ "src/*.js", "*.js" ] ``` as they're analyzed individually and the rule crashes if a pattern cannot be matched. Closes gh-4777 --- src/.eslintrc.json | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/.eslintrc.json b/src/.eslintrc.json index 96b83ff10..f1b596dff 100644 --- a/src/.eslintrc.json +++ b/src/.eslintrc.json @@ -15,7 +15,16 @@ "import/no-cycle": "error", "import/no-unused-modules": [ "error", { "unusedExports": true, - "ignoreExports": [ "src/*.js" ] + + // When run via WebStorm, the root path against which these paths + // are resolved is the path where this ESLint config file lies, + // i.e. `src`. When run via the command line, it's usually the root + // folder of the jQuery repository. This pattern intends to catch both. + // Note that we cannot specify two patterns here: + // [ "src/*.js", "*.js" ] + // as they're analyzed individually and the rule crashes if a pattern + // cannot be matched. + "ignoreExports": [ "{src/,}*.js" ] } ], "indent": [ "error", "tab", { "outerIIFEBody": 0