no-map-without-usage reports false positives for class property initializers
See original GitHub issueHello and thank you for your work.
Example
class Example {
numbers: number[] = [1, 2, 3].map(x => x + 1); // Error
}
Expected result
No error — the result of mapping is assigned to a class property.
Actual result
Return value from Array.map should be assigned to a variable. Consider using Array.forEach instead. (no-map-without-usage)
Usage
tslint-clean-code@0.2.3
tslint@5.9.1
typescript@2.7.1
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Property initialization false positive ... - GitHub
Just trying out psalm and one of the very common things that psalm wrongly reports is this: ERROR: MixedPropertyTypeCoercion ...
Read more >Property Initializers: What, Why, and How to Use It - ITNEXT
The new class “property initializers” allows you to define methods (or any property) in your React components using regular ES6 classes ...
Read more >Use Property Initializers for Cleaner React Components
With property initializers We can declare state outside of the constructor() at the top of the component, like this: class CounterApp extends ...
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
@Glavin001 I couldn’t make it this week, let me try tomorrow 👍
@Glavin001 Sure, I can do that 👍