How to mark a function as global in PhpStorm?

  • 0
    I have a file with a function. This function must be declared globally, no exports are needed. It is called from a third-party module outside the project.
    function get3PAuthorizationUrls() {
        // ...
    }

    The problem is that the IDE sees that I am not calling this function anywhere and displays a warning:
    Unused function get3PAuthorizationUrls
    How to get rid of this? How do I tell the IDE that I shouldn't call this function, that it should exist and be global?

    I tried adding export
    export function get3PAuthorizationUrls() {
      // ...
    }

    Tried adding global
    tag
    /**
     * @global
     */
    export function get3PAuthorizationUrls() {
      // ...
    }

    But the IDE still swears
    JavaScript Anonymous, Aug 3, 2020

  • 2 Answers
  • 0
    PhpStorm does not swear, but only notifies you of a possible problem.

    The most correct solution is to simply ignore this warning, as the developer knows better.

    If it interferes with your life, then you can disable this check in the Inspections section for this project.

    spoiler
    Anonymous

  • 0
    can be turned off for a specific function or for an entire file:



    https://www.jetbrains.com/help/webstorm/2017.2 / sup ...
    Anonymous

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!