Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support more extensions (.mjs/.cjs/.mts/.cts) #352

Merged
merged 4 commits into from
Apr 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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']
}
]
Expand Down
12 changes: 12 additions & 0 deletions example/example.cjs
Original file line number Diff line number Diff line change
@@ -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)
11 changes: 11 additions & 0 deletions example/example.cts
Original file line number Diff line number Diff line change
@@ -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)
12 changes: 12 additions & 0 deletions example/example.mjs
Original file line number Diff line number Diff line change
@@ -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)
11 changes: 11 additions & 0 deletions example/example.mts
Original file line number Diff line number Diff line change
@@ -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)
4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ const config = {
{
files: [
'*.js',
'*.mjs',
'*.cjs',
'*.jsx'
],
extends: [
Expand All @@ -32,6 +34,8 @@ const config = {
{
files: [
'*.ts',
'*.mts',
'*.cts',
'*.tsx'
],
plugins: [
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down