From ac2795a3882fca755eb958a218df49cab9fe5e61 Mon Sep 17 00:00:00 2001 From: Evgeny Orekhov Date: Wed, 26 Jun 2024 00:44:47 +0300 Subject: [PATCH] Check more file extensions - .*.js - *.mjs - .*.mjs - *.cts - .*.cts - *.mts - .*.mts --- base.json | 4 +++- esm/test.cts | 5 +++++ esm/test.mjs | 2 +- esm/test.mts | 6 ++++++ test.cts | 5 +++++ test.mjs | 2 +- test.mts | 6 ++++++ ts.json | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- 8 files changed, 76 insertions(+), 4 deletions(-) create mode 100644 esm/test.cts create mode 100644 esm/test.mts create mode 100644 test.cts create mode 100644 test.mts diff --git a/base.json b/base.json index 4107c94b..b0aa316d 100644 --- a/base.json +++ b/base.json @@ -957,6 +957,8 @@ }, "overrides": [ + { "files": [".*.js", "*.mjs", ".*.mjs", "*.cjs", ".*.cjs"] }, + { "files": [ "**/test/**", @@ -1078,7 +1080,7 @@ }, { - "files": ["*.cjs", ".*.cjs", "*.cts", ".*.cts"], + "files": ["*.cjs", ".*.cjs"], "parserOptions": { "sourceType": "script" diff --git a/esm/test.cts b/esm/test.cts new file mode 100644 index 00000000..fffe4eeb --- /dev/null +++ b/esm/test.cts @@ -0,0 +1,5 @@ +/* eslint-disable no-console */ + +"use strict"; + +console.log("test"); diff --git a/esm/test.mjs b/esm/test.mjs index 2e9548ae..255019d6 100644 --- a/esm/test.mjs +++ b/esm/test.mjs @@ -1,5 +1,5 @@ /* eslint-disable-next-line - import/no-unused-modules + import/no-anonymous-default-export */ export default "test"; diff --git a/esm/test.mts b/esm/test.mts new file mode 100644 index 00000000..60327733 --- /dev/null +++ b/esm/test.mts @@ -0,0 +1,6 @@ +/* + eslint-disable-next-line + import/no-unused-modules, + import/no-anonymous-default-export +*/ +export default "test"; diff --git a/test.cts b/test.cts new file mode 100644 index 00000000..fffe4eeb --- /dev/null +++ b/test.cts @@ -0,0 +1,5 @@ +/* eslint-disable no-console */ + +"use strict"; + +console.log("test"); diff --git a/test.mjs b/test.mjs index 2e9548ae..255019d6 100644 --- a/test.mjs +++ b/test.mjs @@ -1,5 +1,5 @@ /* eslint-disable-next-line - import/no-unused-modules + import/no-anonymous-default-export */ export default "test"; diff --git a/test.mts b/test.mts new file mode 100644 index 00000000..60327733 --- /dev/null +++ b/test.mts @@ -0,0 +1,6 @@ +/* + eslint-disable-next-line + import/no-unused-modules, + import/no-anonymous-default-export +*/ +export default "test"; diff --git a/ts.json b/ts.json index 9711618d..233e6980 100644 --- a/ts.json +++ b/ts.json @@ -7,7 +7,16 @@ "overrides": [ { - "files": ["*.ts", "*.tsx", "*.vue"], + "files": [ + "*.ts", + ".*.ts", + "*.tsx", + "*.mts", + ".*.mts", + "*.cts", + ".*.cts", + "*.vue" + ], "extends": [ "plugin:import/typescript", @@ -168,6 +177,45 @@ } }, + { + "files": ["*.cts", ".*.cts"], + + "parserOptions": { + "sourceType": "script" + }, + + "env": { + "commonjs": true + }, + + "rules": { + "import/order": [ + "error", + { + "groups": [ + "builtin", + "external", + "internal", + "unknown", + "parent", + "sibling", + "index" + ], + "newlines-between": "always", + "alphabetize": { + "order": "asc", + "orderImportKind": "asc", + "caseInsensitive": true + } + } + ], + + "unicorn/prefer-module": "off", + "import/no-commonjs": "off", + "import/unambiguous": "off" + } + }, + { "files": [ "**/test/**",