Skip to content

feat: implement '@typescript/no-non-null-assertion'#217

Merged
hardfist merged 6 commits intoweb-infra-dev:mainfrom
betterhyq:feature_hyq-main-rslint-20250810-no_non_null_assertion
Aug 11, 2025
Merged

feat: implement '@typescript/no-non-null-assertion'#217
hardfist merged 6 commits intoweb-infra-dev:mainfrom
betterhyq:feature_hyq-main-rslint-20250810-no_non_null_assertion

Conversation

@betterhyq
Copy link
Copy Markdown
Contributor

Summary

This PR implements three TypeScript ESLint rules for the rslint project:

1. @typescript-eslint/no-non-null-assertion

TypeScript's ! non-null assertion operator asserts to the type system that an expression is non-nullable, as in not null or undefined. Using assertions to tell the type system new information is often a sign that code is not fully type-safe. It's generally better to structure program logic so that TypeScript understands when values may be nullable.

interface Example {
  property?: string;
}

declare const example: Example;
const includesBaz = example.property!.includes('baz');

Test Coverage

  • ✅ All TypeScript tests passing
  • ✅ All Go unit tests passing
  • ✅ Integration tests with rslint CLI
  • ✅ Edge cases and error conditions covered

Quality Checks

  • ✅ Go vet and fmt compliance
  • ✅ Golangci-lint static analysis passing
  • ✅ TypeScript type checking
  • ✅ ESLint and formatting checks
  • ✅ CI pipeline validation

@hardfist
Copy link
Copy Markdown
Contributor

thanks! if you met any test runner problems, please let me know

@hardfist hardfist merged commit c854ced into web-infra-dev:main Aug 11, 2025
4 checks passed
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@holyfata this is wrong test path it should be ./tests/typescript-eslint/rules/no-non-null-assertion.test.ts, so the test is actually not running, I have to revert this

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

BTW why do you 2email for pr?

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.

2 participants