@savvy-web/lint-staged 0.6.0 → 0.6.1
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/{376.js → 878.js} +23 -21
- package/bin/savvy-lint.js +1 -1
- package/index.d.ts +5 -3
- package/index.js +4 -2
- package/package.json +7 -7
- package/tsdoc-metadata.json +1 -1
package/{376.js → 878.js}
RENAMED
|
@@ -3,7 +3,7 @@ import { NodeContext, NodeRuntime } from "@effect/platform-node";
|
|
|
3
3
|
import { Effect } from "effect";
|
|
4
4
|
import { isDeepStrictEqual } from "node:util";
|
|
5
5
|
import { FileSystem } from "@effect/platform";
|
|
6
|
-
import { applyEdits, modify, parse } from "jsonc-
|
|
6
|
+
import { applyEdits, modify, parse } from "jsonc-effect";
|
|
7
7
|
import { execSync } from "node:child_process";
|
|
8
8
|
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
9
9
|
import { dirname, isAbsolute, join, normalize, relative, resolve } from "node:path";
|
|
@@ -1319,16 +1319,16 @@ function writeMarkdownlintConfig(fs, preset, force) {
|
|
|
1319
1319
|
return;
|
|
1320
1320
|
}
|
|
1321
1321
|
const existingText = yield* fs.readFileString(MARKDOWNLINT_CONFIG_PATH);
|
|
1322
|
-
const existingParsed = parse(existingText);
|
|
1322
|
+
const existingParsed = yield* parse(existingText);
|
|
1323
1323
|
let updatedText = existingText;
|
|
1324
1324
|
let schemaUpdated = false;
|
|
1325
1325
|
if (existingParsed.$schema !== MARKDOWNLINT_SCHEMA) {
|
|
1326
|
-
const edits = modify(updatedText, [
|
|
1326
|
+
const edits = yield* modify(updatedText, [
|
|
1327
1327
|
"$schema"
|
|
1328
1328
|
], MARKDOWNLINT_SCHEMA, {
|
|
1329
1329
|
formattingOptions: JSONC_FORMAT
|
|
1330
1330
|
});
|
|
1331
|
-
updatedText = applyEdits(updatedText, edits);
|
|
1331
|
+
updatedText = yield* applyEdits(updatedText, edits);
|
|
1332
1332
|
schemaUpdated = true;
|
|
1333
1333
|
}
|
|
1334
1334
|
const existingConfig = existingParsed.config;
|
|
@@ -1354,19 +1354,19 @@ function syncBiomeSchemas(fs) {
|
|
|
1354
1354
|
const configs = yield* findBiomeConfigs();
|
|
1355
1355
|
for (const configPath of configs){
|
|
1356
1356
|
const content = yield* fs.readFileString(configPath);
|
|
1357
|
-
const parsed = parse(content);
|
|
1357
|
+
const parsed = yield* parse(content);
|
|
1358
1358
|
if ("string" != typeof parsed.$schema) continue;
|
|
1359
1359
|
if (!parsed.$schema.startsWith(SCHEMA_URL_PREFIX)) continue;
|
|
1360
1360
|
if (parsed.$schema === expectedUrl) {
|
|
1361
1361
|
yield* Effect.log(`${CHECK_MARK} ${configPath}: biome $schema up-to-date`);
|
|
1362
1362
|
continue;
|
|
1363
1363
|
}
|
|
1364
|
-
const edits = modify(content, [
|
|
1364
|
+
const edits = yield* modify(content, [
|
|
1365
1365
|
"$schema"
|
|
1366
1366
|
], expectedUrl, {
|
|
1367
1367
|
formattingOptions: JSONC_FORMAT
|
|
1368
1368
|
});
|
|
1369
|
-
const updated = applyEdits(content, edits);
|
|
1369
|
+
const updated = yield* applyEdits(content, edits);
|
|
1370
1370
|
yield* fs.writeFileString(configPath, updated);
|
|
1371
1371
|
yield* Effect.log(`${CHECK_MARK} Updated $schema in ${configPath}`);
|
|
1372
1372
|
}
|
|
@@ -1503,16 +1503,18 @@ function checkManagedSectionStatus(existingManaged) {
|
|
|
1503
1503
|
};
|
|
1504
1504
|
}
|
|
1505
1505
|
function checkMarkdownlintConfig(content) {
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1506
|
+
return Effect.gen(function*() {
|
|
1507
|
+
const parsed = yield* parse(content);
|
|
1508
|
+
const schemaMatches = parsed.$schema === MARKDOWNLINT_SCHEMA;
|
|
1509
|
+
const existingConfig = parsed.config;
|
|
1510
|
+
const configMatches = void 0 !== existingConfig && isDeepStrictEqual(existingConfig, MARKDOWNLINT_CONFIG);
|
|
1511
|
+
return {
|
|
1512
|
+
exists: true,
|
|
1513
|
+
schemaMatches,
|
|
1514
|
+
configMatches,
|
|
1515
|
+
isUpToDate: schemaMatches && configMatches
|
|
1516
|
+
};
|
|
1517
|
+
});
|
|
1516
1518
|
}
|
|
1517
1519
|
function checkBiomeSchemas(fs) {
|
|
1518
1520
|
return Effect.gen(function*() {
|
|
@@ -1526,7 +1528,7 @@ function checkBiomeSchemas(fs) {
|
|
|
1526
1528
|
const warnings = [];
|
|
1527
1529
|
for (const configPath of configs){
|
|
1528
1530
|
const content = yield* fs.readFileString(configPath);
|
|
1529
|
-
const parsed = parse(content);
|
|
1531
|
+
const parsed = yield* parse(content);
|
|
1530
1532
|
if ("string" != typeof parsed.$schema || !parsed.$schema.startsWith(SCHEMA_URL_PREFIX)) continue;
|
|
1531
1533
|
const matches = parsed.$schema === expectedUrl;
|
|
1532
1534
|
statuses.push({
|
|
@@ -1604,7 +1606,7 @@ const checkCommand = Command.make("check", {
|
|
|
1604
1606
|
};
|
|
1605
1607
|
if (hasMarkdownlintConfig) {
|
|
1606
1608
|
const mdContent = yield* fs.readFileString(MARKDOWNLINT_CONFIG_PATH);
|
|
1607
|
-
markdownlintStatus = checkMarkdownlintConfig(mdContent);
|
|
1609
|
+
markdownlintStatus = yield* checkMarkdownlintConfig(mdContent);
|
|
1608
1610
|
if (!markdownlintStatus.schemaMatches) warnings.push(`${check_WARNING} ${MARKDOWNLINT_CONFIG_PATH}: $schema differs from template.\n Run 'savvy-lint init' to update it.`);
|
|
1609
1611
|
if (!markdownlintStatus.configMatches) warnings.push(`${check_WARNING} ${MARKDOWNLINT_CONFIG_PATH}: config rules differ from template.\n Run 'savvy-lint init --force' to overwrite.`);
|
|
1610
1612
|
}
|
|
@@ -1838,10 +1840,10 @@ const rootCommand = Command.make("savvy-lint").pipe(Command.withSubcommands([
|
|
|
1838
1840
|
]));
|
|
1839
1841
|
const cli = Command.run(rootCommand, {
|
|
1840
1842
|
name: "savvy-lint",
|
|
1841
|
-
version: "0.6.
|
|
1843
|
+
version: "0.6.1"
|
|
1842
1844
|
});
|
|
1843
1845
|
function runCli() {
|
|
1844
1846
|
const main = Effect.suspend(()=>cli(process.argv)).pipe(Effect.provide(NodeContext.layer));
|
|
1845
1847
|
NodeRuntime.runMain(main);
|
|
1846
1848
|
}
|
|
1847
|
-
export { Biome, Command_Command as Command, ConfigSearch, EntryExtractor, Filter, ImportGraph, Markdown, PnpmWorkspace, TsDocLinter, TsDocResolver, TypeScript, Yaml, checkCommand, fmtCommand, initCommand,
|
|
1849
|
+
export { Biome, Command_Command as Command, ConfigSearch, EntryExtractor, Filter, ImportGraph, Markdown, PnpmWorkspace, TsDocLinter, TsDocResolver, TypeScript, Yaml, checkCommand, fmtCommand, initCommand, rootCommand, runCli };
|
package/bin/savvy-lint.js
CHANGED
package/index.d.ts
CHANGED
|
@@ -22,6 +22,8 @@
|
|
|
22
22
|
import { Command as Command_2 } from '@effect/cli';
|
|
23
23
|
import { FileSystem } from '@effect/platform';
|
|
24
24
|
import { FileSystem as FileSystem_2 } from '@effect/platform/FileSystem';
|
|
25
|
+
import { JsoncModificationError } from 'jsonc-effect';
|
|
26
|
+
import { JsoncParseError } from 'jsonc-effect';
|
|
25
27
|
import { Option } from 'effect/Option';
|
|
26
28
|
import { PlatformError } from '@effect/platform/Error';
|
|
27
29
|
import { UnknownException } from 'effect/Cause';
|
|
@@ -144,7 +146,7 @@ export declare interface BiomeOptions extends BaseHandlerOptions {
|
|
|
144
146
|
* Validates the current lint-staged setup and displays detected settings.
|
|
145
147
|
* With --quiet flag, only outputs warnings (for postinstall usage).
|
|
146
148
|
*/
|
|
147
|
-
export declare const checkCommand: Command_2.Command<"check", FileSystem.FileSystem, UnknownException | PlatformError, {
|
|
149
|
+
export declare const checkCommand: Command_2.Command<"check", FileSystem.FileSystem, JsoncParseError | UnknownException | PlatformError, {
|
|
148
150
|
readonly quiet: boolean;
|
|
149
151
|
}>;
|
|
150
152
|
|
|
@@ -849,7 +851,7 @@ export declare interface ImportGraphResult {
|
|
|
849
851
|
* The managed section feature allows users to add custom hooks above/below
|
|
850
852
|
* the savvy-lint section without them being overwritten on updates.
|
|
851
853
|
*/
|
|
852
|
-
export declare const initCommand: Command_2.Command<"init", FileSystem.FileSystem, Error | PlatformError, {
|
|
854
|
+
export declare const initCommand: Command_2.Command<"init", FileSystem.FileSystem, Error | JsoncModificationError | JsoncParseError | PlatformError, {
|
|
853
855
|
readonly force: boolean;
|
|
854
856
|
readonly config: string;
|
|
855
857
|
readonly preset: "minimal" | "silk" | "standard";
|
|
@@ -1314,7 +1316,7 @@ export declare type PresetExtendOptions = CreateConfigOptions;
|
|
|
1314
1316
|
export declare type PresetType = "minimal" | "standard" | "silk";
|
|
1315
1317
|
|
|
1316
1318
|
/** Root command for the CLI with all subcommands. */
|
|
1317
|
-
export declare const rootCommand: Command_2.Command<"savvy-lint", FileSystem_2, Error | PlatformError, {
|
|
1319
|
+
export declare const rootCommand: Command_2.Command<"savvy-lint", FileSystem_2, Error | JsoncModificationError | JsoncParseError | PlatformError, {
|
|
1318
1320
|
readonly subcommand: Option< {
|
|
1319
1321
|
readonly force: boolean;
|
|
1320
1322
|
readonly config: string;
|
package/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { readFileSync, writeFileSync } from "node:fs";
|
|
2
|
+
import sort_package_json from "sort-package-json";
|
|
3
|
+
import { Biome, Command as Command_Command, TypeScript, Yaml, PnpmWorkspace, Markdown, Filter } from "./878.js";
|
|
2
4
|
class PackageJson {
|
|
3
5
|
static glob = "**/package.json";
|
|
4
6
|
static defaultExcludes = [
|
|
@@ -178,5 +180,5 @@ class Handler {
|
|
|
178
180
|
throw new Error("Handler.create() must be implemented by subclass");
|
|
179
181
|
}
|
|
180
182
|
}
|
|
181
|
-
export { Biome, Command, ConfigSearch, EntryExtractor, Filter, ImportGraph, Markdown, PnpmWorkspace, TsDocLinter, TsDocResolver, TypeScript, Yaml, checkCommand, fmtCommand, initCommand, rootCommand, runCli } from "./
|
|
183
|
+
export { Biome, Command, ConfigSearch, EntryExtractor, Filter, ImportGraph, Markdown, PnpmWorkspace, TsDocLinter, TsDocResolver, TypeScript, Yaml, checkCommand, fmtCommand, initCommand, rootCommand, runCli } from "./878.js";
|
|
182
184
|
export { Handler, PackageJson, Preset, ShellScripts, createConfig };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@savvy-web/lint-staged",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Composable, configurable lint-staged handlers for pre-commit hooks. Provides reusable handlers for Biome, Markdown, YAML, TypeScript, and more.",
|
|
6
6
|
"keywords": [
|
|
@@ -40,15 +40,15 @@
|
|
|
40
40
|
"savvy-lint": "./bin/savvy-lint.js"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@effect/cli": "^0.
|
|
44
|
-
"@effect/platform": "^0.
|
|
45
|
-
"@effect/platform-node": "^0.
|
|
43
|
+
"@effect/cli": "^0.74.0",
|
|
44
|
+
"@effect/platform": "^0.95.0",
|
|
45
|
+
"@effect/platform-node": "^0.105.0",
|
|
46
46
|
"@typescript-eslint/parser": "^8.57.0",
|
|
47
47
|
"cosmiconfig": "^9.0.1",
|
|
48
|
-
"effect": "^3.
|
|
48
|
+
"effect": "^3.20.0",
|
|
49
49
|
"eslint": "^10.0.3",
|
|
50
50
|
"eslint-plugin-tsdoc": "^0.5.2",
|
|
51
|
-
"jsonc-
|
|
51
|
+
"jsonc-effect": "^0.2.0",
|
|
52
52
|
"prettier": "^3.8.1",
|
|
53
53
|
"sort-package-json": "^3.6.1",
|
|
54
54
|
"workspace-tools": "^0.41.0",
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
"!lint-staged.api.json",
|
|
103
103
|
"!tsconfig.json",
|
|
104
104
|
"!tsdoc.json",
|
|
105
|
-
"
|
|
105
|
+
"878.js",
|
|
106
106
|
"LICENSE",
|
|
107
107
|
"README.md",
|
|
108
108
|
"bin/savvy-lint.js",
|