Skip to content

Commit

Permalink
feat: Enable .ts imports
Browse files Browse the repository at this point in the history
  • Loading branch information
jhnns committed Jan 27, 2025
1 parent 839e69c commit 781a4a9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 2 additions & 0 deletions eslint/presets/typescript-react.test/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useEffect, useRef, useState } from "react";
import { Other } from "./Other.tsx";

export const App = (_props: { name: string; count: number }) => {
for (let index = 0; index < 10; index++) {
Expand Down Expand Up @@ -28,6 +29,7 @@ export const App = (_props: { name: string; count: number }) => {
{"Hello world"}
{/* eslint-disable-next-line @eslint-react/no-leaked-conditional-rendering */}
<>{_props.count && <view />}</>
<Other />
</>
);
};
Expand Down
2 changes: 1 addition & 1 deletion eslint/presets/typescript.test/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getMessage } from "./message.js";
import { getMessage } from "./message.ts";
// Check if import attributes are detected and formatted correctly
import test from "./test.json" with { type: "json" };

Expand Down
14 changes: 8 additions & 6 deletions typescript/base.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
{
"compilerOptions": {
"allowImportingTsExtensions": true,
"checkJs": true,
// TODO: Enable erasableSyntaxOnly when TS 5.8 is released
// https://www.totaltypescript.com/erasable-syntax-only
// "erasableSyntaxOnly": true,
"esModuleInterop": true,
// We decided to turn off `exactOptionalPropertyTypes` because it's too strict
// by complaining about too much unproblematic code. We may revisit this decision later.
// We decided to turn off `exactOptionalPropertyTypes` because it's too strict
"exactOptionalPropertyTypes": false,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
Expand All @@ -15,13 +19,11 @@
"noPropertyAccessFromIndexSignature": true,
"noUncheckedIndexedAccess": true,
"resolveJsonModule": true,
"rewriteRelativeImportExtensions": true,
"skipLibCheck": true,
"strict": true,
"target": "ESNext"
// TODO: Turn on the following settings once TS 5.7 is released, see also https://nodejs.org/docs/latest/api/typescript.html#typescript-features
// "allowImportingTsExtensions": true,
// "rewriteRelativeImportExtensions": true,
// "verbatimModuleSyntax": true
"target": "ESNext",
"verbatimModuleSyntax": true
},
"$schema": "https://json.schemastore.org/tsconfig"
}

0 comments on commit 781a4a9

Please sign in to comment.