Suppressing eslint warning for global variable

I’m using a library for logging called ‘loglevel’ for a custom app. Its a simple file that I include as follows:

<script src="../scripts/loglevel.min.js"></script>

When I run fdk validate after including this library, I get following two warnings:

> % fdk validate
Please ensure that the following are addressed for quick review process.
[WARN] app/scripts/loglevel.min.js::4: 'j' declared and assigned in different scopes. Possible asynchronous race condition.
[WARN] app/scripts/loglevel.min.js::4: 'b' declared and assigned in different scopes. Possible asynchronous race condition.

Validation Successful

I don’t think this is a valid race condition and since I don’t want to re-write the library to suppress this warning, i would like to suppress the warning thru eslint rules.

I tried this rule but it has no effect:

/*eslint require-atomic-updates: off*/

Does anyone know how I can suppress this warning in this file only? I would like not to have it print warnings all the time so I don’t accidentally miss real problems…

Hi Steve

Good day!

Would you please try replacing the existing script inside scripts folder with a CDN link ? UNPKG - loglevel. That might prevent getting the warnings for the library.

I am not sure on how to suppress the warning using eslint. I will leave that part to others :slightly_smiling_face:

2 Likes

Hi @stevemc,
As @banu suggested we would recommend to use the external library with the CDN link
this will solve the warnings.

FYI: you can’t suppress the warning from FDK.

Thanks

1 Like

This topic was automatically closed 6 days after the last reply. New replies are no longer allowed.