@forinda/kickjs-lint 5.2.4 → 5.2.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.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @forinda/kickjs-lint
2
2
 
3
- Lint rules for KickJS conventions — DI tokens, plugin/adapter naming, and other framework patterns.
3
+ Lint rules for KickJS conventions: DI tokens made with `createToken<T>()`, and the reserved `kick/` token prefix.
4
4
 
5
5
  ## Install
6
6
 
@@ -8,42 +8,25 @@ Lint rules for KickJS conventions — DI tokens, plugin/adapter naming, and othe
8
8
  pnpm add -D @forinda/kickjs-lint
9
9
  ```
10
10
 
11
- ## CLI
11
+ ## Quick example
12
12
 
13
13
  ```bash
14
- # adopter project — lints `src/`, warns on third-party kick/ squatting
15
- kick-lint
16
-
17
- # framework / first-party packages — lints `packages/`, errors on missing kick/ prefix
18
- kick-lint --first-party
19
-
20
- # custom scope
21
- kick-lint --scope src,libs
14
+ kick-lint # lints src/
15
+ kick-lint --scope src,libs # other folders
22
16
  ```
23
17
 
24
- ## Programmatic
18
+ | Rule | Default | Checks |
19
+ | ----------------------- | ------- | ------------------------------------------------------------ |
20
+ | `di-token-symbol` | `error` | tokens use `createToken<T>()`, not `Symbol(...)` |
21
+ | `token-kick-prefix` | `error` | first-party tokens start with `kick/` (`--first-party` only) |
22
+ | `token-reserved-prefix` | `warn` | third-party tokens don't use the reserved `kick/` prefix |
25
23
 
26
- ```ts
27
- import { runLint, formatViolations } from '@forinda/kickjs-lint'
28
-
29
- const result = await runLint({ cwd: process.cwd(), firstParty: false })
30
- if (result.violations.length > 0) console.error(formatViolations(result.violations))
31
- ```
24
+ Disable one on a line with `// kick-lint-disable <rule>`. `runLint()` and `formatViolations()` run it from code.
32
25
 
33
- ## Rules
26
+ ## Documentation
34
27
 
35
- | Rule | Default | Description |
36
- | ----------------------- | ------- | ----------------------------------------------------------------------------- |
37
- | `di-token-symbol` | `error` | DI tokens must use `createToken<T>()` instead of `Symbol(...)` in token files |
38
- | `token-kick-prefix` | `error` | First-party tokens must start with the reserved `kick/` prefix |
39
- | `token-reserved-prefix` | `warn` | Third-party tokens must not squat the reserved `kick/` prefix |
40
-
41
- Inline-disable a rule on a single line:
42
-
43
- ```ts
44
- export const FOO = Symbol('Legacy') // kick-lint-disable di-token-symbol
45
- ```
28
+ [DI tokens](https://kickjs.app/guide/dependency-injection#tokens)
46
29
 
47
- ## Why
30
+ ## License
48
31
 
49
- See [architecture.md §22](https://github.com/forinda/kick-js/blob/main/architecture.md#22-di-token-convention--symbol-to-string-migration) for the convention rationale. The convention landed in the v3 → v4 migration and has been stable since; refer to the [DI Tokens guide](https://kickjs.app/guide/dependency-injection.html#tokens) for the current shape.
32
+ MIT
package/dist/index.d.mts CHANGED
@@ -1,6 +1,5 @@
1
1
 
2
2
  import { LintContext, Rule, Violation, diTokenSymbol, rules, tokenKickPrefix, tokenReservedPrefix } from "./rules.mjs";
3
-
4
3
  //#region src/index.d.ts
5
4
  /**
6
5
  * Filenames that historically declare DI tokens. Lint runs only on
@@ -11,8 +10,8 @@ import { LintContext, Rule, Violation, diTokenSymbol, rules, tokenKickPrefix, to
11
10
  * regression where `TENANT_DB = Symbol(...)` slipped past the rule by
12
11
  * living in `database.ts` rather than `tokens.ts` / `constants.ts`.
13
12
  */
14
- declare const TOKEN_FILE_NAMES: Set<string>;
15
- interface LintOptions {
13
+ export declare const TOKEN_FILE_NAMES: Set<string>;
14
+ export interface LintOptions {
16
15
  /** Root directory to walk. Required. */
17
16
  cwd: string;
18
17
  /**
@@ -32,7 +31,7 @@ interface LintOptions {
32
31
  /** Filenames to lint (defaults to {@link TOKEN_FILE_NAMES}). */
33
32
  filenames?: ReadonlySet<string>;
34
33
  }
35
- interface LintResult {
34
+ export interface LintResult {
36
35
  violations: Violation[];
37
36
  filesScanned: number;
38
37
  }
@@ -41,13 +40,13 @@ interface LintResult {
41
40
  * each token-bearing file, and return the aggregated violations + the
42
41
  * number of files actually checked.
43
42
  */
44
- declare function runLint(opts: LintOptions): Promise<LintResult>;
43
+ export declare function runLint(opts: LintOptions): Promise<LintResult>;
45
44
  /**
46
45
  * Format a violation list for terminal output. One block per violation,
47
46
  * trailing summary line. Returns `''` when there are no violations so
48
47
  * callers can branch on truthiness.
49
48
  */
50
- declare function formatViolations(violations: readonly Violation[]): string;
49
+ export declare function formatViolations(violations: readonly Violation[]): string;
51
50
  //#endregion
52
- export { type LintContext, LintOptions, LintResult, type Rule, TOKEN_FILE_NAMES, type Violation, rules as defaultRules, diTokenSymbol, formatViolations, runLint, tokenKickPrefix, tokenReservedPrefix };
51
+ export { type LintContext, type Rule, type Violation, rules as defaultRules, diTokenSymbol, tokenKickPrefix, tokenReservedPrefix };
53
52
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;AA2EyB;AAGzB;;;;cAhDa,gBAAA,EAAgB,GAAA;AAAA,UA2BZ,WAAA;EAuBf;EArBA,GAAA;EAqBY;AAQd;;;;EAvBE,UAAA;EAuBgD;;;;;EAjBhD,KAAA;EAiBwD;EAfxD,KAAA,YAAiB,IAAA;EAeiD;EAblE,SAAA,GAAY,WAAW;AAAA;AAAA,UAGR,UAAA;EACf,UAAA,EAAY,SAAS;EACrB,YAAA;AAAA;;;;;;iBAQoB,OAAA,CAAQ,IAAA,EAAM,WAAA,GAAc,OAAA,CAAQ,UAAA;;;;;;iBAkD1C,gBAAA,CAAiB,UAAgC,WAAX,SAAS"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;;qBA8Ba,kBAAgB;iBA2BZ;;EAEf;;;;;;EAMA;;;;;;EAMA;;EAEA,iBAAiB;;EAEjB,YAAY;;iBAGG;EACf,YAAY;EACZ;;;;;;;wBAQoB,QAAQ,MAAM,cAAc,QAAQ;;;;;;wBAkD1C,iBAAiB,qBAAqB"}
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs-lint v5.2.4
2
+ * @forinda/kickjs-lint v5.2.5
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
package/dist/rules.d.mts CHANGED
@@ -5,7 +5,7 @@
5
5
  * and returns the violations it found. Stateless and synchronous so the
6
6
  * runner can compose them freely (CLI, devtools, editor extension).
7
7
  */
8
- interface Violation {
8
+ export interface Violation {
9
9
  ruleId: string;
10
10
  severity: 'error' | 'warn';
11
11
  file: string;
@@ -14,7 +14,7 @@ interface Violation {
14
14
  message: string;
15
15
  suggestion?: string;
16
16
  }
17
- interface LintContext {
17
+ export interface LintContext {
18
18
  source: string;
19
19
  file: string;
20
20
  /**
@@ -24,7 +24,7 @@ interface LintContext {
24
24
  */
25
25
  firstParty: boolean;
26
26
  }
27
- interface Rule {
27
+ export interface Rule {
28
28
  id: string;
29
29
  description: string;
30
30
  defaultSeverity: 'error' | 'warn';
@@ -39,7 +39,7 @@ interface Rule {
39
39
  * Inline-disable: append `// kick-lint-disable di-token-symbol` to the
40
40
  * declaration line.
41
41
  */
42
- declare const diTokenSymbol: Rule;
42
+ export declare const diTokenSymbol: Rule;
43
43
  /**
44
44
  * For first-party files, every `createToken('literal')` literal must
45
45
  * start with the reserved `kick/` prefix. Third-party adopter code is
@@ -49,16 +49,15 @@ declare const diTokenSymbol: Rule;
49
49
  * `kickjs/` (the dotted convention pre-dates section 22 and gets
50
50
  * migrated alongside the symbol-to-string work).
51
51
  */
52
- declare const tokenKickPrefix: Rule;
52
+ export declare const tokenKickPrefix: Rule;
53
53
  /**
54
54
  * Third-party adopters must NOT squat the reserved `kick/` prefix --
55
55
  * mirror image of {@link tokenKickPrefix}. Runs only on non-first-party
56
56
  * code and warns rather than errors so the rule is informative without
57
57
  * blocking adopter installs.
58
58
  */
59
- declare const tokenReservedPrefix: Rule;
59
+ export declare const tokenReservedPrefix: Rule;
60
60
  /** All rules shipped by this package, in run order. */
61
- declare const rules: readonly Rule[];
61
+ export declare const rules: readonly Rule[];
62
62
  //#endregion
63
- export { LintContext, Rule, Violation, diTokenSymbol, rules, tokenKickPrefix, tokenReservedPrefix };
64
63
  //# sourceMappingURL=rules.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rules.d.mts","names":[],"sources":["../src/rules.ts"],"mappings":";;;AAMA;;;;UAAiB,SAAA;EACf,MAAA;EACA,QAAA;EACA,IAAA;EAGA;EADA,IAAA;EACA,OAAA;EACA,UAAA;AAAA;AAAA,UAGe,WAAA;EACf,MAAA;EACA,IAAA;EADA;;;;AAOU;EAAV,UAAA;AAAA;AAAA,UAGe,IAAA;EACf,EAAA;EACA,WAAA;EACA,eAAA;EACA,KAAA,CAAM,GAAA,EAAK,WAAA,GAAc,SAAS;AAAA;;;;;AAAA;AAmBpC;;;;cAAa,aAAA,EAAe,IAwB3B;AAWD;;;;AAwBC;AAQD;;;;AAhCA,cAAa,eAAA,EAAiB,IAwB7B;AAkCD;;;;AAAiC;;AAAjC,cA1Ba,mBAAA,EAAqB,IAuBjC;;cAGY,KAAA,WAAgB,IAAI"}
1
+ {"version":3,"file":"rules.d.mts","names":[],"sources":["../src/rules.ts"],"mappings":";;;;;;;iBAMiB;EACf;EACA;EACA;;EAEA;EACA;EACA;;iBAGe;EACf;EACA;;;;;;EAMA;;iBAGe;EACf;EACA;EACA;EACA,MAAM,KAAK,cAAc;;;;;;;;;;;qBAmBd,eAAe;;;;;;;;;;qBAmCf,iBAAiB;;;;;;;qBAgCjB,qBAAqB;;qBA0BrB,gBAAgB"}
package/dist/rules.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs-lint v5.2.4
2
+ * @forinda/kickjs-lint v5.2.5
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forinda/kickjs-lint",
3
- "version": "5.2.4",
3
+ "version": "5.2.5",
4
4
  "description": "Lint rules for KickJS — DI token convention, plugin/adapter naming, and other framework conventions",
5
5
  "keywords": [
6
6
  "kickjs",
@@ -35,9 +35,9 @@
35
35
  ],
36
36
  "dependencies": {},
37
37
  "devDependencies": {
38
- "@types/node": "^25.9.2",
39
- "typescript": "^6.0.3",
40
- "vitest": "^4.1.8"
38
+ "@types/node": "^26.6.2",
39
+ "typescript": "^7.0.2",
40
+ "vitest": "^5.0.1"
41
41
  },
42
42
  "publishConfig": {
43
43
  "access": "public"
@@ -60,7 +60,7 @@
60
60
  "build": "tsdown",
61
61
  "dev": "tsdown --watch",
62
62
  "test": "vitest run",
63
- "typecheck": "tsgo --noEmit",
63
+ "typecheck": "tsc --noEmit",
64
64
  "clean": "rm -rf dist .wireit"
65
65
  }
66
66
  }