lynt removed all typecast type assertions
See original GitHub issueWhen I ran npm run lynt --typescript --fix
lynt removed type assertions from across the app.
For example:
const abc: HTMLFormElement = <HTMLFormElement>nativeElement.querySelector('.xyz');
became
const abc: HTMLFormElement = nativeElement.querySelector('.xyz');
I couldn’t find any rule in my tslint.json
that requested this change.
I suspect some rule did this, but I couldn’t find it in my tslint.json. Please comment if you know 🙇
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
typescript-eslint/consistent-type-assertions.md at main - GitHub
This rule aims to standardize the use of type assertion style across the codebase. Keeping to one syntax consistently helps with code readability....
Read more >non-nullable-type-assertion-style - TypeScript ESLint
Enforce non-null assertions over explicit type casts. Extending "plugin:@typescript-eslint/strict" in an ESLint configuration enables this rule. Some problems ...
Read more >How to assert a type of an HTMLElement in TypeScript?
A type assertion is like a type cast in other languages, but performs no special checking or restructuring of data.
Read more >Why You Should Avoid Type Assertions in TypeScript
Add Linting rules to disable Type Assertions This is where linting can be very useful by giving us visual feedback in our code...
Read more >Type assertions (related to casting) • Tackling TypeScript
This chapter is about type assertions in TypeScript, which are related to type casts in other languages and performed via the as operator....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This rule has been removed entirely as of
v0.5.0
. Release notes: https://github.com/saadq/lynt/releases/tag/v0.5.0I think you’re correct about
'no-unnecessary-type-assertion'
I removed the line'no-unnecessary-type-assertion': true,
fromnode_modules/lynt/lib/tslint/config.js
(manual hack) and re-ran thenpm run lynt
(pacagke.json command has --typescript --fix) and it no longer removed the type assertions! Your file: https://github.com/saadq/lynt/blob/master/src/tslint/config.ts#L80ps – using
lynt
removed about 300 unused imports in our codebase ❤️ 🙌 ❤️pps - After
lynt
removed the unused imports, it left behind some blank lines, resulting in errors when I was running our regular linter: it complainedno-consecutive-blank-lines
. Sorry to overload this issue – please let me know if you’d like me to open a new issue with just this comment 👍