@friendsoftheweb/eslint-plugin 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +32 -0
  2. package/package.json +2 -1
package/README.md CHANGED
@@ -10,6 +10,38 @@ yarn add -D @friendsoftheweb/eslint-plugin
10
10
 
11
11
  ### Recommended Rules
12
12
 
13
+ #### `friendsoftheweb/ban-chalk`
14
+
15
+ Enforces using `styleText` from `node:util` instead of the `chalk` package.
16
+
17
+ This rule helps remove the `chalk` dependency by replacing it with the built-in
18
+ `styleText` utility available in Node.js 20+.
19
+
20
+ ##### Examples
21
+
22
+ ❌ **Incorrect:**
23
+
24
+ ```javascript
25
+ import chalk from 'chalk';
26
+
27
+ chalk.red('error');
28
+ chalk.bold.red('error');
29
+ ```
30
+
31
+ ✅ **Correct:**
32
+
33
+ ```javascript
34
+ import { styleText } from 'node:util';
35
+
36
+ styleText('red', 'error');
37
+ styleText(['bold', 'red'], 'error');
38
+ ```
39
+
40
+ **Note:** This rule provides automatic fixes for default imports and most
41
+ usages. Chained styles (e.g. `chalk.bold.red`) are converted to an array of
42
+ formats. Named imports (e.g. `import { red } from 'chalk'`) are flagged but
43
+ require manual migration.
44
+
13
45
  #### `friendsoftheweb/ban-lodash-import`
14
46
 
15
47
  Enforces importing functions from `lodash-es` instead of `lodash`.
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "repository": {
4
4
  "url": "git+https://github.com/friendsoftheweb/eslint-plugin.git"
5
5
  },
6
- "version": "0.0.4",
6
+ "version": "0.0.5",
7
7
  "type": "module",
8
8
  "license": "MIT",
9
9
  "packageManager": "yarn@4.12.0",
@@ -24,6 +24,7 @@
24
24
  "test": "node --experimental-strip-types test/index.ts",
25
25
  "types:check": "tsc --noEmit",
26
26
  "lint": "eslint",
27
+ "format": "prettier --write .",
27
28
  "format:check": "prettier --check .",
28
29
  "build": "rm -rf dist && rollup --config rollup.config.mjs && tsc -p tsconfig.build.json",
29
30
  "publish": "npm publish --access public",