Created
October 6, 2023 16:15
-
-
Save kezzico/1fbc02d25f3ad4a6caf4e8170d3b1e97 to your computer and use it in GitHub Desktop.
This file contains 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: 'layout', // Specify the rule type ('problem', 'suggestion', or 'layout') | |
fixable: 'whitespace', // Allow ESLint to fix the issues automatically | |
}, | |
create: function (context) { | |
return { | |
FunctionDeclaration(node) { | |
const params = node.params; | |
for (let i = 1; i < params.length; i++) { | |
if (params[i].loc.start.line === params[i - 1].loc.end.line) { | |
context.report({ | |
node: params[i], | |
message: 'Add a newline between function parameters.', | |
fix: function (fixer) { | |
return fixer.insertTextAfter(params[i - 1], '\n'); | |
}, | |
}); | |
} | |
} | |
}, | |
}; | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment