Created
May 27, 2020 15:53
-
-
Save matiasfha/2c150a928c6141592fff05261a7c79be to your computer and use it in GitHub Desktop.
A example rule for a basic eslint plugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
meta: { | |
type: "suggestion", | |
docs: { | |
description: "Force Async function naming convention", | |
category: "Possible Errors", | |
recommended: true, | |
}, | |
}, | |
create: function (context) { | |
return { | |
FunctionDeclaration(node) { | |
console.log(node); | |
if (node.async && !/Async$/.test(node.id.name)) { | |
context.report({ | |
node, | |
message: "Async function name must end in 'Async'", | |
}); | |
} | |
}, | |
}; | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment