Skip to content

Instantly share code, notes, and snippets.

View dgcoffman's full-sized avatar

Daniel Coffman dgcoffman

View GitHub Profile
@dgcoffman
dgcoffman / require-named-effect.js
Created May 23, 2022 16:16
libs/eslint-rules/require-named-effect.js
const isUseEffect = (node) => node.callee.name === 'useEffect';
const argumentIsArrowFunction = (node) => node.arguments[0].type === 'ArrowFunctionExpression';
const effectBodyIsSingleFunction = (node) => {
const { body } = node.arguments[0];
// It's a single unwrapped function call:
// `useEffect(() => theNameOfAFunction(), []);`
if (body.type === 'CallExpression') {
{
"telemetry.telemetryLevel": "off",
"nxConsole.enableTelemetry": false,
"editor.fontLigatures": true,
"editor.fontFamily": "Fira Code",
"editor.fontSize": 16,
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true,
"workbench.editor.enablePreview": false,
"editor.renderWhitespace": "all",