Skip to content

Add TypeScript ESLint rules: dot-notation, explicit-member-accessibility, max-params, member-ordering, no-unnecessary-type-assertion #201

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 34 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
eadb04f
feat(rules): add new TypeScript ESLint rules implementation
ScriptedAlchemy Aug 7, 2025
ec62979
Add TypeScript ESLint rules: dot-notation, explicit-member-accessibil…
ScriptedAlchemy Aug 7, 2025
385113a
Update API and fix dot-notation rule implementation
ScriptedAlchemy Aug 7, 2025
d2fc809
feat: improve dot-notation rule implementation and add comprehensive …
ScriptedAlchemy Aug 8, 2025
609739c
feat: update dot-notation rule implementation and test snapshots
ScriptedAlchemy Aug 8, 2025
bc4ac1c
feat(dot-notation): improve template literal pattern matching and rul…
ScriptedAlchemy Aug 8, 2025
24b0bc1
feat(linter): add languageOptions support for TypeScript parser
ScriptedAlchemy Aug 8, 2025
7c86205
Update internal/rules/member_ordering/member_ordering.go
ScriptedAlchemy Aug 8, 2025
2729904
fix: improve Go code quality by addressing golangci-lint issues
ScriptedAlchemy Aug 8, 2025
d33a608
fix: apply go fmt formatting fixes
ScriptedAlchemy Aug 8, 2025
e90bebe
fix: remove unused functions to address golangci-lint warnings
ScriptedAlchemy Aug 8, 2025
62ca3e6
chore: update project files
ScriptedAlchemy Aug 8, 2025
c39fdec
fix: address remaining golangci-lint QF1003 and unconvert issues
ScriptedAlchemy Aug 8, 2025
0d8c6bf
fix: remove unused functions to resolve golangci-lint warnings
ScriptedAlchemy Aug 8, 2025
d86526e
fix: remove remaining unused functions in explicit_member_accessibili…
ScriptedAlchemy Aug 8, 2025
df2665c
fix: convert if-else to switch statement in member_ordering.go
ScriptedAlchemy Aug 8, 2025
5a0a457
fix: improve tagged switch to address QF1002 staticcheck warning
ScriptedAlchemy Aug 8, 2025
2fdf072
fix: add nolint directive for false positive staticcheck warning
ScriptedAlchemy Aug 8, 2025
c423078
Fix API to handle project as string or array - member ordering now wo…
ScriptedAlchemy Aug 8, 2025
558344a
Add debug logging to member-ordering rule to diagnose ordering issues
ScriptedAlchemy Aug 8, 2025
de4a098
fix: Add languageOptions.parserOptions.project support to Go rule tester
ScriptedAlchemy Aug 8, 2025
c3f360c
test: update snapshots for dot-notation and member-ordering
ScriptedAlchemy Aug 8, 2025
36b74aa
test: update snapshots; align dot-notation ranges and refine member-o…
ScriptedAlchemy Aug 8, 2025
4aa30c2
test(dot-notation): update invalid 12 snapshot start column to 4 to m…
ScriptedAlchemy Aug 8, 2025
dd7a11c
Merge remote-tracking branch 'origin/main' into rule-batch-3
ScriptedAlchemy Aug 8, 2025
b504ff2
feat(rules): refine dot-notation range ordering; re-enable constructo…
ScriptedAlchemy Aug 8, 2025
cf3c2db
chore(scripts): add sync-tse-rules.mjs to fetch missing typescript-es…
ScriptedAlchemy Aug 8, 2025
cad423e
fix(explicit-member-accessibility): report on node directly for corre…
ScriptedAlchemy Aug 8, 2025
47208db
fix: resolve CI linting issues
ScriptedAlchemy Aug 9, 2025
c18cc95
fix: remove unused function and fix empty branch
ScriptedAlchemy Aug 9, 2025
41d2136
fix: resolve spell check issues
ScriptedAlchemy Aug 9, 2025
a24653d
Delete .trae/TODO.md
ScriptedAlchemy Aug 9, 2025
0b611a6
Merge origin/main into rule-batch-3
ScriptedAlchemy Aug 12, 2025
16de55a
chore: update typescript-go submodule pointer
ScriptedAlchemy Aug 12, 2025
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
28 changes: 22 additions & 6 deletions cmd/rslint/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"fmt"
"os"
"strings"
"sync"

"github.com/microsoft/typescript-go/shim/ast"
Expand All @@ -20,6 +21,10 @@ import (
"github.com/web-infra-dev/rslint/internal/rules/array_type"
"github.com/web-infra-dev/rslint/internal/rules/await_thenable"
"github.com/web-infra-dev/rslint/internal/rules/class_literal_property_style"
"github.com/web-infra-dev/rslint/internal/rules/dot_notation"
"github.com/web-infra-dev/rslint/internal/rules/explicit_member_accessibility"
"github.com/web-infra-dev/rslint/internal/rules/max_params"
"github.com/web-infra-dev/rslint/internal/rules/member_ordering"
"github.com/web-infra-dev/rslint/internal/rules/no_array_delete"
"github.com/web-infra-dev/rslint/internal/rules/no_base_to_string"
"github.com/web-infra-dev/rslint/internal/rules/no_confusing_void_expression"
Expand Down Expand Up @@ -111,6 +116,10 @@ func (h *IPCHandler) HandleLint(req api.LintRequest) (*api.LintResponse, error)
array_type.ArrayTypeRule,
await_thenable.AwaitThenableRule,
class_literal_property_style.ClassLiteralPropertyStyleRule,
dot_notation.DotNotationRule,
explicit_member_accessibility.ExplicitMemberAccessibilityRule,
max_params.MaxParamsRule,
member_ordering.MemberOrderingRule,
no_array_delete.NoArrayDeleteRule,
no_base_to_string.NoBaseToStringRule,
no_confusing_void_expression.NoConfusingVoidExpressionRule,
Expand Down Expand Up @@ -163,14 +172,21 @@ func (h *IPCHandler) HandleLint(req api.LintRequest) (*api.LintResponse, error)
option interface{}
}
rulesWithOptions := []RuleWithOption{}
// filter rule based on request.RuleOptions
// Filter rules based on request.RuleOptions, supporting both short and plugin-prefixed names
if len(req.RuleOptions) > 0 {
// Build a map from short name -> option by trimming any prefix like "@typescript-eslint/"
shortOpts := map[string]interface{}{}
for key, opt := range req.RuleOptions {
short := key
if idx := strings.LastIndexByte(key, '/'); idx >= 0 {
short = key[idx+1:]
}
shortOpts[short] = opt
}

for _, r := range origin_rules {
if option, ok := req.RuleOptions[r.Name]; ok {
rulesWithOptions = append(rulesWithOptions, RuleWithOption{
rule: r,
option: option,
})
if option, ok := shortOpts[r.Name]; ok {
rulesWithOptions = append(rulesWithOptions, RuleWithOption{rule: r, option: option})
}
}
}
Expand Down
8 changes: 8 additions & 0 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ import (
"github.com/web-infra-dev/rslint/internal/rules/array_type"
"github.com/web-infra-dev/rslint/internal/rules/await_thenable"
"github.com/web-infra-dev/rslint/internal/rules/class_literal_property_style"
"github.com/web-infra-dev/rslint/internal/rules/dot_notation"
"github.com/web-infra-dev/rslint/internal/rules/explicit_member_accessibility"
"github.com/web-infra-dev/rslint/internal/rules/max_params"
"github.com/web-infra-dev/rslint/internal/rules/member_ordering"
"github.com/web-infra-dev/rslint/internal/rules/no_array_delete"
"github.com/web-infra-dev/rslint/internal/rules/no_base_to_string"
"github.com/web-infra-dev/rslint/internal/rules/no_confusing_void_expression"
Expand Down Expand Up @@ -271,6 +275,10 @@ func RegisterAllTypeScriptEslintPluginRules() {
GlobalRuleRegistry.Register("@typescript-eslint/array-type", array_type.ArrayTypeRule)
GlobalRuleRegistry.Register("@typescript-eslint/await-thenable", await_thenable.AwaitThenableRule)
GlobalRuleRegistry.Register("@typescript-eslint/class-literal-property-style", class_literal_property_style.ClassLiteralPropertyStyleRule)
GlobalRuleRegistry.Register("@typescript-eslint/dot-notation", dot_notation.DotNotationRule)
GlobalRuleRegistry.Register("@typescript-eslint/explicit-member-accessibility", explicit_member_accessibility.ExplicitMemberAccessibilityRule)
GlobalRuleRegistry.Register("@typescript-eslint/max-params", max_params.MaxParamsRule)
GlobalRuleRegistry.Register("@typescript-eslint/member-ordering", member_ordering.MemberOrderingRule)
GlobalRuleRegistry.Register("@typescript-eslint/no-array-delete", no_array_delete.NoArrayDeleteRule)
GlobalRuleRegistry.Register("@typescript-eslint/no-base-to-string", no_base_to_string.NoBaseToStringRule)
GlobalRuleRegistry.Register("@typescript-eslint/no-confusing-void-expression", no_confusing_void_expression.NoConfusingVoidExpressionRule)
Expand Down
Loading
Loading