Skip to content
This repository has been archived by the owner on Dec 30, 2023. It is now read-only.

Commit

Permalink
Initial release
Browse files Browse the repository at this point in the history
  • Loading branch information
christianvuerings committed Oct 16, 2023
0 parents commit 3ba98f9
Show file tree
Hide file tree
Showing 19 changed files with 7,490 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/jest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Jest

on:
pull_request:
branches:
- main
merge_group:
push:
branches:
- main

jobs:
knip:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false
- uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"
cache: "npm"
- name: Install dependencies
run: |
npm install
- name: Run jest
run: |
npm run test
29 changes: 29 additions & 0 deletions .github/workflows/pretier.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Prettier

on:
pull_request:
branches:
- main
merge_group:
push:
branches:
- main

jobs:
knip:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false
- uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"
cache: "npm"
- name: Install dependencies
run: |
npm install
- name: Run prettier
run: |
npx prettier --check .
29 changes: 29 additions & 0 deletions .github/workflows/tsc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: TypeScript Compiler

on:
pull_request:
branches:
- main
merge_group:
push:
branches:
- main

jobs:
knip:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false
- uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"
cache: "npm"
- name: Install dependencies
run: |
npm install
- name: Run tsc
run: |
npx tsc
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist/
node_modules/
3 changes: 3 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.prettierrc
jest.config.js
src
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"printWidth": 100
}
55 changes: 55 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# `eslint-plugin-no-re-export`

[![npm version](https://badge.fury.io/js/eslint-plugin-no-re-export.svg)](https://badge.fury.io/js/eslint-plugin-no-re-export)
[![Build Status](https://travis-ci.org/azu/eslint-plugin-no-re-export.svg?branch=master)](https://travis-ci.org/azu/eslint-plugin-no-re-export)

Disallow re-exporting in TypeScript/JavaScript.

## Installation

```sh
# npm
npm install eslint-plugin-no-re-export --save-dev

# yarn
yarn add eslint-plugin-no-re-export --dev

# bun
bun install eslint-plugin-no-re-export --save-dev
```

## Usage

Add `no-re-export` to the plugins section of your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix:

```json
{
"plugins": ["no-re-export"]
}
```

Then configure the rules you want to use under the rules section.

```json
{
"rules": {
"no-re-export/no-re-export": "error"
}
}
```

## Rules

| Rule ID | Description |
|:--------|:------------|
| [no-re-export](./src/docs/no-re-export.md) | disallow re-exporting in TypeScript/JavaScript |

## References

- [Speeding up the JavaScript ecosystem - The barrel file debacle](https://marvinh.dev/blog/speeding-up-javascript-ecosystem-part-7/) by @marvinhagemeister
- [Burn the Barrel!](https://uglow.medium.com/burn-the-barrel-c282578f21b6#:~:text=%E2%80%9CThe%20problem%20is%20that%20Jest,like%20%40mui%2Fmaterial%20.%E2%80%9D) by @uglow
- [Your Next.js Bundle Will Thank You](https://renatopozzi.me/articles/your-nextjs-bundle-will-thank-you) by @askides
- [Barrel files in JavaScript](https://flaming.codes/posts/barrel-files-in-javascript) by @flaming-codes
- Comment by @ljharb at [eslint-plugin-import/issues/1920](https://github.com/import-js/eslint-plugin-import/issues/1920)

> Barrel exports increase bundle size and memory footprint, and are the only reason treeshaking is needed (to only-partially clean up sloppy importing), and in my experience, are best avoided, especially in any codebase of significant scale/size.
24 changes: 24 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// @ts-check

/** @type {import('jest').Config} */
module.exports = {
projects: [
{
moduleDirectories: ["node_modules", "src"],
transform: {
"^.+\\.[jt]sx?$": [
"esbuild-jest",
{
sourcemap: true,
},
],
},
testEnvironment: "node",
},
],
clearMocks: true,
restoreMocks: true,
resetMocks: true,
verbose: true,
watchman: false,
};

0 comments on commit 3ba98f9

Please sign in to comment.