lintcn 0.9.0 → 0.10.0

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/CHANGELOG.md +25 -0
  2. package/package.json +5 -3
package/CHANGELOG.md CHANGED
@@ -1,3 +1,28 @@
1
+ ## 0.10.0
2
+
3
+ 1. **New rule: `prefer-is-truthy` (error)** — errors on inline nullable type guards passed directly to `filter`. When the callback parameter is already `T | null | undefined`, prefer a reusable `isTruthy` helper over an ad hoc predicate at the call site:
4
+
5
+ ```ts
6
+ // flagged — ad hoc inline type guard
7
+ const active = pokemon.filter(
8
+ (value): value is Pokemon => value !== null,
9
+ )
10
+
11
+ // preferred — reusable helper
12
+ const active = pokemon.filter(isTruthy)
13
+ ```
14
+
15
+ Standalone reusable guards, filter callbacks without a type predicate, and other callback sites are exempt.
16
+
17
+ 2. **`no-type-assertion` no longer warns when the source is `any` or `unknown`** — assertions from `any` or `unknown` are now silently allowed since they're the standard pattern for untyped or narrowing contexts. Warnings are still emitted when a typed value is cast to `any`, `unknown`, or an unrelated concrete type:
18
+
19
+ ```ts
20
+ const x = response.data as User // allowed when response.data is `any`
21
+ const y = value as unknown // still warned — escaping a typed value
22
+ ```
23
+
24
+ 3. **`no-unsafe-unknown` aligns with `no-type-assertion`** — casts from `unknown` into a concrete target type no longer warn (that's a normal narrowing pattern). Warnings are kept for explicit `unknown` targets and assertions that embed `unknown` in a larger type like `Promise<unknown>`.
25
+
1
26
  ## 0.9.0
2
27
 
3
28
  1. **New rule: `no-redundant-exported-return-type` (warn)** — warns when exported APIs keep spelling `ReturnType<typeof ...>` even though the function already returns a public named type. This keeps public types direct and easier to read:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lintcn",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "type": "module",
5
5
  "description": "The shadcn for type-aware TypeScript lint rules. Browse, pick, and copy rules into your project.",
6
6
  "bin": "dist/cli.js",
@@ -52,6 +52,8 @@
52
52
  "devDependencies": {
53
53
  "@types/node": "^22.0.0",
54
54
  "@types/tar": "^7.0.87",
55
+ "rimraf": "^6.0.1",
56
+ "tsx": "^4.20.6",
55
57
  "typescript": "5.8.2"
56
58
  },
57
59
  "dependencies": {
@@ -60,7 +62,7 @@
60
62
  "tar": "^7.5.12"
61
63
  },
62
64
  "scripts": {
63
- "build": "rm -rf dist *.tsbuildinfo && tsc && chmod +x dist/cli.js",
64
- "cli": "tsx src/cli"
65
+ "build": "tsc && chmod +x dist/cli.js",
66
+ "cli": "tsx src/cli.ts"
65
67
  }
66
68
  }