Skip to content
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

feat(no-unlocalized-strings): add ignoreMethodsOnTypes option #58

Merged
merged 3 commits into from
Oct 11, 2024

Conversation

timofei-iatsenko
Copy link
Collaborator

@timofei-iatsenko timofei-iatsenko commented Oct 11, 2024

fixes: #38
related: #50

Leverage power of Typescript to exclude methods defined on specific types.

The method to exclude defined as a Type.method. Where type and method matched by name.

Examples of correct code for the { "ignoreMethodsOnTypes": ["Foo.bar"], "useTsTypes": true } option:

interface Foo {
  get: (key: string) => string
}

const foo: Foo

foo.get('string with a spaces')

By default, the following methods ate ignored: Map.get, Map.has, Set.has

Copy link

codecov bot commented Oct 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.91%. Comparing base (27cd472) to head (ac8a34f).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #58      +/-   ##
==========================================
+ Coverage   94.96%   95.91%   +0.94%     
==========================================
  Files          10       10              
  Lines         477      490      +13     
  Branches      156      160       +4     
==========================================
+ Hits          453      470      +17     
+ Misses         24       20       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

docs/rules/no-unlocalized-strings.md Outdated Show resolved Hide resolved
docs/rules/no-unlocalized-strings.md Outdated Show resolved Hide resolved
docs/rules/no-unlocalized-strings.md Outdated Show resolved Hide resolved
@andrii-bodnar andrii-bodnar merged commit b36edbf into main Oct 11, 2024
4 checks passed
@andrii-bodnar andrii-bodnar deleted the ignore-methods-on-type branch October 11, 2024 14:57
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.

no-unlocalized-strings should ignore string keys for dereferencing object values
2 participants