@herb-tools/config 0.8.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/README.md +58 -0
- package/dist/herb-config.cjs +12736 -0
- package/dist/herb-config.cjs.map +1 -0
- package/dist/herb-config.esm.js +12712 -0
- package/dist/herb-config.esm.js.map +1 -0
- package/dist/package.json +49 -0
- package/dist/src/config-schema.js +39 -0
- package/dist/src/config-schema.js.map +1 -0
- package/dist/src/config.js +856 -0
- package/dist/src/config.js.map +1 -0
- package/dist/src/index.js +4 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/merge.js +41 -0
- package/dist/src/merge.js.map +1 -0
- package/dist/src/vscode.js +73 -0
- package/dist/src/vscode.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/config-schema.d.ts +90 -0
- package/dist/types/config.d.ts +348 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/merge.d.ts +11 -0
- package/dist/types/src/config-schema.d.ts +90 -0
- package/dist/types/src/config.d.ts +348 -0
- package/dist/types/src/index.d.ts +5 -0
- package/dist/types/src/merge.d.ts +11 -0
- package/dist/types/src/vscode.d.ts +13 -0
- package/dist/types/vscode.d.ts +13 -0
- package/package.json +49 -0
- package/src/config-schema.ts +51 -0
- package/src/config-template.yml +78 -0
- package/src/config.ts +1105 -0
- package/src/index.ts +17 -0
- package/src/merge.ts +47 -0
- package/src/vscode.ts +96 -0
- package/src/yaml.d.ts +9 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@herb-tools/config",
|
|
3
|
+
"version": "0.8.0",
|
|
4
|
+
"description": "Shared configuration utilities for Herb tools",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"homepage": "https://herb-tools.dev",
|
|
7
|
+
"bugs": "https://github.com/marcoroth/herb/issues/new?title=Package%20%60@herb-tools/config%60:%20",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/marcoroth/herb.git",
|
|
11
|
+
"directory": "javascript/packages/config"
|
|
12
|
+
},
|
|
13
|
+
"main": "./dist/herb-config.cjs",
|
|
14
|
+
"module": "./dist/herb-config.esm.js",
|
|
15
|
+
"types": "./dist/types/index.d.ts",
|
|
16
|
+
"scripts": {
|
|
17
|
+
"clean": "rimraf dist",
|
|
18
|
+
"build": "yarn clean && tsc -b && rollup -c",
|
|
19
|
+
"dev": "tsc -b -w",
|
|
20
|
+
"test": "vitest run",
|
|
21
|
+
"prepublishOnly": "yarn clean && yarn build && yarn test"
|
|
22
|
+
},
|
|
23
|
+
"exports": {
|
|
24
|
+
"./package.json": "./package.json",
|
|
25
|
+
".": {
|
|
26
|
+
"types": "./dist/types/index.d.ts",
|
|
27
|
+
"import": "./dist/herb-config.esm.js",
|
|
28
|
+
"require": "./dist/herb-config.cjs",
|
|
29
|
+
"default": "./dist/herb-config.esm.js"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@herb-tools/core": "0.8.0",
|
|
34
|
+
"yaml": "^2.3.4"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@types/minimatch": "^6.0.0",
|
|
38
|
+
"glob": "^11.0.3",
|
|
39
|
+
"minimatch": "^10.1.1",
|
|
40
|
+
"zod": "^4.1.12",
|
|
41
|
+
"zod-validation-error": "^5.0.0"
|
|
42
|
+
},
|
|
43
|
+
"files": [
|
|
44
|
+
"package.json",
|
|
45
|
+
"README.md",
|
|
46
|
+
"src/",
|
|
47
|
+
"dist/"
|
|
48
|
+
]
|
|
49
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const SeveritySchema = z.enum(["error", "warning", "info", "hint"]);
|
|
3
|
+
export const FilesConfigSchema = z.object({
|
|
4
|
+
include: z.array(z.string()).optional().describe("Additional glob patterns to include beyond defaults (e.g., ['**/*.xml.erb', 'custom/**/*.html'])"),
|
|
5
|
+
exclude: z.array(z.string()).optional().describe("Glob patterns to exclude (e.g., ['node_modules/**/*', 'vendor/**/*', '**/*.html.erb'])"),
|
|
6
|
+
}).strict().optional();
|
|
7
|
+
const RuleConfigBaseSchema = z.object({
|
|
8
|
+
enabled: z.boolean().optional().describe("Whether the rule is enabled"),
|
|
9
|
+
severity: SeveritySchema.optional().describe("Severity level for the rule"),
|
|
10
|
+
include: z.array(z.string()).optional().describe("Additional glob patterns to include for this rule (additive, ignored when 'only' is present)"),
|
|
11
|
+
only: z.array(z.string()).optional().describe("Only apply this rule to files matching these glob patterns (overrides all 'include' patterns)"),
|
|
12
|
+
exclude: z.array(z.string()).optional().describe("Don't apply this rule to files matching these glob patterns"),
|
|
13
|
+
});
|
|
14
|
+
export const RuleConfigSchema = RuleConfigBaseSchema.optional();
|
|
15
|
+
export const LinterConfigSchema = z.object({
|
|
16
|
+
enabled: z.boolean().optional().describe("Whether the linter is enabled"),
|
|
17
|
+
include: z.array(z.string()).optional().describe("Additional glob patterns to include beyond defaults (e.g., ['**/*.xml.erb', 'custom/**/*.html'])"),
|
|
18
|
+
exclude: z.array(z.string()).optional().describe("Glob patterns to exclude from linting"),
|
|
19
|
+
rules: z.record(z.string(), RuleConfigBaseSchema).optional().describe("Per-rule configuration"),
|
|
20
|
+
}).strict().optional();
|
|
21
|
+
const RewriterConfigSchema = z.object({
|
|
22
|
+
pre: z.array(z.string()).optional().describe("Pre-format rewriters to run (in order) before formatting the AST"),
|
|
23
|
+
post: z.array(z.string()).optional().describe("Post-format rewriters to run (in order) after formatting the document"),
|
|
24
|
+
}).strict().optional();
|
|
25
|
+
export const FormatterConfigSchema = z.object({
|
|
26
|
+
enabled: z.boolean().optional().describe("Whether the formatter is enabled"),
|
|
27
|
+
include: z.array(z.string()).optional().describe("Additional glob patterns to include beyond defaults (e.g., ['**/*.xml.erb', 'custom/**/*.html'])"),
|
|
28
|
+
exclude: z.array(z.string()).optional().describe("Glob patterns to exclude from formatting"),
|
|
29
|
+
indentWidth: z.number().int().positive().optional().describe("Number of spaces per indentation level"),
|
|
30
|
+
maxLineLength: z.number().int().positive().optional().describe("Maximum line length before wrapping"),
|
|
31
|
+
rewriter: RewriterConfigSchema.describe("Rewriter configuration for pre and post-format transformations"),
|
|
32
|
+
}).strict().optional();
|
|
33
|
+
export const HerbConfigSchema = z.object({
|
|
34
|
+
version: z.string().describe("Configuration file version"),
|
|
35
|
+
files: FilesConfigSchema.describe("Top-level file configuration"),
|
|
36
|
+
linter: LinterConfigSchema,
|
|
37
|
+
formatter: FormatterConfigSchema,
|
|
38
|
+
}).strict();
|
|
39
|
+
//# sourceMappingURL=config-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-schema.js","sourceRoot":"","sources":["../../src/config-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;AAE1E,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kGAAkG,CAAC;IACpJ,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,wFAAwF,CAAC;CAC3I,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAA;AAEtB,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,6BAA6B,CAAC;IACvE,QAAQ,EAA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