8000 Move meta object into exported object · github/eslint-plugin-github@840bffe · GitHub
[go: up one dir, main page]

Skip to content

Commit 840bffe

Browse files
committed
Move meta object into exported object
1 parent d29a24c commit 840bffe

File tree

1 file changed

+24
-22
lines changed

1 file changed

+24
-22
lines changed

lib/rules/get-attribute.js

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,30 @@ function isValidAttribute(name) {
1717
return validSVGAttributeSet.has(name) || (validAttributeName.test(name) && !invalidSVGAttributeSet.has(name))
1818
}
1919

20-
module.exports = function(context) {
21-
return {
22-
CallExpression(node) {
23-
if (!node.callee.property) return
24-
25-
const calleeName = node.callee.property.name
26-
if (!attributeCalls.test(calleeName)) return
27-
28-
const attributeNameNode = node.arguments[0]
29-
if (!attributeNameNode) return
30-
31-
if (!isValidAttribute(attributeNameNode.value)) {
32-
context.report({
33-
meta: {
34-
fixable: 'code'
35-
},
36-
node: attributeNameNode,
37-
message: 'Attributes should be lowercase and hyphen separated, or part of the SVG whitelist.',
38-
fix(fixer) {
39-
return fixer.replaceText(attributeNameNode, `'${attributeNameNode.value.toLowerCase()}'`)
40-
}
41-
})
20+
module.exports = {
21+
meta: {
22+
fixable: 'code'
23+
},
24+
create(context) {
25+
return {
26+
CallExpression(node) {
27+
if (!node.callee.property) return
28+
29+
const calleeName = node.callee.property.name
30+
if (!attributeCalls.test(calleeName)) return
31+
32+
const attributeNameNode = node.arguments[0]
33+
if (!attributeNameNode) return
34+
35+
if (!isValidAttribute(attributeNameNode.value)) {
36+
context.report({
37+
node: attributeNameNode,
38+
message: 'Attributes should be lowercase and hyphen separated, or part of the SVG whitelist.',
39+
fix(fixer) {
40+
return fixer.replaceText(attributeNameNode, `'${attributeNameNode.value.toLowerCase()}'`)
41+
}
42+
})
43+
}
4244
}
4345
}
4446
}

0 commit comments

Comments
 (0)
0