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
|
codePath.arguments.length < 2
|
||||||
) {
|
) {
|
||||||
context.report({
|
context.report({
|
||||||
|
fix: fixer =>
|
||||||
|
fixer.insertTextAfter(
|
||||||
|
codePath.arguments[0],
|
||||||
|
`,{ name: "${context
|
||||||
|
.getFilename()
|
||||||
|
.split("/")
|
||||||
|
.slice(-1)[0]
|
||||||
|
.replace(/\..+/, "")}" }`
|
||||||
|
),
|
||||||
loc: codePath.callee.loc,
|
loc: codePath.callee.loc,
|
||||||
messageId:
|
messageId:
|
||||||
codePath.callee.name === "makeStyles"
|
codePath.callee.name === "makeStyles"
|
||||||
|
@ -17,6 +26,7 @@ module.exports = {
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
meta: {
|
meta: {
|
||||||
|
fixable: "code",
|
||||||
messages: {
|
messages: {
|
||||||
expectedNameHoc: 'withStyles hook should have "name" property.',
|
expectedNameHoc: 'withStyles hook should have "name" property.',
|
||||||
expectedNameHook: 'makeStyles hook should have "name" property.'
|
expectedNameHook: 'makeStyles hook should have "name" property.'
|
||||||
|
|
Loading…
Reference in a new issue