diff --git a/lint/rules/named-styles.js b/lint/rules/named-styles.js index eeed03bd0..8da64cfff 100644 --- a/lint/rules/named-styles.js +++ b/lint/rules/named-styles.js @@ -6,6 +6,15 @@ module.exports = { codePath.arguments.length < 2 ) { context.report({ + fix: fixer => + fixer.insertTextAfter( + codePath.arguments[0], + `,{ name: "${context + .getFilename() + .split("/") + .slice(-1)[0] + .replace(/\..+/, "")}" }` + ), loc: codePath.callee.loc, messageId: codePath.callee.name === "makeStyles" @@ -17,6 +26,7 @@ module.exports = { } }), meta: { + fixable: "code", messages: { expectedNameHoc: 'withStyles hook should have "name" property.', expectedNameHook: 'makeStyles hook should have "name" property.'