ESLint: Disallow calling a function with only one argument in the code

  no-restricted-syntax:  # see
    - error
    - message: Please don't use useMediaQuery(query) . Use useMediaQuery2(query) instead
      selector: CallExpression['useMediaQuery'][arguments.length=1]

  • All code that calls useMediaQuery(query) will be marked as error
  • Your useMediaQuery2 may be still calling useMediaQuery , but it will call it with more than one arguments. So it is still valid

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.