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'] } ] 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) 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: [ 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": [