@webpieces/rules-config 0.3.160 → 0.3.162
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/package.json +1 -1
- package/src/default-rules.js +2 -1
- package/src/default-rules.js.map +1 -1
- package/src/load-config.js +3 -2
- package/src/load-config.js.map +1 -1
- package/src/types.d.ts +2 -1
- package/src/types.js +2 -1
- package/src/types.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webpieces/rules-config",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.162",
|
|
4
4
|
"description": "Shared webpieces.config.json loader. Single source of truth for validation rule configuration consumed by @webpieces/ai-hook-rules, @webpieces/code-rules, and @webpieces/nx-webpieces-rules.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./src/index.js",
|
package/src/default-rules.js
CHANGED
|
@@ -37,8 +37,9 @@ exports.defaultRules = {
|
|
|
37
37
|
excludePaths: [...DEFAULT_EXCLUDE_PATHS],
|
|
38
38
|
},
|
|
39
39
|
'no-js-files': { mode: 'OFF' },
|
|
40
|
-
'branch-creation-guard': { mode: 'ON' },
|
|
40
|
+
'branch-creation-guard': { mode: 'ON', subBranchNaming: 'feature/<ticket>/<short-description>' },
|
|
41
41
|
'pr-creation-guard': { mode: 'ON' },
|
|
42
|
+
'pr-merge-cleanup': { mode: 'ON' },
|
|
42
43
|
'no-direct-main-update': { mode: 'ON' },
|
|
43
44
|
};
|
|
44
45
|
exports.defaultRulesDir = [];
|
package/src/default-rules.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-rules.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/default-rules.ts"],"names":[],"mappings":";;;AAAA,2DAA2D;AAC3D,4EAA4E;AAC5E,kEAAkE;AAClE,0EAA0E;AAC1E,MAAM,qBAAqB,GAAsB;IAC7C,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IACrC,WAAW,EAAE,mBAAmB;CACnC,CAAC;AAEF,2EAA2E;AAC3E,6EAA6E;AAC7E,8DAA8D;AAC9D,iFAAiF;AACpE,QAAA,YAAY,GAA4C;IACjE,gBAAgB,EAAE,EAAE;IACpB,iBAAiB,EAAE,EAAE;IACrB,gBAAgB,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE;IAChC,kBAAkB,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;IACjC,qBAAqB,EAAE,EAAE;IACzB,yBAAyB,EAAE,EAAE;IAC7B,gBAAgB,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE;IACzC,qBAAqB,EAAE,EAAE;IACzB,yBAAyB,EAAE,EAAE;IAC7B,uBAAuB,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;IACvC,uBAAuB,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;IACvC,sBAAsB,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE,eAAe,EAAE,EAAE,EAAE,aAAa,EAAE,EAAE,EAAE;IAChG,sBAAsB,EAAE,EAAE;IAC1B,kBAAkB,EAAE,EAAE;IACtB,mCAAmC,EAAE,EAAE;IACvC,qBAAqB,EAAE,EAAE;IACzB,WAAW,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;IAC3B,oBAAoB,EAAE;QAClB,IAAI,EAAE,IAAI;QACV,gBAAgB,EAAE,CAAC,eAAe,CAAC;QACnC,YAAY,EAAE,CAAC,GAAG,qBAAqB,CAAC;KAC3C;IACD,aAAa,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE;IAC9B,uBAAuB,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;
|
|
1
|
+
{"version":3,"file":"default-rules.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/default-rules.ts"],"names":[],"mappings":";;;AAAA,2DAA2D;AAC3D,4EAA4E;AAC5E,kEAAkE;AAClE,0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,EAAE,IAAI,EAAE,IAAI,EAAE;IAClC,uBAAuB,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;CAC1C,CAAC;AAEW,QAAA,eAAe,GAAsB,EAAE,CAAC","sourcesContent":["// Default holistic exclude list for the validate-ts-in-src\n// rules. Bare names match a directory segment at any depth; globs match the\n// workspace-relative path. `**/*.d.ts` (ambient declarations) and\n// `**/jest.config.ts` legitimately live outside src/ and are exempt here.\nconst DEFAULT_EXCLUDE_PATHS: readonly string[] = [\n 'node_modules', 'dist', '.nx', '.git',\n '**/*.d.ts', '**/jest.config.ts',\n];\n\n// On/off is driven by `mode` (\"OFF\" disables; an absent mode leaves a rule\n// on). Code-rules entries omit `mode` so each executor keeps its own default\n// scope; simple on/off rules declare `mode: 'ON'` explicitly.\n// webpieces-disable no-any-unknown -- rule options are opaque at framework level\nexport const defaultRules: Record<string, Record<string, unknown>> = {\n 'no-any-unknown': {},\n 'no-implicit-any': {},\n 'max-file-lines': { limit: 900 },\n 'max-method-lines': { limit: 80 },\n 'require-return-type': {},\n 'no-inline-type-literals': {},\n 'no-destructure': { allowTopLevel: true },\n 'catch-error-pattern': {},\n 'no-unmanaged-exceptions': {},\n 'no-shell-substitution': { mode: 'ON' },\n 'no-file-import-cycles': { mode: 'ON' },\n 'runtime-architecture': { mode: 'ON', servicePaths: [], apiProjectPaths: [], allowedCycles: [] },\n 'prisma-validate-dtos': {},\n 'prisma-converter': {},\n 'angular-no-direct-api-in-resolver': {},\n 'no-symbol-di-tokens': {},\n 'nx-wiring': { mode: 'ON' },\n 'validate-ts-in-src': {\n mode: 'ON',\n allowedRootFiles: ['jest.setup.ts'],\n excludePaths: [...DEFAULT_EXCLUDE_PATHS],\n },\n 'no-js-files': { mode: 'OFF' },\n 'branch-creation-guard': { mode: 'ON', subBranchNaming: 'feature/<ticket>/<short-description>' },\n 'pr-creation-guard': { mode: 'ON' },\n 'pr-merge-cleanup': { mode: 'ON' },\n 'no-direct-main-update': { mode: 'ON' },\n};\n\nexport const defaultRulesDir: readonly string[] = [];\n"]}
|
package/src/load-config.js
CHANGED
|
@@ -62,10 +62,11 @@ function readRawConfig(configPath) {
|
|
|
62
62
|
function loadConfig(cwd) {
|
|
63
63
|
const configPath = findConfigFile(cwd);
|
|
64
64
|
if (!configPath) {
|
|
65
|
-
return new types_1.ResolvedConfig(new Map(), [], null);
|
|
65
|
+
return new types_1.ResolvedConfig(new Map(), new Set(), [], null);
|
|
66
66
|
}
|
|
67
67
|
const consumerConfig = readRawConfig(configPath);
|
|
68
68
|
const overrideRules = consumerConfig.rules || {};
|
|
69
|
+
const userConfiguredRuleNames = new Set(Object.keys(overrideRules));
|
|
69
70
|
const mergedRules = new Map();
|
|
70
71
|
const allRuleNames = new Set([
|
|
71
72
|
...Object.keys(default_rules_1.defaultRules),
|
|
@@ -75,6 +76,6 @@ function loadConfig(cwd) {
|
|
|
75
76
|
mergedRules.set(name, mergeRule(default_rules_1.defaultRules[name], overrideRules[name]));
|
|
76
77
|
}
|
|
77
78
|
const rulesDir = consumerConfig.rulesDir ?? [];
|
|
78
|
-
return new types_1.ResolvedConfig(mergedRules, rulesDir, configPath);
|
|
79
|
+
return new types_1.ResolvedConfig(mergedRules, userConfiguredRuleNames, rulesDir, configPath);
|
|
79
80
|
}
|
|
80
81
|
//# sourceMappingURL=load-config.js.map
|
package/src/load-config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-config.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/load-config.ts"],"names":[],"mappings":";;;AAoBA,wCASC;AAmCD,
|
|
1
|
+
{"version":3,"file":"load-config.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/load-config.ts"],"names":[],"mappings":";;;AAoBA,wCASC;AAmCD,gCAuBC;;AAvFD,+CAAyB;AACzB,mDAA6B;AAE7B,mDAA+C;AAC/C,uDAAkD;AAClD,yCAAqC;AACrC,mCAA0E;AAE7D,QAAA,eAAe,GAAG,uBAAuB,CA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9E,CAAC;IAED,MAAM,QAAQ,GAAG,cAAc,CAAC,QAAQ,IAAI,EAAE,CAAC;IAE/C,OAAO,IAAI,sBAAc,CAAC,WAAW,EAAE,uBAAuB,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;AAC1F,CAAC","sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\n\nimport { defaultRules } from './default-rules';\nimport { InformAiError } from './inform-ai-error';\nimport { toError } from './to-error';\nimport { ResolvedConfig, ResolvedRuleConfig, RuleOptions } from './types';\n\nexport const CONFIG_FILENAME = 'webpieces.config.json';\n\n// webpieces-disable no-any-unknown -- consumer JSON config has opaque rule option values\ninterface RawConfigFile {\n extends?: string;\n rules?: Record<string, Record<string, unknown>>;\n rulesDir?: string[];\n}\n\n/**\n * Walk up from `startDir` looking for webpieces.config.json.\n */\nexport function findConfigFile(startDir: string): string | null {\n let dir = startDir;\n while (true) {\n const primary = path.join(dir, CONFIG_FILENAME);\n if (fs.existsSync(primary)) return primary;\n const parent = path.dirname(dir);\n if (parent === dir) return null;\n dir = parent;\n }\n}\n\n// webpieces-disable no-any-unknown -- merging opaque option bags from config JSON\nfunction mergeRule(\n // webpieces-disable no-any-unknown -- opaque option bag\n baseRule: Record<string, unknown> | undefined,\n // webpieces-disable no-any-unknown -- opaque option bag\n overrideRule: Record<string, unknown> | undefined,\n): ResolvedRuleConfig {\n if (!baseRule && !overrideRule) return new ResolvedRuleConfig({ mode: 'OFF' });\n if (!baseRule) return new ResolvedRuleConfig(overrideRule! as RuleOptions);\n if (!overrideRule) return new ResolvedRuleConfig(baseRule as RuleOptions);\n\n // webpieces-disable no-any-unknown -- building merged option bag\n const merged: Record<string, unknown> = {};\n for (const key of Object.keys(baseRule)) merged[key] = baseRule[key];\n for (const key of Object.keys(overrideRule)) merged[key] = overrideRule[key];\n return new ResolvedRuleConfig(merged as RuleOptions);\n}\n\nfunction readRawConfig(configPath: string): RawConfigFile {\n const raw = fs.readFileSync(configPath, 'utf8');\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions\n try {\n return JSON.parse(raw) as RawConfigFile;\n } catch (err: unknown) {\n const error = toError(err);\n throw new InformAiError(\n `webpieces.config.json has invalid JSON — fix the file, then retry.\\n` +\n `Parse error: ${error.message}\\n` +\n `File: ${configPath}`,\n );\n }\n}\n\nexport function loadConfig(cwd: string): ResolvedConfig {\n const configPath = findConfigFile(cwd);\n\n if (!configPath) {\n return new ResolvedConfig(new Map(), new Set(), [], null);\n }\n\n const consumerConfig = readRawConfig(configPath);\n const overrideRules = consumerConfig.rules || {};\n const userConfiguredRuleNames = new Set(Object.keys(overrideRules));\n const mergedRules = new Map<string, ResolvedRuleConfig>();\n\n const allRuleNames = new Set([\n ...Object.keys(defaultRules),\n ...Object.keys(overrideRules),\n ]);\n for (const name of allRuleNames) {\n mergedRules.set(name, mergeRule(defaultRules[name], overrideRules[name]));\n }\n\n const rulesDir = consumerConfig.rulesDir ?? [];\n\n return new ResolvedConfig(mergedRules, userConfiguredRuleNames, rulesDir, configPath);\n}\n"]}
|
package/src/types.d.ts
CHANGED
|
@@ -31,7 +31,8 @@ export declare class ResolvedRuleConfig {
|
|
|
31
31
|
*/
|
|
32
32
|
export declare class ResolvedConfig {
|
|
33
33
|
readonly rules: Map<string, ResolvedRuleConfig>;
|
|
34
|
+
readonly userConfiguredRuleNames: ReadonlySet<string>;
|
|
34
35
|
readonly rulesDir: readonly string[];
|
|
35
36
|
readonly configPath: string | null;
|
|
36
|
-
constructor(rules: Map<string, ResolvedRuleConfig>, rulesDir: readonly string[], configPath: string | null);
|
|
37
|
+
constructor(rules: Map<string, ResolvedRuleConfig>, userConfiguredRuleNames: ReadonlySet<string>, rulesDir: readonly string[], configPath: string | null);
|
|
37
38
|
}
|
package/src/types.js
CHANGED
|
@@ -39,8 +39,9 @@ exports.ResolvedRuleConfig = ResolvedRuleConfig;
|
|
|
39
39
|
* should treat that as "no validation configured").
|
|
40
40
|
*/
|
|
41
41
|
class ResolvedConfig {
|
|
42
|
-
constructor(rules, rulesDir, configPath) {
|
|
42
|
+
constructor(rules, userConfiguredRuleNames, rulesDir, configPath) {
|
|
43
43
|
this.rules = rules;
|
|
44
|
+
this.userConfiguredRuleNames = userConfiguredRuleNames;
|
|
44
45
|
this.rulesDir = rulesDir;
|
|
45
46
|
this.configPath = configPath;
|
|
46
47
|
}
|
package/src/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/types.ts"],"names":[],"mappings":";;;AAGA;;;;;;;;;;;;;GAaG;AACH,MAAa,kBAAkB;IAG3B,YAAY,OAAoB;QAC5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IAC3B,CAAC;IAED,oFAAoF;IACpF,IAAI,IAAI;QACJ,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAC/B,OAAO,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACjD,CAAC;IAED,iFAAiF;IACjF,IAAI,KAAK;QACL,OAAO,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC;IAC/B,CAAC;CACJ;AAjBD,gDAiBC;AAED;;;;;;;GAOG;AACH,MAAa,cAAc;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/types.ts"],"names":[],"mappings":";;;AAGA;;;;;;;;;;;;;GAaG;AACH,MAAa,kBAAkB;IAG3B,YAAY,OAAoB;QAC5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IAC3B,CAAC;IAED,oFAAoF;IACpF,IAAI,IAAI;QACJ,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAC/B,OAAO,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACjD,CAAC;IAED,iFAAiF;IACjF,IAAI,KAAK;QACL,OAAO,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC;IAC/B,CAAC;CACJ;AAjBD,gDAiBC;AAED;;;;;;;GAOG;AACH,MAAa,cAAc;IAMvB,YACI,KAAsC,EACtC,uBAA4C,EAC5C,QAA2B,EAC3B,UAAyB;QAEzB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,uBAAuB,GAAG,uBAAuB,CAAC;QACvD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IACjC,CAAC;CACJ;AAjBD,wCAiBC","sourcesContent":["// webpieces-disable no-any-unknown -- rule options are opaque at framework level; each consumer casts internally\nexport type RuleOptions = Record<string, unknown>;\n\n/**\n * One rule entry from webpieces.config.json, merged with built-in defaults.\n *\n * `options` contains the raw option bag (mode, limit, disableAllowed,\n * ignoreModifiedUntilEpoch, enforcePaths, etc). Consumers extract the\n * fields they understand and ignore the rest.\n *\n * On/off is driven entirely by `mode`: a rule is OFF only when explicitly\n * set to `mode: \"OFF\"`. Any other value (or an absent mode) leaves the rule\n * ON. For code-rules, `mode` doubles as the scope selector\n * (e.g. \"MODIFIED_CODE\", \"NEW_AND_MODIFIED_METHODS\"); for simple on/off\n * rules it is just \"ON\"/\"OFF\". (The legacy `enabled` boolean has been\n * removed in favor of this single, more flexible switch.)\n */\nexport class ResolvedRuleConfig {\n readonly options: RuleOptions;\n\n constructor(options: RuleOptions) {\n this.options = options;\n }\n\n /** Raw mode string from the option bag (\"ON\" | \"OFF\" | scope value), if present. */\n get mode(): string | undefined {\n const m = this.options['mode'];\n return typeof m === 'string' ? m : undefined;\n }\n\n /** A rule is off only when explicitly `mode: \"OFF\"`. An absent mode means on. */\n get isOff(): boolean {\n return this.mode === 'OFF';\n }\n}\n\n/**\n * The fully-resolved workspace configuration: every rule known to the\n * workspace (built-in + consumer overrides) keyed by its canonical\n * kebab-case name.\n *\n * `configPath` is null when no webpieces.config.json was found (loaders\n * should treat that as \"no validation configured\").\n */\nexport class ResolvedConfig {\n readonly rules: Map<string, ResolvedRuleConfig>;\n readonly userConfiguredRuleNames: ReadonlySet<string>;\n readonly rulesDir: readonly string[];\n readonly configPath: string | null;\n\n constructor(\n rules: Map<string, ResolvedRuleConfig>,\n userConfiguredRuleNames: ReadonlySet<string>,\n rulesDir: readonly string[],\n configPath: string | null,\n ) {\n this.rules = rules;\n this.userConfiguredRuleNames = userConfiguredRuleNames;\n this.rulesDir = rulesDir;\n this.configPath = configPath;\n }\n}\n"]}
|