-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat: [4.7] support new extensions #5027
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
Changes from all commits
b654707
b561a5a
e34a00e
d02f76c
8e3bec4
9203072
2a509b5
e2620c5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"*.{ts,js,json,md}": [ | ||
"*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}": [ | ||
"prettier --write" | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,12 +4,24 @@ | |
|
||
import { AST_NODE_TYPES, TSESLint, TSESTree } from '@typescript-eslint/utils'; | ||
import { requiresQuoting } from '@typescript-eslint/type-utils'; | ||
import * as ts from 'typescript'; | ||
|
||
const DEFINITION_EXTENSIONS = [ | ||
ts.Extension.Dts, | ||
ts.Extension.Dcts, | ||
ts.Extension.Dmts, | ||
] as const; | ||
/** | ||
* Check if the context file name is *.d.ts or *.d.tsx | ||
*/ | ||
function isDefinitionFile(fileName: string): boolean { | ||
return /\.d\.tsx?$/i.test(fileName || ''); | ||
const lowerFileName = fileName.toLowerCase(); | ||
for (const definitionExt of DEFINITION_EXTENSIONS) { | ||
if (lowerFileName.endsWith(definitionExt)) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: you could |
||
} | ||
|
||
/** | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,8 +33,8 @@ | |
"postbuild": "downlevel-dts dist _ts3.4/dist", | ||
"clean": "tsc -b tsconfig.build.json --clean", | ||
"postclean": "rimraf dist && rimraf _ts3.4 && rimraf coverage", | ||
"format": "prettier --write \"./**/*.{ts,js,json,md}\" --ignore-path ../../.prettierignore", | ||
"lint": "eslint . --ext .js,.ts --ignore-path='../../.eslintignore'", | ||
"format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unless I'm missing something, we can use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we did this to control the files that get formatted... I forget exactly - it's been so long! |
||
"lint": "eslint . --ignore-path='../../.eslintignore'", | ||
"typecheck": "tsc -p tsconfig.json --noEmit" | ||
}, | ||
"dependencies": { | ||
|
Uh oh!
There was an error while loading. Please reload this page.