question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

no-map-without-usage reports false positives for class property initializers

See original GitHub issue

Hello 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:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
karol-majewskicommented, Feb 25, 2018

@Glavin001 I couldn’t make it this week, let me try tomorrow 👍

1reaction
karol-majewskicommented, Feb 21, 2018

@Glavin001 Sure, I can do that 👍

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found