1

Does anyone know how to resolve this linting issue? It's claiming that I'm not using the TasksComponent. Thanks!

'TasksComponent' is assigned a value but never used. (no-unused-vars)

describe('root tests', () => {

    it('renders without crashing', () => {
        const TasksComponent = TasksWithData(Tasks);
        const root = document.createElement('root');
        ReactDOM.render(<TasksComponent {...taskconfig} />, root);
        ReactDOM.unmountComponentAtNode(root);
    });

});

This is my .eslintrc file:

module.exports = {
    "env": {
        "browser": true,
        "es6": true,
        "jest": true
    },
    "extends": "eslint:recommended",
    "parserOptions": {
        "ecmaFeatures": {
            "experimentalObjectRestSpread": true,
            "jsx": true
        },
        "sourceType": "module"
    },
    "plugins": [
        "react"
    ],
    "rules": {
        "indent": [
            "error",
            4
        ],
        "quotes": [
            "warn",
            "single"
        ],
        "semi": [
            "error",
            "always"
        ]
    }
};
briang
  • 91
  • 10
  • Does this answer your question? [ESLint with React gives \`no-unused-vars\` errors](https://stackoverflow.com/questions/42541559/eslint-with-react-gives-no-unused-vars-errors) – fregante Apr 25 '20 at 10:17

1 Answers1

2

Do you have the rules

jsx-uses-vars and jsx-uses-react

Added to your eslint config?

I think those should fix your problem.

Wayrex
  • 2,027
  • 1
  • 14
  • 25