Add rule fixer

This commit is contained in:
dominik-zeglen 2019-12-03 16:23:42 +01:00
parent 1f89bccd9f
commit 9a1ef2ba40

View file

@ -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.'