eslint-plugin-no-blank-lines-in-function
v1.0.4
Published
ESLint plugin to prevent blank lines inside functions
Maintainers
Readme
eslint-plugin-no-blank-lines-in-function
An ESLint plugin that prevents blank lines inside function bodies to maintain compact, readable code.
Installation
npm install eslint-plugin-no-blank-lines-in-function --save-devUsage
Using the recommended configuration
{
"extends": ["plugin:no-blank-lines-in-function/recommended"]
}Manual configuration
Add the plugin to your .eslintrc configuration:
{
"plugins": ["no-blank-lines-in-function"],
"rules": {
"no-blank-lines-in-function/no-blank-lines-in-function": "error"
}
}Rule Details
This rule disallows blank lines inside function bodies for:
- Function declarations
- Function expressions
- Arrow functions
- Class methods
Examples
Incorrect:
function example() {
const a = 1;
const b = 2;
return a + b;
}Correct:
function example() {
const a = 1;
const b = 2;
return a + b;
}Auto-fixing
This rule supports ESLint's --fix option to automatically remove blank lines inside functions.
eslint --fix your-file.jsDevelopment
# Install dependencies
npm install
# Run tests
npm test
# Run tests in watch mode
npm run test:watchLicense
MIT - feel free to use this however you want.
