Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions lint/rules/no-commonjs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
tags: []
---

Disallows CommonJS export assignments through `exports` and `module.exports`.

Use ECMAScript module exports instead. For a named export, declare or export the
binding with `export`; for a default export, use `export default`.

**Invalid:**

```typescript
exports.answer = 42;
module.exports = function answer() {
return 42;
};
module.exports.answer = 42;
```

**Valid:**

```typescript
export const answer = 42;

export default function answer() {
return 42;
}
```
Loading