Telegram-Mini-Apps / telegram-apps

Made from scratch TypeScript packages, examples and documentation you will surely need to start developing on Telegram Mini Apps.
https://docs.telegram-mini-apps.com/
MIT License
693 stars 191 forks source link

Eslint compains on initialising eruda in react-sdk 2.x template #518

Closed Neiz-Kap closed 3 weeks ago

Neiz-Kap commented 3 weeks ago

My eslint complains on these 3 lines

https://github.com/Telegram-Mini-Apps/telegram-apps/blob/c57d93c474d2d0b2861d1bb3ab99f24957af15cd/playgrounds/react/src/init.ts#L37

Error message: Expected an assignment or function call and instead saw an expression.eslint[@typescript-eslint/no-unused-expressions](https://typescript-eslint.io/rules/no-unused-expressions)

Full code:

debug && import('eruda')
    .then((lib) => lib.default.init())
    .catch(console.error);

Suggestion to do:

if (debug) {
  (async () => {
    try {
      const lib = await import('eruda');
      lib.default.init();
    } catch (error) {
      console.error(error);
    }
  })();
}
heyqbnk commented 3 weeks ago

You can ignore these warnings as long as playgrounds are just for test purposes.

Also, I don't have this issue:

image

There are also no similar warnings running the command:

eslint playgrounds/react/src/**/*