Consider the following code in a "helper" module, which should not contains hooks.
//helpers/helpers.ts
import { useState } from 'react';
export function testLower() {
const [a, setAt] = useState('');
}
export function TestLower() {
const [a, setAt] = useState('');
}
The Eslint Plugin is able to detect, that the code in the lower-case function (testLower) contains a hook and throws a linting error.
But in the TestLower upper-case function - there is no error. This is because it "could" be a component identified by the UpperCase name, I would assume. In this case the hooks plugin does not have a chance of detecting the violation.
Since this slipped our code-review before - I would like to know:
Is there a way to disallow hooks with Eslint in a certain directory or module file in a code base?