https://github.com/armaanas/deno-lint-plugin-no-empty-function
Deno lint plugin that disallows empty function bodies.
https://github.com/armaanas/deno-lint-plugin-no-empty-function
deno
Last synced: 4 months ago
JSON representation
Deno lint plugin that disallows empty function bodies.
- Host: GitHub
- URL: https://github.com/armaanas/deno-lint-plugin-no-empty-function
- Owner: ArmaanAS
- Created: 2025-02-25T21:41:40.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-05T08:57:46.000Z (over 1 year ago)
- Last Synced: 2025-04-12T04:54:42.792Z (about 1 year ago)
- Topics: deno
- Language: TypeScript
- Homepage: https://jsr.io/@armaanas/no-empty-function
- Size: 15.6 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# no-empty-function-plugin
A Deno lint plugin that disallows empty function bodies.
## Rule Details
This rule flags any function declarations, function expressions, or arrow functions that have empty bodies. Empty function bodies often indicate incomplete implementations or dead code.
## Installation
```json
// deno.json
{
"lint": {
"plugins": ["jsr:@armaanas/no-empty-function@0.3.0"]
}
}
```
## ❌ Invalid Examples
```js
function foo() {}
const bar = function* () {};
const baz = () => {};
class Example {
constructor() {}
foo() {}
}
```
```txt
error[no-empty-function-rule/no-empty-function]: Empty function body
--> /home/user/deno/lint/example.ts:1:16
|
1 | function foo() {}
| ^^
= hint: Add code or comment to the empty function body
```
## ✅ Valid Examples
```js
function foo() {
return true;
}
const bar = function () {
return "node".split("").sort().join("");
};
const baz = () => 42;
class Example {
constructor() {
this.foo = 3.14;
}
}
function foo1() {
/* no-op */
}
```