Linter warns about solid/reactivity when calling a SetStoreFunction function outside tracked scope.
To Reproduce
I'm using plugin:solid/typescript in ESLint config.
The code that produces the warning:
// other irrelevant types: GameLogLine, GameLogLineModifiers, GameLogAppender
type GameProps = {
gameLogic: {
executeGuessAsync: (value: string, callback?: (result: boolean) => void) => void
};
log: GameLogLine[];
appendLog: GameLogAppender;
setLog: SetStoreFunction<GameLogLine[]>;
};
export default function Game(props: GameProps) {
let guessInput: HTMLInputElement | undefined;
function guess() {
if (!guessInput || !guessInput.value) return;
const val = guessInput.value;
const id = props.appendLog(val, GameLogLineModifiers.Private);
props.gameLogic.executeGuessAsync(val, (res) => { // This function should be passed to a tracked scope... [solid/reactivity]
const mod = res ? GameLogLineModifiers.Correct : GameLogLineModifiers.Incorrect;
// props.setLog is of type SetStoreFunction<GameLogLine[]>
props.setLog((line) => line.id === id, 'modifiers', mod);
});
}
return (
<>
{/* other JSX removed for simplicity, including the elements displaying the log (props.log) */}
<input type="text" ref={guessInput} />
<button onClick={guess}>Guess</button>
</>
);
}
Expected behavior
No warning.
This is an unnecessary warning and instigates confusion. At least to my knowledge, it is okay to call setters outside tracked scope, the getters are the ones that need tracking. Please correct me if mistaken.
Environment (please complete the following information):
OS: Windows 11
Node version: v18.14.1
eslint-plugin-solid version: v0.12.0
eslint version: v8.36.0
Additional context
[ ] I would be willing to contribute a PR to fix this issue
Describe the bug
Linter warns about solid/reactivity when calling a SetStoreFunction function outside tracked scope.
To Reproduce
I'm using
plugin:solid/typescript
in ESLint config.The code that produces the warning:
Expected behavior
No warning.
This is an unnecessary warning and instigates confusion. At least to my knowledge, it is okay to call setters outside tracked scope, the getters are the ones that need tracking. Please correct me if mistaken.
Environment (please complete the following information):
eslint-plugin-solid
version: v0.12.0eslint
version: v8.36.0Additional context