Skip to content

Commit 3292434

Browse files
committed
fix(eslint-config): update TypeScript declaration file type from "d.ts" to "types"
- Changed the file type identifier for TypeScript declaration files in the ESLint configuration from "d.ts" to "types" for consistency. - Updated the `getFilesGlobs` function to reflect this change, ensuring proper handling of TypeScript declaration files. - Modified related documentation in README.md to align with the new file type naming.
1 parent b8f5a94 commit 3292434

File tree

3 files changed

+6
-29
lines changed

3 files changed

+6
-29
lines changed

packages/eslint-config/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ The `getFilesGlobs` function accepts one of the following `FileType` strings:
620620
- `"astro_ts"`: TypeScript files within Astro components.
621621
- `"astro"`: Astro component files (`.astro`).
622622
- `"css"`: CSS files.
623-
- `"d.ts"`: TypeScript declaration files (`.d.ts`, `.d.cts`, `.d.mts`).
623+
- `"types"`: TypeScript declaration files (`.d.ts`, `.d.cts`, `.d.mts`).
624624
- `"e2e"`: End-to-end test files.
625625
- `"graphql"`: GraphQL files (`.gql`, `.graphql`).
626626
- `"html"`: Various HTML-like template files (`.html`, `.hbs`, `.erb`, etc.).

packages/eslint-config/src/config/plugins/imports.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ export default createConfig<OptionsCwd & OptionsFiles & OptionsOverrides & Optio
340340
},
341341
},
342342
{
343-
files: getFilesGlobs("d.ts"),
343+
files: getFilesGlobs("types"),
344344
name: "anolilab/imports/d.ts-rules",
345345
rules: {
346346
"import/no-duplicates": "off",

packages/eslint-config/src/utils/create-config.ts

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,7 @@
11
import type { TypedFlatConfigItem } from "../types";
22

33
type FileType =
4-
| "all"
5-
| "astro_ts"
6-
| "astro"
7-
| "css"
8-
| "d.ts"
9-
| "e2e"
10-
| "graphql"
11-
| "html"
12-
| "js_and_ts"
13-
| "js"
14-
| "jsx_and_tsx"
15-
| "less"
16-
| "markdown_in_markdown"
17-
| "markdown_inline_js_jsx"
18-
| "markdown"
19-
| "postcss"
20-
| "scss"
21-
| "storybook"
22-
| "svg"
23-
| "toml"
24-
| "ts"
25-
| "vitest"
26-
| "xml"
27-
| "yaml";
4+
"all" | "astro_ts" | "astro" | "css" | "e2e" | "graphql" | "html" | "js_and_ts" | "js" | "jsx_and_tsx" | "less" | "markdown_in_markdown" | "markdown_inline_js_jsx" | "markdown" | "postcss" | "scss" | "storybook" | "svg" | "toml" | "ts" | "types" | "vitest" | "xml" | "yaml";
285

296
// @see https://devblogs.microsoft.com/typescript/announcing-typescript-4-5-beta/#new-file-extensions
307
const dtsGlobal = ["**/*.d.ts", "**/*.d.cts", "**/*.d.mts"];
@@ -48,9 +25,6 @@ export const getFilesGlobs = (fileType: FileType): string[] => {
4825
case "css": {
4926
return ["**/*.css"];
5027
}
51-
case "d.ts": {
52-
return dtsGlobal;
53-
}
5428
case "e2e": {
5529
return ["**/e2e/**/*.test.{js,ts,jsx,tsx}"];
5630
}
@@ -111,6 +85,9 @@ export const getFilesGlobs = (fileType: FileType): string[] => {
11185
case "ts": {
11286
return [...tsGlobal, ...dtsGlobal, ...tsxGlobal];
11387
}
88+
case "types": {
89+
return dtsGlobal;
90+
}
11491
case "vitest": {
11592
return ["**/__tests__/**/*.?(c|m)[jt]s?(x)", "**/?(*.){test,spec}.?(c|m)[jt]s?(x)"];
11693
}

0 commit comments

Comments
 (0)