Javascript: Warn on optional chaining

Hi,

we are struggling with the usage of too modern features in javascript: They work fine on our dev's machines but fail on old devices in the real world.

For example: optional chaining ("x?.SomeProperty").

Is there some kind of setting or add-in to create a warning when this operator is used?

Thank you!

0
6 comments

Unfortunately, there are no built-in settings for that. 

 

> fail on old devices in the real world

Which JavaScript version is used there?

0

> Which JavaScript version is used there?

That's a pretty good question. To be honest, I have no idea.

I only have our application's error-reporting: We do get a syntax-error from Safari 15.1.2 from optional chaining (the iPhone 6 supporting only this was produced until 2018, an we cannot exclude a 4 year old phone).

I found the option to set the ecma-version and also the option to choose a custom file. This made me hope that we can patch some predefined file and disallow the features we do not want to have. But I did not find any information about the required file's format.

Could this approach lead to anything?

0

Please see https://www.jetbrains.com/help/webstorm/javascript-specific-guidelines.html#ws_js_choose_language_version_multiple_versions. There are no custom files, you can just indicate a path to a part of the project and select a JS version.

0

Ah, now I understand the purpose of this. Thank you!

0

One more question:

The choice of ECMA-versions is pretty outdated.

Are you guys planning to add the more recent versions?

Compare it to eslint (https://eslint.org/play)


0

Please sign in to leave a comment.