From 3369e551dc68525ac082d8392960524e0fa5cb8c Mon Sep 17 00:00:00 2001 From: Munieru <20086673+munierujp@users.noreply.github.com> Date: Sun, 21 Apr 2024 02:26:05 +0900 Subject: [PATCH 1/4] Support .mjs/.cjs/.mts/.cts --- index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/index.js b/index.js index 87f1d168..b5e0d51d 100644 --- a/index.js +++ b/index.js @@ -22,6 +22,8 @@ const config = { { files: [ '*.js', + '*.mjs', + '*.cjs', '*.jsx' ], extends: [ @@ -32,6 +34,8 @@ const config = { { files: [ '*.ts', + '*.mts', + '*.cts', '*.tsx' ], plugins: [ From 721715187bf993788c20025e6e94e65122742b33 Mon Sep 17 00:00:00 2001 From: Munieru <20086673+munierujp@users.noreply.github.com> Date: Sun, 21 Apr 2024 02:27:38 +0900 Subject: [PATCH 2/4] Add example files --- example/example.cjs | 12 ++++++++++++ example/example.cts | 11 +++++++++++ example/example.mjs | 12 ++++++++++++ example/example.mts | 11 +++++++++++ 4 files changed, 46 insertions(+) create mode 100644 example/example.cjs create mode 100644 example/example.cts create mode 100644 example/example.mjs create mode 100644 example/example.mts diff --git a/example/example.cjs b/example/example.cjs new file mode 100644 index 00000000..b083c706 --- /dev/null +++ b/example/example.cjs @@ -0,0 +1,12 @@ +// Try ESLint on this file + +/** + * @param {string} userName - user name + * @returns {void} + */ +const sayHello = (userName) => { + console.log(`Hello, ${userName}`) +} + +const myName = 'Alice' +sayHello(myName) diff --git a/example/example.cts b/example/example.cts new file mode 100644 index 00000000..f6c4fef7 --- /dev/null +++ b/example/example.cts @@ -0,0 +1,11 @@ +// Try ESLint on this file + +/** + * @param userName - user name + */ +const sayHello = (userName: string): void => { + console.log(`Hello, ${userName}`) +} + +const myName = 'Alice' +sayHello(myName) diff --git a/example/example.mjs b/example/example.mjs new file mode 100644 index 00000000..b083c706 --- /dev/null +++ b/example/example.mjs @@ -0,0 +1,12 @@ +// Try ESLint on this file + +/** + * @param {string} userName - user name + * @returns {void} + */ +const sayHello = (userName) => { + console.log(`Hello, ${userName}`) +} + +const myName = 'Alice' +sayHello(myName) diff --git a/example/example.mts b/example/example.mts new file mode 100644 index 00000000..f6c4fef7 --- /dev/null +++ b/example/example.mts @@ -0,0 +1,11 @@ +// Try ESLint on this file + +/** + * @param userName - user name + */ +const sayHello = (userName: string): void => { + console.log(`Hello, ${userName}`) +} + +const myName = 'Alice' +sayHello(myName) From 9abbf574f8fcf745d937111256925cf78e7ad910 Mon Sep 17 00:00:00 2001 From: Munieru <20086673+munierujp@users.noreply.github.com> Date: Sun, 21 Apr 2024 02:29:53 +0900 Subject: [PATCH 3/4] Update files --- .eslintrc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index 620f2f1c..c18879ae 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -14,7 +14,7 @@ const config = { overrides: [ // https://typescript-eslint.io/troubleshooting/#i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file { - files: ['./**/*.js'], + files: ['./**/*.{js,mjs,cjs,jsx}'], extends: ['plugin:@typescript-eslint/disable-type-checked'] } ] From 5f0d87f136b78e9a2dfa57544457a1b3a18bfea7 Mon Sep 17 00:00:00 2001 From: Munieru <20086673+munierujp@users.noreply.github.com> Date: Sun, 21 Apr 2024 02:29:59 +0900 Subject: [PATCH 4/4] Update lint script --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4ff0a81c..3d9eaf2f 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "47.0.0", "description": "Recommended ESLint Shareable Config for TypeScript", "scripts": { - "lint": "eslint '**/*.{js,ts}'", + "lint": "eslint '**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx}'", "prepublishOnly": "npm run lint" }, "files": [