lintcn 0.8.0 → 0.9.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,43 @@
1
+ ## 0.9.0
2
+
3
+ 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:
4
+
5
+ ```ts
6
+ export interface User {
7
+ id: string
8
+ }
9
+
10
+ export function getUser(): User {
11
+ return { id: '1' }
12
+ }
13
+
14
+ export type UserResult = ReturnType<typeof getUser> // warned
15
+ ```
16
+
17
+ Use the named type directly instead:
18
+
19
+ ```ts
20
+ export type UserResult = User
21
+ ```
22
+
23
+ 2. **New rule: `no-redundant-contextual-parameter-type` (error)** — errors when an inline callback repeats a parameter type that TypeScript already knows from the surrounding API. This removes annotation noise without losing type safety:
24
+
25
+ ```ts
26
+ declare function useRunner(fn: (ctx: { command: string }) => void): void
27
+
28
+ useRunner((ctx: { command: string }) => {
29
+ ctx.command
30
+ })
31
+ ```
32
+
33
+ Preferred:
34
+
35
+ ```ts
36
+ useRunner((ctx) => {
37
+ ctx.command
38
+ })
39
+ ```
40
+
1
41
  ## 0.8.0
2
42
 
3
43
  1. **Diagnostic output now shows `warning` / `error` prefix** — each diagnostic header now includes an explicit severity label so warnings are clear in non-color terminals and CI logs:
package/dist/cache.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const DEFAULT_TSGOLINT_VERSION = "4e4666c284d3b5cf7fa082523a369ef507e4360c";
1
+ export declare const DEFAULT_TSGOLINT_VERSION = "427f872946bb413f0e21cff585b6139c986c89d3";
2
2
  /** Validate version string to prevent path traversal attacks.
3
3
  * Only allows alphanumeric chars, dots, underscores, and hyphens. */
4
4
  export declare function validateVersion(version: string): void;
package/dist/cache.js CHANGED
@@ -16,7 +16,7 @@ import { execAsync } from "./exec.js";
16
16
  // Pinned tsgolint fork commit — updated with each lintcn release.
17
17
  // Uses remorses/tsgolint fork which adds internal/runner.Run() and
18
18
  // TSGOLINT_SNAPSHOT_CWD env var for cwd-relative test snapshots.
19
- export const DEFAULT_TSGOLINT_VERSION = '4e4666c284d3b5cf7fa082523a369ef507e4360c';
19
+ export const DEFAULT_TSGOLINT_VERSION = '427f872946bb413f0e21cff585b6139c986c89d3';
20
20
  // Pinned typescript-go base commit from microsoft/typescript-go (before patches).
21
21
  // Patches from tsgolint/patches/ are applied on top during setup.
22
22
  // Must be updated when DEFAULT_TSGOLINT_VERSION changes.
package/dist/cli.js CHANGED
@@ -49,10 +49,9 @@ cli
49
49
  if (options.listFiles) {
50
50
  passthroughArgs.push('--list-files');
51
51
  }
52
- // pass through anything after --
53
- const doubleDash = options['--'];
54
- if (doubleDash && Array.isArray(doubleDash)) {
55
- passthroughArgs.push(...doubleDash);
52
+ // pass through anything after -- (goke 6.6.0 always types this as string[])
53
+ if (options['--'].length > 0) {
54
+ passthroughArgs.push(...options['--']);
56
55
  }
57
56
  const exitCode = await lint({
58
57
  rebuild: !!options.rebuild,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lintcn",
3
- "version": "0.8.0",
3
+ "version": "0.9.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",
@@ -56,7 +56,7 @@
56
56
  },
57
57
  "dependencies": {
58
58
  "find-up": "^8.0.0",
59
- "goke": "^6.3.0",
59
+ "goke": "^6.6.0",
60
60
  "tar": "^7.5.12"
61
61
  },
62
62
  "scripts": {
package/src/cache.ts CHANGED
@@ -18,7 +18,7 @@ import { execAsync } from './exec.ts'
18
18
  // Pinned tsgolint fork commit — updated with each lintcn release.
19
19
  // Uses remorses/tsgolint fork which adds internal/runner.Run() and
20
20
  // TSGOLINT_SNAPSHOT_CWD env var for cwd-relative test snapshots.
21
- export const DEFAULT_TSGOLINT_VERSION = '4e4666c284d3b5cf7fa082523a369ef507e4360c'
21
+ export const DEFAULT_TSGOLINT_VERSION = '427f872946bb413f0e21cff585b6139c986c89d3'
22
22
 
23
23
  // Pinned typescript-go base commit from microsoft/typescript-go (before patches).
24
24
  // Patches from tsgolint/patches/ are applied on top during setup.
package/src/cli.ts CHANGED
@@ -46,21 +46,20 @@ cli
46
46
  .option('--all-warnings', 'Show warnings for all files, not just git-changed ones')
47
47
  .option('--tsgolint-version [version]', 'Override the pinned tsgolint version (tag or commit). For testing unreleased tsgolint versions.')
48
48
  .action(async (options) => {
49
- const tsgolintVersion = (options.tsgolintVersion as string) || DEFAULT_TSGOLINT_VERSION
49
+ const tsgolintVersion = options.tsgolintVersion || DEFAULT_TSGOLINT_VERSION
50
50
  const passthroughArgs: string[] = []
51
51
  if (options.fix) {
52
52
  passthroughArgs.push('--fix')
53
53
  }
54
54
  if (options.tsconfig) {
55
- passthroughArgs.push('--tsconfig', options.tsconfig as string)
55
+ passthroughArgs.push('--tsconfig', options.tsconfig)
56
56
  }
57
57
  if (options.listFiles) {
58
58
  passthroughArgs.push('--list-files')
59
59
  }
60
- // pass through anything after --
61
- const doubleDash = options['--']
62
- if (doubleDash && Array.isArray(doubleDash)) {
63
- passthroughArgs.push(...doubleDash)
60
+ // pass through anything after -- (goke 6.6.0 always types this as string[])
61
+ if (options['--'].length > 0) {
62
+ passthroughArgs.push(...options['--'])
64
63
  }
65
64
  const exitCode = await lint({
66
65
  rebuild: !!options.rebuild,
@@ -80,7 +79,7 @@ cli
80
79
  console.log('No .lintcn/ directory found. Run `lintcn add <url>` to add rules.')
81
80
  return
82
81
  }
83
- const tsgolintVersion = (options.tsgolintVersion as string) || DEFAULT_TSGOLINT_VERSION
82
+ const tsgolintVersion = options.tsgolintVersion || DEFAULT_TSGOLINT_VERSION
84
83
  const binaryPath = await buildBinary({ rebuild: !!options.rebuild, tsgolintVersion })
85
84
  console.log(binaryPath)
86
85
  })