Skip to content

Commit ea9702c

Browse files
committed
Forbid default import from "typescript"
1 parent 93e28e6 commit ea9702c

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

eslint.config.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,16 @@ export default tseslint.config(
5656
},
5757
},
5858
rules: {
59+
"no-restricted-syntax": [
60+
"error",
61+
// Forbid default import from "typescript"
62+
{
63+
message: 'Default import from "typescript" is not allowed.',
64+
selector:
65+
'ImportDeclaration[source.value="typescript"] > ImportDefaultSpecifier',
66+
},
67+
],
68+
5969
// These off-by-default rules work well for this repo and we like them on.
6070
"logical-assignment-operators": [
6171
"error",

src/types/typeGuards/single.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as ts from "typescript";
22
import { describe, expect, expectTypeOf, it } from "vitest";
3+
34
import { createSourceFileAndTypeChecker } from "../../test/utils";
45
import {
56
isConditionalType,

0 commit comments

Comments
 (0)