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 warning on unsupported methods missing object name

See original GitHub issue

It looks like the plugin can’t identify the unsupported use of a method call that doesn’t include the class name:

'string'.repeat(5); // false negative
new String().repeat(5); // ! ESLint: String.repeat() is not supported in IE 11 (compat/compat)

In this case the first use of repeat() is not flagged as incompatible with IE, while the second one is. Is there a way to flag any use of incompatible methods on string literals?


EDIT: changed the above to reflect the much clearer rewrite by @HansBrende in the comment below. Original:

It looks like the plugin can’t identify the unsupported use of a method call that doesn’t include the object name:

image

In this case the first use of repeat() is not flagged as incompatible with IE, while the second one is. Is there a way to flag any use of incompatible methods?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:6
  • Comments:7

github_iconTop GitHub Comments

2reactions
gabriele-cannizzarocommented, Feb 7, 2022

@HansBrende thank you for the rewrite, that makes it indeed much clearer. Re-reading my original post and the thread I was obviously confusing things 😃

2reactions
diegocrcommented, Nov 11, 2020

Same here…someone at my team used the es2021’s replaceAll() method and there was no warning thrown from ESLint, the code ended up in production and disaster happened…

Moreover, i have just tried that String.repeat(5) here and i am not even getting a warning, nothing, which is very odd…using latest public releases of every npm package at time of writing. 🤔

May i ask what’s your config @gabriele-cannizzaro ? Here’s my browserlist and config

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues · amilajack/eslint-plugin-compat - GitHub
DataTransfer Constructor not detected for browsers like IE 10. #509 opened on Jan 30 by orosro ... No warning on unsupported methods missing...
Read more >
KB5014754—Certificate-based authentication changes on ...
Before the May 10, 2022 security update, certificate-based authentication would not account for a dollar sign ($) at the end of a machine...
Read more >
What is the list of valid @SuppressWarnings warning names ...
It depends on your IDE or compiler. Here is a list for Eclipse Galileo: all to suppress all warnings; boxing to suppress warnings...
Read more >
NIM error and warning messages - IBM
Enter lsnim -O ObjectName for a list of valid operations that can be applied to the object. Message, 0042-027. Explanation, The specified object...
Read more >
using-final-decorator-in-unsupported-version / W2602 - Pylint
using-final-decorator-in-unsupported-version / W2602#. Message emitted: typing.final is not supported by all versions included in the py-version setting.
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