Skip to content
Open
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
7 changes: 3 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ module github.com/web-infra-dev/rslint
go 1.25.0

replace (
github.com/microsoft/typescript-go/shim/api => ./shim/api
github.com/microsoft/typescript-go/shim/api/encoder => ./shim/api/encoder
github.com/microsoft/typescript-go/shim/ast => ./shim/ast
github.com/microsoft/typescript-go/shim/bundled => ./shim/bundled
github.com/microsoft/typescript-go/shim/checker => ./shim/checker
Expand All @@ -18,13 +20,12 @@ replace (
github.com/microsoft/typescript-go/shim/vfs => ./shim/vfs
github.com/microsoft/typescript-go/shim/vfs/cachedvfs => ./shim/vfs/cachedvfs
github.com/microsoft/typescript-go/shim/vfs/osvfs => ./shim/vfs/osvfs
github.com/microsoft/typescript-go/shim/api => ./shim/api
github.com/microsoft/typescript-go/shim/api/encoder => ./shim/api/encoder
)

require (
github.com/bmatcuk/doublestar/v4 v4.9.1
github.com/fatih/color v1.18.0
github.com/microsoft/typescript-go/shim/api/encoder v0.0.0
github.com/microsoft/typescript-go/shim/ast v0.0.0
github.com/microsoft/typescript-go/shim/bundled v0.0.0
github.com/microsoft/typescript-go/shim/checker v0.0.0
Expand All @@ -40,8 +41,6 @@ require (
github.com/microsoft/typescript-go/shim/vfs v0.0.0
github.com/microsoft/typescript-go/shim/vfs/cachedvfs v0.0.0
github.com/microsoft/typescript-go/shim/vfs/osvfs v0.0.0
github.com/microsoft/typescript-go/shim/api v0.0.0
github.com/microsoft/typescript-go/shim/api/encoder v0.0.0
github.com/tailscale/hujson v0.0.0-20250605163823-992244df8c5a
golang.org/x/sync v0.16.0
golang.org/x/sys v0.35.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,27 +80,6 @@ func run(ctx rule.RuleContext, options any) rule.RuleListeners {
return isObjectTypeLiteral(typeNode)
}

// Helper to check if interface is in a globally-scoped module
isInGlobalModule := func(node *ast.Node) bool {
current := node.Parent
for current != nil {
if current.Kind == ast.KindModuleDeclaration {
moduleDecl := current.AsModuleDeclaration()
if moduleDecl != nil && moduleDecl.Name() != nil {
// Check if module name is 'global'
if ast.IsIdentifier(moduleDecl.Name()) {
ident := moduleDecl.Name().AsIdentifier()
if ident != nil && ident.Text == "global" {
return true
}
}
}
}
current = current.Parent
}
return false
}

checkTypeAlias := func(node *ast.Node) {
if opts.Style != DefinitionStyleInterface {
return
Expand Down Expand Up @@ -132,15 +111,6 @@ func run(ctx rule.RuleContext, options any) rule.RuleListeners {
return
}

// Don't fix interfaces in global modules (see typescript-eslint #2707)
if isInGlobalModule(node) {
ctx.ReportNode(node, rule.RuleMessage{
Id: "typeOverInterface",
Description: "Use a type literal instead of an interface.",
})
return
}

ctx.ReportNode(node, rule.RuleMessage{
Id: "typeOverInterface",
Description: "Use a type literal instead of an interface.",
Expand Down
2 changes: 1 addition & 1 deletion packages/rslint-test-tools/rstest.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default defineConfig({
'./tests/typescript-eslint/rules/consistent-indexed-object-style.test.ts',
'./tests/typescript-eslint/rules/consistent-return.test.ts',
// './tests/typescript-eslint/rules/consistent-type-assertions.test.ts',
// './tests/typescript-eslint/rules/consistent-type-definitions.test.ts',
'./tests/typescript-eslint/rules/consistent-type-definitions.test.ts',
'./tests/typescript-eslint/rules/consistent-type-exports.test.ts',
// './tests/typescript-eslint/rules/consistent-type-imports.test.ts',
'./tests/typescript-eslint/rules/default-param-last.test.ts',
Expand Down
Loading