@savvy-web/lint-staged 0.6.6 → 0.7.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/878.js +516 -1344
- package/README.md +22 -8
- package/biome/silk.jsonc +2 -1
- package/index.d.ts +19 -130
- package/index.js +713 -4
- package/package.json +6 -5
package/README.md
CHANGED
|
@@ -64,7 +64,7 @@ export default {
|
|
|
64
64
|
## Presets
|
|
65
65
|
|
|
66
66
|
| Preset | Handlers |
|
|
67
|
-
|
|
|
67
|
+
| --- | --- |
|
|
68
68
|
| `minimal()` | PackageJson, Biome |
|
|
69
69
|
| `standard()` | + Markdown, Yaml, PnpmWorkspace, ShellScripts |
|
|
70
70
|
| `silk()` | + TypeScript |
|
|
@@ -72,7 +72,7 @@ export default {
|
|
|
72
72
|
## Available Handlers
|
|
73
73
|
|
|
74
74
|
| Handler | Files | Description |
|
|
75
|
-
|
|
|
75
|
+
| --- | --- | --- |
|
|
76
76
|
| `PackageJson` | `**/package.json` | Sort and format with Biome |
|
|
77
77
|
| `Biome` | `*.{js,ts,jsx,tsx,json,jsonc}` | Format and lint |
|
|
78
78
|
| `Markdown` | `**/*.{md,mdx}` | Lint with markdownlint-cli2 |
|
|
@@ -95,17 +95,31 @@ savvy-lint fmt yaml # Format YAML files with Prettier
|
|
|
95
95
|
savvy-lint fmt pnpm-workspace # Sort and format pnpm-workspace.yaml
|
|
96
96
|
```
|
|
97
97
|
|
|
98
|
+
## Claude Code Plugin
|
|
99
|
+
|
|
100
|
+
A companion Claude Code plugin is available that automatically injects code
|
|
101
|
+
quality context (Biome, markdownlint, and TypeScript conventions) at session
|
|
102
|
+
start.
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
# Add the Savvy Web plugin marketplace (one-time setup)
|
|
106
|
+
/plugin marketplace add savvy-web/systems
|
|
107
|
+
|
|
108
|
+
# Install the lint-staged plugin for this project
|
|
109
|
+
/plugin install lint-staged@savvy-web-systems --scope project
|
|
110
|
+
```
|
|
111
|
+
|
|
98
112
|
## Documentation
|
|
99
113
|
|
|
100
|
-
- [Handler Configuration](
|
|
101
|
-
- [Configuration API](
|
|
102
|
-
- [CLI Reference](
|
|
103
|
-
- [Utilities](
|
|
104
|
-
- [Migration Guide](
|
|
114
|
+
- [Handler Configuration](../docs/handlers.md) -- Detailed options for each handler
|
|
115
|
+
- [Configuration API](../docs/configuration.md) -- createConfig and Preset APIs
|
|
116
|
+
- [CLI Reference](../docs/cli.md) -- `savvy-lint init`, `check`, and `fmt`
|
|
117
|
+
- [Utilities](../docs/utilities.md) -- Command, Filter, and advanced utilities
|
|
118
|
+
- [Migration Guide](../docs/migration.md) -- Migrating from raw lint-staged configs
|
|
105
119
|
|
|
106
120
|
## Contributing
|
|
107
121
|
|
|
108
|
-
Contributions welcome! See [CONTRIBUTING.md](
|
|
122
|
+
Contributions welcome! See [CONTRIBUTING.md](../CONTRIBUTING.md) for setup
|
|
109
123
|
and guidelines.
|
|
110
124
|
|
|
111
125
|
## License
|
package/biome/silk.jsonc
CHANGED
package/index.d.ts
CHANGED
|
@@ -19,14 +19,21 @@
|
|
|
19
19
|
* @packageDocumentation
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
+
import { BiomeSchemaSync } from '@savvy-web/silk-effects';
|
|
22
23
|
import { Command as Command_2 } from '@effect/cli';
|
|
24
|
+
import { ConfigDiscovery } from '@savvy-web/silk-effects';
|
|
25
|
+
import { ConfigDiscoveryLive } from '@savvy-web/silk-effects';
|
|
26
|
+
import { ConfigLocation } from '@savvy-web/silk-effects';
|
|
23
27
|
import { FileSystem } from '@effect/platform';
|
|
24
28
|
import { FileSystem as FileSystem_2 } from '@effect/platform/FileSystem';
|
|
25
29
|
import { JsoncModificationError } from 'jsonc-effect';
|
|
26
30
|
import { JsoncParseError } from 'jsonc-effect';
|
|
31
|
+
import { ManagedSection } from '@savvy-web/silk-effects';
|
|
27
32
|
import { Option } from 'effect/Option';
|
|
28
33
|
import { PlatformError } from '@effect/platform/Error';
|
|
29
|
-
import {
|
|
34
|
+
import { SectionParseError } from '@savvy-web/silk-effects';
|
|
35
|
+
import { SectionWriteError } from '@savvy-web/silk-effects';
|
|
36
|
+
import { ToolDiscovery } from '@savvy-web/silk-effects';
|
|
30
37
|
|
|
31
38
|
/**
|
|
32
39
|
* Base options shared by all handlers.
|
|
@@ -146,7 +153,7 @@ export declare interface BiomeOptions extends BaseHandlerOptions {
|
|
|
146
153
|
* Validates the current lint-staged setup and displays detected settings.
|
|
147
154
|
* With --quiet flag, only outputs warnings (for postinstall usage).
|
|
148
155
|
*/
|
|
149
|
-
export declare const checkCommand: Command_2.Command<"check", FileSystem.FileSystem, JsoncParseError |
|
|
156
|
+
export declare const checkCommand: Command_2.Command<"check", BiomeSchemaSync | ConfigDiscovery | FileSystem.FileSystem | ManagedSection | ToolDiscovery, JsoncParseError | SectionParseError | PlatformError, {
|
|
150
157
|
readonly quiet: boolean;
|
|
151
158
|
}>;
|
|
152
159
|
|
|
@@ -159,11 +166,10 @@ export declare class Command {
|
|
|
159
166
|
/** Cached project root path */
|
|
160
167
|
private static cachedRoot;
|
|
161
168
|
/**
|
|
162
|
-
* Find the project root directory
|
|
169
|
+
* Find the project root directory by walking up from `cwd`.
|
|
163
170
|
*
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
* (or `process.cwd()`) on error.
|
|
171
|
+
* Searches upward for the nearest directory containing a `package.json`.
|
|
172
|
+
* Falls back to the provided `cwd` (or `process.cwd()`) when none is found.
|
|
167
173
|
*
|
|
168
174
|
* @remarks
|
|
169
175
|
* This is more reliable than `process.cwd()` in environments like Husky
|
|
@@ -299,128 +305,11 @@ export declare class Command {
|
|
|
299
305
|
static execSilent(command: string): boolean;
|
|
300
306
|
}
|
|
301
307
|
|
|
302
|
-
|
|
303
|
-
* Static utility class for discovering configuration files.
|
|
304
|
-
*
|
|
305
|
-
* Searches in a prioritized order:
|
|
306
|
-
* 1. `lib/configs/` directory first (agency convention)
|
|
307
|
-
* 2. Standard locations (repo root, package.json, etc.)
|
|
308
|
-
*
|
|
309
|
-
* @example
|
|
310
|
-
* ```typescript
|
|
311
|
-
* import { ConfigSearch } from '@savvy-web/lint-staged';
|
|
312
|
-
*
|
|
313
|
-
* // Find markdownlint config
|
|
314
|
-
* const result = ConfigSearch.find('markdownlint');
|
|
315
|
-
* if (result.found) {
|
|
316
|
-
* console.log(`Found config at: ${result.filepath}`);
|
|
317
|
-
* }
|
|
318
|
-
*
|
|
319
|
-
* // Find with custom search locations
|
|
320
|
-
* const custom = ConfigSearch.findFile('myapp', {
|
|
321
|
-
* libConfigFiles: ['myapp.config.js'],
|
|
322
|
-
* standardPlaces: ['myapp.config.js', '.myapprc'],
|
|
323
|
-
* });
|
|
324
|
-
* ```
|
|
325
|
-
*/
|
|
326
|
-
export declare class ConfigSearch {
|
|
327
|
-
/**
|
|
328
|
-
* Default directory for agency config files.
|
|
329
|
-
*/
|
|
330
|
-
static readonly libConfigDir = "lib/configs";
|
|
331
|
-
/**
|
|
332
|
-
* Find a configuration file for a known tool.
|
|
333
|
-
*
|
|
334
|
-
* Supported tools: 'markdownlint', 'biome', 'eslint', 'prettier', 'yamllint'
|
|
335
|
-
*
|
|
336
|
-
* @param tool - The tool name
|
|
337
|
-
* @param options - Search options
|
|
338
|
-
* @returns Search result with filepath if found
|
|
339
|
-
*
|
|
340
|
-
* @example
|
|
341
|
-
* ```typescript
|
|
342
|
-
* const result = ConfigSearch.find('markdownlint');
|
|
343
|
-
* if (result.found) {
|
|
344
|
-
* // Use result.filepath
|
|
345
|
-
* }
|
|
346
|
-
* ```
|
|
347
|
-
*/
|
|
348
|
-
static find(tool: "markdownlint" | "biome" | "eslint" | "prettier" | "yamllint", options?: ConfigSearchOptions): ConfigSearchResult;
|
|
349
|
-
/**
|
|
350
|
-
* Find a configuration file with custom search locations.
|
|
351
|
-
*
|
|
352
|
-
* @param moduleName - The cosmiconfig module name
|
|
353
|
-
* @param options - Search configuration
|
|
354
|
-
* @returns Search result with filepath if found
|
|
355
|
-
*
|
|
356
|
-
* @example
|
|
357
|
-
* ```typescript
|
|
358
|
-
* const result = ConfigSearch.findFile('myapp', {
|
|
359
|
-
* libConfigFiles: ['myapp.config.js'],
|
|
360
|
-
* standardPlaces: ['myapp.config.js', '.myapprc'],
|
|
361
|
-
* });
|
|
362
|
-
* ```
|
|
363
|
-
*/
|
|
364
|
-
static findFile(moduleName: string, options?: ConfigSearchOptions & {
|
|
365
|
-
libConfigFiles?: string[];
|
|
366
|
-
standardPlaces?: string[];
|
|
367
|
-
}): ConfigSearchResult;
|
|
368
|
-
/**
|
|
369
|
-
* Check if a config file exists at a specific path.
|
|
370
|
-
*
|
|
371
|
-
* @param filepath - Path to check
|
|
372
|
-
* @returns true if the file exists
|
|
373
|
-
*/
|
|
374
|
-
static exists(filepath: string): boolean;
|
|
375
|
-
/**
|
|
376
|
-
* Get the path to a config file, checking lib/configs/ first.
|
|
377
|
-
*
|
|
378
|
-
* This is a simpler method that just checks for a specific filename
|
|
379
|
-
* in lib/configs/ first, then falls back to the provided default.
|
|
380
|
-
*
|
|
381
|
-
* @param filename - The config filename to look for
|
|
382
|
-
* @param fallback - Fallback path if not found in lib/configs/
|
|
383
|
-
* @returns The resolved config path
|
|
384
|
-
*
|
|
385
|
-
* @example
|
|
386
|
-
* ```typescript
|
|
387
|
-
* // Returns 'lib/configs/.markdownlint-cli2.jsonc' if it exists,
|
|
388
|
-
* // otherwise returns './.markdownlint-cli2.jsonc'
|
|
389
|
-
* const config = ConfigSearch.resolve(
|
|
390
|
-
* '.markdownlint-cli2.jsonc',
|
|
391
|
-
* './.markdownlint-cli2.jsonc'
|
|
392
|
-
* );
|
|
393
|
-
* ```
|
|
394
|
-
*/
|
|
395
|
-
static resolve(filename: string, fallback: string): string;
|
|
396
|
-
}
|
|
308
|
+
export { ConfigDiscovery }
|
|
397
309
|
|
|
398
|
-
|
|
399
|
-
* Options for config search.
|
|
400
|
-
*/
|
|
401
|
-
export declare interface ConfigSearchOptions {
|
|
402
|
-
/** Starting directory for search (defaults to cwd) */
|
|
403
|
-
searchFrom?: string;
|
|
404
|
-
/** Stop searching when reaching this directory */
|
|
405
|
-
stopDir?: string;
|
|
406
|
-
}
|
|
310
|
+
export { ConfigDiscoveryLive }
|
|
407
311
|
|
|
408
|
-
|
|
409
|
-
* Configuration file discovery utility using cosmiconfig.
|
|
410
|
-
*
|
|
411
|
-
* Searches for config files in a prioritized order:
|
|
412
|
-
* 1. `lib/configs/` directory (agency convention)
|
|
413
|
-
* 2. Standard locations (repo root, etc.)
|
|
414
|
-
*/
|
|
415
|
-
/**
|
|
416
|
-
* Result of a config search.
|
|
417
|
-
*/
|
|
418
|
-
export declare interface ConfigSearchResult {
|
|
419
|
-
/** The resolved file path, or undefined if not found */
|
|
420
|
-
filepath: string | undefined;
|
|
421
|
-
/** Whether a config file was found */
|
|
422
|
-
found: boolean;
|
|
423
|
-
}
|
|
312
|
+
export { ConfigLocation }
|
|
424
313
|
|
|
425
314
|
/**
|
|
426
315
|
* Create a complete lint-staged configuration with all handlers.
|
|
@@ -851,7 +740,7 @@ export declare interface ImportGraphResult {
|
|
|
851
740
|
* The managed section feature allows users to add custom hooks above/below
|
|
852
741
|
* the savvy-lint section without them being overwritten on updates.
|
|
853
742
|
*/
|
|
854
|
-
export declare const initCommand: Command_2.Command<"init", FileSystem.FileSystem, Error | JsoncModificationError | JsoncParseError | PlatformError, {
|
|
743
|
+
export declare const initCommand: Command_2.Command<"init", BiomeSchemaSync | FileSystem.FileSystem | ManagedSection, Error | JsoncModificationError | JsoncParseError | SectionWriteError | PlatformError, {
|
|
855
744
|
readonly force: boolean;
|
|
856
745
|
readonly config: string;
|
|
857
746
|
readonly preset: "minimal" | "silk" | "standard";
|
|
@@ -1316,7 +1205,7 @@ export declare type PresetExtendOptions = CreateConfigOptions;
|
|
|
1316
1205
|
export declare type PresetType = "minimal" | "standard" | "silk";
|
|
1317
1206
|
|
|
1318
1207
|
/** Root command for the CLI with all subcommands. */
|
|
1319
|
-
export declare const rootCommand: Command_2.Command<"savvy-lint", FileSystem_2, Error | JsoncModificationError | JsoncParseError | PlatformError, {
|
|
1208
|
+
export declare const rootCommand: Command_2.Command<"savvy-lint", BiomeSchemaSync | ConfigDiscovery | FileSystem_2 | ManagedSection | ToolDiscovery, Error | JsoncModificationError | JsoncParseError | SectionParseError | SectionWriteError | PlatformError, {
|
|
1320
1209
|
readonly subcommand: Option< {
|
|
1321
1210
|
readonly force: boolean;
|
|
1322
1211
|
readonly config: string;
|
|
@@ -1513,8 +1402,8 @@ export declare interface TsDocLintResult {
|
|
|
1513
1402
|
* Resolves files for TSDoc linting based on workspace configuration.
|
|
1514
1403
|
*
|
|
1515
1404
|
* @remarks
|
|
1516
|
-
* This class handles both single-package repos and monorepos. It
|
|
1517
|
-
*
|
|
1405
|
+
* This class handles both single-package repos and monorepos. It detects
|
|
1406
|
+
* workspaces from pnpm-workspace.yaml or package.json and checks for `tsdoc.json`
|
|
1518
1407
|
* configuration files to determine which packages need TSDoc linting.
|
|
1519
1408
|
*
|
|
1520
1409
|
* A workspace is enabled for TSDoc linting if:
|