ESLint Rule
Prevents calling anonymous tuple mode inside functions/components.
Why is it needed?
createRxState(defaultValue)creates a new store every time it is called. It is safe to export and use at the module top level, but calling it inside a React component may create a new store on every render path.
ESLint flat config
js
const globalRxState = require("@byeolnaerim/global-rx-state/eslint-rules");
module.exports = [
{
plugins: {
"global-rx-state": globalRxState,
},
rules: {
"global-rx-state/no-tuple-global-rx-state-in-function": "error",
},
},
];Legacy rulesdir
bash
eslint src --rulesdir node_modules/@byeolnaerim/global-rx-state/eslint-rules