JS.VUE.JSX.USES.VARS

Prevent variables used in JSX to be marked as unused

Since 0.17.0 the ESLint no-unused-vars rule does not detect variables used in JSX (see details (https://eslint.org/blog/2015/03/eslint-0.17.0-released#changes-to-jsxreact-handling)). This rule will find variables used in JSX and mark them as used.

This rule only has an effect when the no-unused-vars rule is enabled.

Rule Details

Without this rule this code triggers warning:

Copy
import HelloWorld from './HelloWorld';

export default {
  render () {
    return (
      <HelloWorld msg="world"/>
    )
  },
};

After turning on, HelloWorld is being marked as used and no-unused-vars rule doesn't report an issue.

When Not To Use It

If you are not using JSX or if you do not use the no-unused-vars rule then you can disable this rule.

The content on this page is adapted from the ESLint User Guide. Copyright © OpenJS Foundation and other contributors, www.openjsf.org. All rights reserved. https://eslint.org/docs/rules/