Skip to content

Commit 2f9f3e0

Browse files
Merge upstream main and preserve both character replacements
2 parents 8226595 + 0ba8fd3 commit 2f9f3e0

48 files changed

Lines changed: 1421 additions & 78 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎CONTRIBUTING.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ There are different types of replacements available:
5656
When using the `documented` type, you should generally follow these guidelines:
5757

5858
- The mapping should have a `url` which points to an e18e documentation page (i.e. those in the [modules](https://github.com/e18e/module-replacements/tree/main/docs/modules) directory of the repo) which describes the replacement and how to migrate to it. Documentation here will be automatically synced weekly to the e18e website.
59+
- The documentation page should open with a one sentence reason under the title, prefixed with a bold `**Motivation:**` label, explaining why the module is being replaced (e.g. it is deprecated, no longer maintained, or the same job can now be done natively or with fewer dependencies)
5960
- The replacement does not necessarily need a `url` itself
6061
- The replacement does not need a `description`
6162

@@ -68,7 +69,7 @@ When using the `native` type:
6869

6970
When using the `simple` type:
7071

71-
- The replacement should be of the form `snippet::{name}` where `name` is a suitable descriptive name for what the snippet does (e.g. `snippet:is-odd` for a snippet that checks if a number is odd)
72+
- The replacement should be of the form `snippet::{name}` where `name` is a suitable descriptive name for what the snippet does (e.g. `snippet::is-odd` for a snippet that checks if a number is odd)
7273
- The replacement description should be a short human-readable description of what the snippet does, and how it replaces the old module (e.g. "You can use arr.at(-1) to get the last element of an array")
7374
- The replacement should have an `example` which is purely code (i.e. it should be valid JS in its entirety) and should show the snippet
7475

‎docs/modules/bcrypt.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Modern alternatives to the bcrypt package for password hashing
44

55
# Replacements for `bcrypt`
66

7-
The `bcrypt` package can be replaced by native functionality in most runtimes, or more performant packages.
7+
**Motivation:** The `bcrypt` package can be replaced by native functionality in most runtimes, or more performant packages.
88

99
## `bcryptjs`
1010

‎docs/modules/better-auth-cli.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ description: Modern alternative to the @better-auth/cli package for the Better A
44

55
# Replacements for `@better-auth/cli`
66

7+
**Motivation:** Better Auth deprecated `@better-auth/cli` and now publishes its CLI as `auth`.
8+
79
## `auth`
810

911
The Better Auth CLI is now published under the `auth` name, and `@better-auth/cli` is deprecated, so switch the dependency over.

‎docs/modules/classnames.md‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
description: Modern alternatives to the classnames package for building CSS class strings
3+
---
4+
5+
# Replacements for `classnames`
6+
7+
`classnames` builds a `className` string from strings, objects and arrays. `clsx` takes the same arguments and is a smaller drop-in replacement.
8+
9+
## `clsx`
10+
11+
[`clsx`](https://github.com/lukeed/clsx) has no dependencies and ships both ESM and CommonJS builds. It accepts the same strings, objects, arrays and falsy values, so in most code only the import changes:
12+
13+
```ts
14+
import classNames from 'classnames' // [!code --]
15+
import { clsx } from 'clsx' // [!code ++]
16+
17+
const className = classNames('btn', { 'btn-active': isActive }, extra) // [!code --]
18+
const className = clsx('btn', { 'btn-active': isActive }, extra) // [!code ++]
19+
```
20+
21+
`clsx` also has a default export, so `import clsx from 'clsx'` works too.
22+
23+
If you only ever pass strings, `clsx/lite` is even smaller. It ignores objects and arrays, so `clsx('btn', { active: true })` from `clsx/lite` returns `'btn'`.
24+
25+
A few things work differently:
26+
27+
- `classnames` calls a custom `toString()` on objects that define one. `clsx` treats every object as a map of class names, so an object with its own `toString` method becomes `'toString'` and a class instance with a `toString` method becomes `''`. Convert such values with `String(value)` before passing them.
28+
- `classnames/dedupe` and `classnames/bind` have no `clsx` equivalent. For CSS modules, look up the names yourself, for example `clsx(styles.btn, isActive && styles.active)`.

‎docs/modules/cli-builders.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ description: Modern alternatives to packages for building CLI applications
99
[`sade`](https://github.com/lukeed/sade) is a small but powerful tool for building CLI applications for Node.js
1010

1111
```ts
12+
import process from 'node:process'
1213
import sade from 'sade'
1314

1415
const prog = sade('my-cli')

‎docs/modules/cpx.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ description: Modern alternatives to the cpx package for copying file globs with
44

55
# Replacements for `cpx`
66

7+
**Motivation:** `cpx` hasn't had a release since 2016 and has bugs and performance issues that are fixed by its replacement
8+
79
## `cpx2`
810

911
[`cpx`](https://github.com/mysticatea/cpx) is unmaintained. [`cpx2`](https://github.com/bcomnes/cpx2) is an actively maintained fork that keeps the same CLI bin name (`cpx`), so it works as a drop-in replacement for CLI usage. For the Node API, switch your import to `cpx2`.

‎docs/modules/crypto-js.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Modern alternatives to the `crypto-js` package for cryptographic op
44

55
# Replacements for `crypto-js`
66

7-
`crypto-js` is no longer actively maintained and has been discontinued since engines now come with this functionality built-in.
7+
**Motivation:** `crypto-js` is no longer actively maintained and has been discontinued since engines now come with this functionality built-in.
88

99
## `node:crypto` (native, Node.js built-in)
1010

‎docs/modules/css-loader.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Modern alternatives to the css-loader package
44

55
# Replacements for `css-loader`
66

7-
`css-loader` is deprecated. webpack parses CSS itself, so the loader can be dropped from your config along with `style-loader` and `mini-css-extract-plugin`.
7+
**Motivation:** `css-loader` is deprecated. webpack parses CSS itself, so the loader can be dropped from your config along with `style-loader` and `mini-css-extract-plugin`.
88

99
## Built-in CSS support
1010

‎docs/modules/dotenv.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ It throws if the file is missing. Defaults to `.env` in the current working dire
1212

1313
```ts
1414
import dotenv from 'dotenv' // [!code --]
15+
import process from 'node:process' // [!code ++]
1516
1617
dotenv.config({ path: '.env' }) // [!code --]
1718
process.loadEnvFile('.env') // [!code ++]
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
description: Modern alternatives to eslint-plugin-jsx-a11y for accessibility linting of JSX
3+
---
4+
5+
# Replacements for `eslint-plugin-jsx-a11y`
6+
7+
**Motivation:** `eslint-plugin-jsx-a11y` still supports very old ESLint and Node versions, which pulls in far more dependencies than it needs.
8+
9+
## `eslint-plugin-jsx-a11y-x`
10+
11+
[`eslint-plugin-jsx-a11y-x`](https://github.com/eslint-community/eslint-plugin-jsx-a11y-x) is a fork of [`eslint-plugin-jsx-a11y`](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y) with far fewer dependencies and full support for flat config and ESLint v10.
12+
13+
> [!NOTE]
14+
> `eslint-plugin-jsx-a11y-x` is still being modernised, so treat it as experimental for now.
15+
16+
Rename the import, use `configs` instead of `flatConfigs`, and change the rule prefix from `jsx-a11y/` to `jsx-a11y-x/`:
17+
18+
<!-- prettier-ignore -->
19+
```ts
20+
import jsxA11y from 'eslint-plugin-jsx-a11y' // [!code --]
21+
import jsxA11yX from 'eslint-plugin-jsx-a11y-x' // [!code ++]
22+
23+
export default [
24+
{
25+
files: ['**/*.{jsx,tsx}'],
26+
...jsxA11y.flatConfigs.recommended, // [!code --]
27+
...jsxA11yX.configs.recommended, // [!code ++]
28+
rules: {
29+
...jsxA11y.flatConfigs.recommended.rules, // [!code --]
30+
...jsxA11yX.configs.recommended.rules, // [!code ++]
31+
'jsx-a11y/no-autofocus': 'off', // [!code --]
32+
'jsx-a11y-x/no-autofocus': 'off' // [!code ++]
33+
},
34+
settings: {
35+
'jsx-a11y': { components: { Image: 'img' } }, // [!code --]
36+
'jsx-a11y-x': { components: { Image: 'img' } } // [!code ++]
37+
}
38+
}
39+
]
40+
```
41+
42+
> [!NOTE]
43+
> Settings under the old `jsx-a11y` key are ignored without a warning, so make sure to rename that key too. The deprecated `accessible-emoji`, `label-has-for` and `no-onchange` rules no longer exist and should be removed. See [the migration notes](https://github.com/eslint-community/eslint-plugin-jsx-a11y-x#migrating-from-eslint-plugin-jsx-a11y) for the full list.
44+
45+
## Oxlint
46+
47+
[Oxlint](https://oxc.rs/docs/guide/usage/linter.html) is a high-performance linter for JavaScript and TypeScript, built on the Rust-based `Oxc` compiler stack. It has ported [all of the non-deprecated `eslint-plugin-jsx-a11y` rules](https://github.com/oxc-project/oxc/issues/1141).
48+
49+
The migration process from ESLint is covered in [the Oxlint documentation](https://oxc.rs/docs/guide/usage/linter/migrate-from-eslint.html), and can be done automatically from an ESLint flat config using [`npx @oxlint/migrate`](https://github.com/oxc-project/oxlint-migrate).

0 commit comments

Comments
 (0)