Skip to content

Conversation

@nnnnoel
Copy link
Contributor

@nnnnoel nnnnoel commented Sep 9, 2025

Closes #195

@graphite-app
Copy link

graphite-app bot commented Sep 9, 2025

How to use the Graphite Merge Queue

Add the label 0-merge to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

@camc314
Copy link
Contributor

camc314 commented Sep 11, 2025

@nnnnoel feel free to just patch the typescript-go submodule rather than having to wait for typescript-go changes

Ref: microsoft/typescript-go#1707

example patch: https://github.com/oxc-project/tsgolint/blob/10689510989fcec60c895ff3d1871822501bc442/patches/0001-Parallel-readDirectory-visitor.patch#L0-L1

@nnnnoel
Copy link
Contributor Author

nnnnoel commented Sep 12, 2025

@camc314 I applied patch and added test cases for implemented rule

@auvred
Copy link
Collaborator

auvred commented Sep 12, 2025

FYI: gen_shims allows reexporting private struct fieds using ExtraFields:

"ExtraFields": {
"Type": [
"alias",
"flags",
"symbol",
"objectFlags"
],

type extra_Type struct {
flags checker.TypeFlags
objectFlags checker.ObjectFlags
id checker.TypeId
symbol *ast.Symbol
alias *checker.TypeAlias
checker *checker.Checker
data checker.TypeData
}
func Type_alias(v *checker.Type) *checker.TypeAlias {
return ((*extra_Type)(unsafe.Pointer(v))).alias
}
func Type_flags(v *checker.Type) checker.TypeFlags {
return ((*extra_Type)(unsafe.Pointer(v))).flags
}
func Type_symbol(v *checker.Type) *ast.Symbol {
return ((*extra_Type)(unsafe.Pointer(v))).symbol
}
func Type_objectFlags(v *checker.Type) checker.ObjectFlags {
return ((*extra_Type)(unsafe.Pointer(v))).objectFlags
}

@nnnnoel
Copy link
Contributor Author

nnnnoel commented Sep 12, 2025

@auvred Thanks, I changed to consistent way to access private struct

@camc314
Copy link
Contributor

camc314 commented Sep 16, 2025

I tried some test cases from typescript-eslint and they report errors when they shouldn't? How did you port the test cases across?

--- FAIL: TestStrictBooleanExpressionsRule (10.86s)
    --- FAIL: TestStrictBooleanExpressionsRule/valid-0 (0.05s)
        /Users/cameron/github/oxc-project/tsgolint/internal/rules/strict_boolean_expressions/rule_tester.go:115: Expected valid test case not to contain errors. Code:
            declare const foo: boolean & { __BRAND: 'Foo' };
            if (foo) {
            }
        /Users/cameron/github/oxc-project/tsgolint/internal/rules/strict_boolean_expressions/rule_tester.go:117: error 1 - (53-56) Unexpected mixed type in conditional. The constituent types do not have a best common type.

https://github.com/typescript-eslint/typescript-eslint/blob/0a0a085229523cc6510f3ffb011d7fd93d83045a/packages/eslint-plugin/tests/rules/strict-boolean-expressions.test.ts#L469-L473

@nnnnoel
Copy link
Contributor Author

nnnnoel commented Sep 16, 2025

Oh, I just requested to Claude code port test file to golang, looks not fine.
I'll try to fix it ASAP.

@nnnnoel nnnnoel marked this pull request as draft September 16, 2025 16:13
@Boshen Boshen mentioned this pull request Sep 18, 2025
@nnnnoel nnnnoel force-pushed the feat/strict-boolean-expressions branch 2 times, most recently from 405ad77 to d8afb96 Compare September 30, 2025 03:07
@nnnnoel nnnnoel marked this pull request as ready for review September 30, 2025 03:07
@nnnnoel
Copy link
Contributor Author

nnnnoel commented Oct 1, 2025

@camc314 I've migrated all ts tests to go, and passed all cases.

@camc314 camc314 force-pushed the feat/strict-boolean-expressions branch from aa3a0df to 8b89542 Compare October 23, 2025 13:20
Copy link
Contributor

@camc314 camc314 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

@camc314 camc314 enabled auto-merge (squash) October 23, 2025 13:21
@camc314 camc314 merged commit 703ff8d into oxc-project:main Oct 23, 2025
5 checks passed
@Perdolique
Copy link

I suppose in the main README, it should be marked as done as well? 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[strict-boolean-expressions](https://typescript-eslint.io/rules/strict-boolean-expressions)

5 participants