Add rule fixer
This commit is contained in:
parent
1f89bccd9f
commit
9a1ef2ba40
1 changed files with 10 additions and 0 deletions
|
@ -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.'
|
||||
|
|
Loading…
Reference in a new issue