@webpieces/rules-config 0.3.184 → 0.3.186
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/WebpiecesRulesConfig.d.ts +2 -1
- package/src/WebpiecesRulesConfig.js +1 -0
- package/src/WebpiecesRulesConfig.js.map +1 -1
- package/src/abstract-rule.d.ts +17 -0
- package/src/abstract-rule.js +30 -0
- package/src/abstract-rule.js.map +1 -0
- package/src/constants.d.ts +27 -0
- package/src/constants.js +48 -0
- package/src/constants.js.map +1 -0
- package/src/default-rules.js +2 -1
- package/src/default-rules.js.map +1 -1
- package/src/index.d.ts +6 -1
- package/src/index.js +32 -1
- package/src/index.js.map +1 -1
- package/src/pr-gate-config.d.ts +19 -0
- package/src/pr-gate-config.js +69 -0
- package/src/pr-gate-config.js.map +1 -0
- package/src/rule-configs.d.ts +31 -29
- package/src/rule-configs.js +51 -64
- package/src/rule-configs.js.map +1 -1
- package/src/validate-config.js +1 -0
- package/src/validate-config.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.186",
|
|
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",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MaxMethodLinesConfig, MaxFileLinesConfig, RequireReturnTypeConfig, NoInlineTypeLiteralsConfig, NoAnyUnknownConfig, NoImplicitAnyConfig, PrismaValidateDtosConfig, PrismaConverterConfig, NoDestructureConfig, NoUnmanagedExceptionsConfig, CatchErrorPatternConfig, ThrowCauseRequiredConfig, AngularNoDirectApiInResolverConfig, NoSymbolDiTokensConfig, NoShellSubstitutionConfig, BranchCreationGuardConfig, PrCreationGuardConfig, PrMergeCleanupConfig, NoDirectMainUpdateConfig, NoEditOnMainConfig, NoFileImportCyclesConfig, RuntimeArchitectureConfig, NoJsFilesConfig, ValidateTsInSrcConfig } from './rule-configs';
|
|
1
|
+
import { MaxMethodLinesConfig, MaxFileLinesConfig, RequireReturnTypeConfig, NoInlineTypeLiteralsConfig, NoAnyUnknownConfig, NoImplicitAnyConfig, PrismaValidateDtosConfig, PrismaConverterConfig, NoDestructureConfig, NoUnmanagedExceptionsConfig, CatchErrorPatternConfig, ThrowCauseRequiredConfig, AngularNoDirectApiInResolverConfig, NoSymbolDiTokensConfig, NoShellSubstitutionConfig, BranchCreationGuardConfig, PrCreationGuardConfig, MergeInProgressGuardConfig, PrMergeCleanupConfig, NoDirectMainUpdateConfig, NoEditOnMainConfig, NoFileImportCyclesConfig, RuntimeArchitectureConfig, NoJsFilesConfig, ValidateTsInSrcConfig } from './rule-configs';
|
|
2
2
|
export declare class WebpiecesRulesConfig {
|
|
3
3
|
'max-method-lines'?: MaxMethodLinesConfig;
|
|
4
4
|
'max-file-lines'?: MaxFileLinesConfig;
|
|
@@ -17,6 +17,7 @@ export declare class WebpiecesRulesConfig {
|
|
|
17
17
|
'no-shell-substitution'?: NoShellSubstitutionConfig;
|
|
18
18
|
'branch-creation-guard'?: BranchCreationGuardConfig;
|
|
19
19
|
'pr-creation-guard'?: PrCreationGuardConfig;
|
|
20
|
+
'merge-in-progress-guard'?: MergeInProgressGuardConfig;
|
|
20
21
|
'pr-merge-cleanup'?: PrMergeCleanupConfig;
|
|
21
22
|
'no-direct-main-update'?: NoDirectMainUpdateConfig;
|
|
22
23
|
'no-edit-on-main'?: NoEditOnMainConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebpiecesRulesConfig.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/WebpiecesRulesConfig.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"WebpiecesRulesConfig.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/WebpiecesRulesConfig.ts"],"names":[],"mappings":";;;AA4BA,MAAa,oBAAoB;IAC7B,kBAAkB,CAAwB;IAC1C,gBAAgB,CAAsB;IACtC,qBAAqB,CAA2B;IAChD,yBAAyB,CAA8B;IACvD,gBAAgB,CAAsB;IACtC,iBAAiB,CAAuB;IACxC,sBAAsB,CAA4B;IAClD,kBAAkB,CAAyB;IAC3C,gBAAgB,CAAuB;IACvC,yBAAyB,CAA+B;IACxD,qBAAqB,CAA2B;IAChD,sBAAsB,CAA4B;IAClD,mCAAmC,CAAsC;IACzE,qBAAqB,CAA0B;IAC/C,uBAAuB,CAA6B;IACpD,uBAAuB,CAA6B;IACpD,mBAAmB,CAAyB;IAC5C,yBAAyB,CAA8B;IACvD,kBAAkB,CAAwB;IAC1C,uBAAuB,CAA4B;IACnD,iBAAiB,CAAsB;IACvC,uBAAuB,CAA4B;IACnD,sBAAsB,CAA6B;IACnD,aAAa,CAAmB;IAChC,oBAAoB,CAAyB;IAC7C,QAAQ,CAAY;CACvB;AA3BD,oDA2BC","sourcesContent":["import {\n MaxMethodLinesConfig,\n MaxFileLinesConfig,\n RequireReturnTypeConfig,\n NoInlineTypeLiteralsConfig,\n NoAnyUnknownConfig,\n NoImplicitAnyConfig,\n PrismaValidateDtosConfig,\n PrismaConverterConfig,\n NoDestructureConfig,\n NoUnmanagedExceptionsConfig,\n CatchErrorPatternConfig,\n ThrowCauseRequiredConfig,\n AngularNoDirectApiInResolverConfig,\n NoSymbolDiTokensConfig,\n NoShellSubstitutionConfig,\n BranchCreationGuardConfig,\n PrCreationGuardConfig,\n MergeInProgressGuardConfig,\n PrMergeCleanupConfig,\n NoDirectMainUpdateConfig,\n NoEditOnMainConfig,\n NoFileImportCyclesConfig,\n RuntimeArchitectureConfig,\n NoJsFilesConfig,\n ValidateTsInSrcConfig,\n} from './rule-configs';\n\nexport class WebpiecesRulesConfig {\n 'max-method-lines'?: MaxMethodLinesConfig;\n 'max-file-lines'?: MaxFileLinesConfig;\n 'require-return-type'?: RequireReturnTypeConfig;\n 'no-inline-type-literals'?: NoInlineTypeLiteralsConfig;\n 'no-any-unknown'?: NoAnyUnknownConfig;\n 'no-implicit-any'?: NoImplicitAnyConfig;\n 'prisma-validate-dtos'?: PrismaValidateDtosConfig;\n 'prisma-converter'?: PrismaConverterConfig;\n 'no-destructure'?: NoDestructureConfig;\n 'no-unmanaged-exceptions'?: NoUnmanagedExceptionsConfig;\n 'catch-error-pattern'?: CatchErrorPatternConfig;\n 'throw-cause-required'?: ThrowCauseRequiredConfig;\n 'angular-no-direct-api-in-resolver'?: AngularNoDirectApiInResolverConfig;\n 'no-symbol-di-tokens'?: NoSymbolDiTokensConfig;\n 'no-shell-substitution'?: NoShellSubstitutionConfig;\n 'branch-creation-guard'?: BranchCreationGuardConfig;\n 'pr-creation-guard'?: PrCreationGuardConfig;\n 'merge-in-progress-guard'?: MergeInProgressGuardConfig;\n 'pr-merge-cleanup'?: PrMergeCleanupConfig;\n 'no-direct-main-update'?: NoDirectMainUpdateConfig;\n 'no-edit-on-main'?: NoEditOnMainConfig;\n 'no-file-import-cycles'?: NoFileImportCyclesConfig;\n 'runtime-architecture'?: RuntimeArchitectureConfig;\n 'no-js-files'?: NoJsFilesConfig;\n 'validate-ts-in-src'?: ValidateTsInSrcConfig;\n rulesDir?: string[];\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BaseRuleConfig } from './rule-configs';
|
|
2
|
+
/**
|
|
3
|
+
* Shared base for every rule in BOTH packages (ai-hook-rules and code-rules). A rule is
|
|
4
|
+
* constructed with its typed config (`new NoAnyUnknownRule(config['no-any-unknown'])`), so the
|
|
5
|
+
* config class is genuinely consumed — find-usages/rename work across packages.
|
|
6
|
+
*
|
|
7
|
+
* It is execution-agnostic: it owns only `name` + the on/off + escape-hatch decision
|
|
8
|
+
* (`shouldRun`). Each package's base adds its own execution surface (ai-hook `check(ctx)`,
|
|
9
|
+
* code-rules `run(workspaceRoot)`), so rules-config stays free of package-specific types.
|
|
10
|
+
*/
|
|
11
|
+
export declare abstract class AbstractRule<C extends BaseRuleConfig> {
|
|
12
|
+
protected readonly config: C;
|
|
13
|
+
readonly name: string;
|
|
14
|
+
constructor(config: C, name: string);
|
|
15
|
+
/** True unless the rule is `mode: "OFF"` or skipped by a branch/epoch escape hatch. */
|
|
16
|
+
shouldRun(): boolean;
|
|
17
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AbstractRule = void 0;
|
|
4
|
+
const skip_rule_1 = require("./skip-rule");
|
|
5
|
+
/**
|
|
6
|
+
* Shared base for every rule in BOTH packages (ai-hook-rules and code-rules). A rule is
|
|
7
|
+
* constructed with its typed config (`new NoAnyUnknownRule(config['no-any-unknown'])`), so the
|
|
8
|
+
* config class is genuinely consumed — find-usages/rename work across packages.
|
|
9
|
+
*
|
|
10
|
+
* It is execution-agnostic: it owns only `name` + the on/off + escape-hatch decision
|
|
11
|
+
* (`shouldRun`). Each package's base adds its own execution surface (ai-hook `check(ctx)`,
|
|
12
|
+
* code-rules `run(workspaceRoot)`), so rules-config stays free of package-specific types.
|
|
13
|
+
*/
|
|
14
|
+
class AbstractRule {
|
|
15
|
+
config;
|
|
16
|
+
name;
|
|
17
|
+
constructor(config, name) {
|
|
18
|
+
this.config = config;
|
|
19
|
+
this.name = name;
|
|
20
|
+
}
|
|
21
|
+
/** True unless the rule is `mode: "OFF"` or skipped by a branch/epoch escape hatch. */
|
|
22
|
+
shouldRun() {
|
|
23
|
+
if (this.config.mode === 'OFF')
|
|
24
|
+
return false;
|
|
25
|
+
const skip = (0, skip_rule_1.shouldSkipRule)(this.config.ignoreModifiedUntilEpoch, this.config.ignoreRuleWhileOnBranch);
|
|
26
|
+
return !skip.skip;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.AbstractRule = AbstractRule;
|
|
30
|
+
//# sourceMappingURL=abstract-rule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abstract-rule.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/abstract-rule.ts"],"names":[],"mappings":";;;AACA,2CAA6C;AAE7C;;;;;;;;GAQG;AACH,MAAsB,YAAY;IACC;IAAoB;IAAnD,YAA+B,MAAS,EAAW,IAAY;QAAhC,WAAM,GAAN,MAAM,CAAG;QAAW,SAAI,GAAJ,IAAI,CAAQ;IAAG,CAAC;IAEnE,uFAAuF;IACvF,SAAS;QACL,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,KAAK;YAAE,OAAO,KAAK,CAAC;QAC7C,MAAM,IAAI,GAAG,IAAA,0BAAc,EAAC,IAAI,CAAC,MAAM,CAAC,wBAAwB,EAAE,IAAI,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC;QACvG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;IACtB,CAAC;CACJ;AATD,oCASC","sourcesContent":["import { BaseRuleConfig } from './rule-configs';\nimport { shouldSkipRule } from './skip-rule';\n\n/**\n * Shared base for every rule in BOTH packages (ai-hook-rules and code-rules). A rule is\n * constructed with its typed config (`new NoAnyUnknownRule(config['no-any-unknown'])`), so the\n * config class is genuinely consumed — find-usages/rename work across packages.\n *\n * It is execution-agnostic: it owns only `name` + the on/off + escape-hatch decision\n * (`shouldRun`). Each package's base adds its own execution surface (ai-hook `check(ctx)`,\n * code-rules `run(workspaceRoot)`), so rules-config stays free of package-specific types.\n */\nexport abstract class AbstractRule<C extends BaseRuleConfig> {\n constructor(protected readonly config: C, readonly name: string) {}\n\n /** True unless the rule is `mode: \"OFF\"` or skipped by a branch/epoch escape hatch. */\n shouldRun(): boolean {\n if (this.config.mode === 'OFF') return false;\n const skip = shouldSkipRule(this.config.ignoreModifiedUntilEpoch, this.config.ignoreRuleWhileOnBranch);\n return !skip.skip;\n }\n}\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare const WEBPIECES_DISABLE = "webpieces-disable";
|
|
2
|
+
export declare const RULE_NAMES: {
|
|
3
|
+
readonly NO_ANY_UNKNOWN: "no-any-unknown";
|
|
4
|
+
readonly NO_IMPLICIT_ANY: "no-implicit-any";
|
|
5
|
+
readonly NO_DESTRUCTURE: "no-destructure";
|
|
6
|
+
readonly NO_UNMANAGED_EXCEPTIONS: "no-unmanaged-exceptions";
|
|
7
|
+
readonly CATCH_ERROR_PATTERN: "catch-error-pattern";
|
|
8
|
+
readonly THROW_CAUSE_REQUIRED: "throw-cause-required";
|
|
9
|
+
readonly REQUIRE_RETURN_TYPE: "require-return-type";
|
|
10
|
+
readonly NO_SYMBOL_DI_TOKENS: "no-symbol-di-tokens";
|
|
11
|
+
readonly NO_INLINE_TYPES: "no-inline-types";
|
|
12
|
+
readonly NO_DIRECT_API_RESOLVER: "no-direct-api-resolver";
|
|
13
|
+
readonly PRISMA_CONVERTER: "prisma-converter";
|
|
14
|
+
readonly MAX_LINES_NEW_METHODS: "max-lines-new-methods";
|
|
15
|
+
readonly MAX_LINES_MODIFIED_FILES: "max-lines-modified-files";
|
|
16
|
+
readonly MAX_LINES_MODIFIED: "max-lines-modified";
|
|
17
|
+
};
|
|
18
|
+
export declare const WEBPIECES_TMP_DIR = "webpiecesTmp";
|
|
19
|
+
export declare const MERGE_DIR_PREFIX = "merge-";
|
|
20
|
+
export declare const MERGE_IN_PROGRESS_FILE = "merge-in-progress.json";
|
|
21
|
+
/**
|
|
22
|
+
* Fast predicate: does this text carry a webpieces-disable for the given rule?
|
|
23
|
+
* Line-agnostic — the caller decides which line(s) or block of text to feed it.
|
|
24
|
+
* This is the cheap substring form used by code-rules detection and pr-gate's
|
|
25
|
+
* dashboard grep/count. (ai-hook-rules uses a richer line-mapping parser.)
|
|
26
|
+
*/
|
|
27
|
+
export declare function hasDisable(text: string, ruleName: string): boolean;
|
package/src/constants.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Single source of truth for the disable-comment token and rule-name identifiers
|
|
3
|
+
// shared across rules-config, ai-hook-rules, code-rules, and pr-gate.
|
|
4
|
+
//
|
|
5
|
+
// There is exactly ONE disable form: `// webpieces-disable <rule>[, <rule2>] -- reason`.
|
|
6
|
+
// The legacy `ai-hook-disable` alias and the `-file`/`-next`/`-all` variants and the
|
|
7
|
+
// `*`/bare (no-rule) wildcard have been removed — every disable MUST name a rule.
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.MERGE_IN_PROGRESS_FILE = exports.MERGE_DIR_PREFIX = exports.WEBPIECES_TMP_DIR = exports.RULE_NAMES = exports.WEBPIECES_DISABLE = void 0;
|
|
10
|
+
exports.hasDisable = hasDisable;
|
|
11
|
+
exports.WEBPIECES_DISABLE = 'webpieces-disable';
|
|
12
|
+
// Rule-name tokens as they appear AFTER `webpieces-disable` in a disable comment.
|
|
13
|
+
// Values must match existing comments exactly — changing a value silently breaks every
|
|
14
|
+
// disable that names that rule. Note MAX_LINES_MODIFIED is a prefix of
|
|
15
|
+
// MAX_LINES_MODIFIED_FILES (a historical substring-match quirk preserved on purpose).
|
|
16
|
+
exports.RULE_NAMES = {
|
|
17
|
+
NO_ANY_UNKNOWN: 'no-any-unknown',
|
|
18
|
+
NO_IMPLICIT_ANY: 'no-implicit-any',
|
|
19
|
+
NO_DESTRUCTURE: 'no-destructure',
|
|
20
|
+
NO_UNMANAGED_EXCEPTIONS: 'no-unmanaged-exceptions',
|
|
21
|
+
CATCH_ERROR_PATTERN: 'catch-error-pattern',
|
|
22
|
+
THROW_CAUSE_REQUIRED: 'throw-cause-required',
|
|
23
|
+
REQUIRE_RETURN_TYPE: 'require-return-type',
|
|
24
|
+
NO_SYMBOL_DI_TOKENS: 'no-symbol-di-tokens',
|
|
25
|
+
NO_INLINE_TYPES: 'no-inline-types',
|
|
26
|
+
NO_DIRECT_API_RESOLVER: 'no-direct-api-resolver',
|
|
27
|
+
PRISMA_CONVERTER: 'prisma-converter',
|
|
28
|
+
MAX_LINES_NEW_METHODS: 'max-lines-new-methods',
|
|
29
|
+
MAX_LINES_MODIFIED_FILES: 'max-lines-modified-files',
|
|
30
|
+
MAX_LINES_MODIFIED: 'max-lines-modified',
|
|
31
|
+
};
|
|
32
|
+
// Merge-state convention shared by the pr-gate scripts (which WRITE the marker during a
|
|
33
|
+
// conflicted 3-point merge) and the ai-hook-rules merge-in-progress-guard (which READS it
|
|
34
|
+
// to block commit/push/PR until the merge is validated). Kept here so neither package
|
|
35
|
+
// depends on the other — they only share this vocabulary.
|
|
36
|
+
exports.WEBPIECES_TMP_DIR = 'webpiecesTmp';
|
|
37
|
+
exports.MERGE_DIR_PREFIX = 'merge-';
|
|
38
|
+
exports.MERGE_IN_PROGRESS_FILE = 'merge-in-progress.json';
|
|
39
|
+
/**
|
|
40
|
+
* Fast predicate: does this text carry a webpieces-disable for the given rule?
|
|
41
|
+
* Line-agnostic — the caller decides which line(s) or block of text to feed it.
|
|
42
|
+
* This is the cheap substring form used by code-rules detection and pr-gate's
|
|
43
|
+
* dashboard grep/count. (ai-hook-rules uses a richer line-mapping parser.)
|
|
44
|
+
*/
|
|
45
|
+
function hasDisable(text, ruleName) {
|
|
46
|
+
return text.includes(exports.WEBPIECES_DISABLE) && text.includes(ruleName);
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/constants.ts"],"names":[],"mappings":";AAAA,iFAAiF;AACjF,sEAAsE;AACtE,EAAE;AACF,yFAAyF;AACzF,qFAAqF;AACrF,kFAAkF;;;AAuClF,gCAEC;AAvCY,QAAA,iBAAiB,GAAG,mBAAmB,CAAC;AAErD,kFAAkF;AAClF,uFAAuF;AACvF,uEAAuE;AACvE,sFAAsF;AACzE,QAAA,UAAU,GAAG;IACtB,cAAc,EAAE,gBAAgB;IAChC,eAAe,EAAE,iBAAiB;IAClC,cAAc,EAAE,gBAAgB;IAChC,uBAAuB,EAAE,yBAAyB;IAClD,mBAAmB,EAAE,qBAAqB;IAC1C,oBAAoB,EAAE,sBAAsB;IAC5C,mBAAmB,EAAE,qBAAqB;IAC1C,mBAAmB,EAAE,qBAAqB;IAC1C,eAAe,EAAE,iBAAiB;IAClC,sBAAsB,EAAE,wBAAwB;IAChD,gBAAgB,EAAE,kBAAkB;IACpC,qBAAqB,EAAE,uBAAuB;IAC9C,wBAAwB,EAAE,0BAA0B;IACpD,kBAAkB,EAAE,oBAAoB;CAClC,CAAC;AAEX,wFAAwF;AACxF,0FAA0F;AAC1F,sFAAsF;AACtF,0DAA0D;AAC7C,QAAA,iBAAiB,GAAG,cAAc,CAAC;AACnC,QAAA,gBAAgB,GAAG,QAAQ,CAAC;AAC5B,QAAA,sBAAsB,GAAG,wBAAwB,CAAC;AAE/D;;;;;GAKG;AACH,SAAgB,UAAU,CAAC,IAAY,EAAE,QAAgB;IACrD,OAAO,IAAI,CAAC,QAAQ,CAAC,yBAAiB,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACvE,CAAC","sourcesContent":["// Single source of truth for the disable-comment token and rule-name identifiers\n// shared across rules-config, ai-hook-rules, code-rules, and pr-gate.\n//\n// There is exactly ONE disable form: `// webpieces-disable <rule>[, <rule2>] -- reason`.\n// The legacy `ai-hook-disable` alias and the `-file`/`-next`/`-all` variants and the\n// `*`/bare (no-rule) wildcard have been removed — every disable MUST name a rule.\n\nexport const WEBPIECES_DISABLE = 'webpieces-disable';\n\n// Rule-name tokens as they appear AFTER `webpieces-disable` in a disable comment.\n// Values must match existing comments exactly — changing a value silently breaks every\n// disable that names that rule. Note MAX_LINES_MODIFIED is a prefix of\n// MAX_LINES_MODIFIED_FILES (a historical substring-match quirk preserved on purpose).\nexport const RULE_NAMES = {\n NO_ANY_UNKNOWN: 'no-any-unknown',\n NO_IMPLICIT_ANY: 'no-implicit-any',\n NO_DESTRUCTURE: 'no-destructure',\n NO_UNMANAGED_EXCEPTIONS: 'no-unmanaged-exceptions',\n CATCH_ERROR_PATTERN: 'catch-error-pattern',\n THROW_CAUSE_REQUIRED: 'throw-cause-required',\n REQUIRE_RETURN_TYPE: 'require-return-type',\n NO_SYMBOL_DI_TOKENS: 'no-symbol-di-tokens',\n NO_INLINE_TYPES: 'no-inline-types',\n NO_DIRECT_API_RESOLVER: 'no-direct-api-resolver',\n PRISMA_CONVERTER: 'prisma-converter',\n MAX_LINES_NEW_METHODS: 'max-lines-new-methods',\n MAX_LINES_MODIFIED_FILES: 'max-lines-modified-files',\n MAX_LINES_MODIFIED: 'max-lines-modified',\n} as const;\n\n// Merge-state convention shared by the pr-gate scripts (which WRITE the marker during a\n// conflicted 3-point merge) and the ai-hook-rules merge-in-progress-guard (which READS it\n// to block commit/push/PR until the merge is validated). Kept here so neither package\n// depends on the other — they only share this vocabulary.\nexport const WEBPIECES_TMP_DIR = 'webpiecesTmp';\nexport const MERGE_DIR_PREFIX = 'merge-';\nexport const MERGE_IN_PROGRESS_FILE = 'merge-in-progress.json';\n\n/**\n * Fast predicate: does this text carry a webpieces-disable for the given rule?\n * Line-agnostic — the caller decides which line(s) or block of text to feed it.\n * This is the cheap substring form used by code-rules detection and pr-gate's\n * dashboard grep/count. (ai-hook-rules uses a richer line-mapping parser.)\n */\nexport function hasDisable(text: string, ruleName: string): boolean {\n return text.includes(WEBPIECES_DISABLE) && text.includes(ruleName);\n}\n"]}
|
package/src/default-rules.js
CHANGED
|
@@ -38,7 +38,8 @@ exports.defaultRules = {
|
|
|
38
38
|
},
|
|
39
39
|
'no-js-files': { mode: 'OFF' },
|
|
40
40
|
'branch-creation-guard': { mode: 'ON', subBranchNaming: 'feature/<ticket>/<short-description>' },
|
|
41
|
-
'pr-creation-guard': { mode: 'ON'
|
|
41
|
+
'pr-creation-guard': { mode: 'ON' },
|
|
42
|
+
'merge-in-progress-guard': { mode: 'ON' },
|
|
42
43
|
'pr-merge-cleanup': { mode: 'ON' },
|
|
43
44
|
'no-direct-main-update': { mode: 'ON' },
|
|
44
45
|
};
|
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,eAAe,EAAE,sCAAsC,EAAE;IAChG,mBAAmB,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,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,eAAe,EAAE,sCAAsC,EAAE;IAChG,mBAAmB,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;IACnC,yBAAyB,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;IACzC,kBAAkB,EAAE,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 'merge-in-progress-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/index.d.ts
CHANGED
|
@@ -11,5 +11,10 @@ export { FieldDef } from './field-def';
|
|
|
11
11
|
export type { SchemaShape } from './field-def';
|
|
12
12
|
export { shouldSkipRule, getCurrentBranch } from './skip-rule';
|
|
13
13
|
export type { SkipRuleResult } from './skip-rule';
|
|
14
|
+
export { AbstractRule } from './abstract-rule';
|
|
15
|
+
export { WEBPIECES_DISABLE, RULE_NAMES, hasDisable, WEBPIECES_TMP_DIR, MERGE_DIR_PREFIX, MERGE_IN_PROGRESS_FILE, } from './constants';
|
|
14
16
|
export { WebpiecesRulesConfig } from './WebpiecesRulesConfig';
|
|
15
|
-
export { MaxMethodLinesConfig, MaxFileLinesConfig, RequireReturnTypeConfig, NoInlineTypeLiteralsConfig, NoAnyUnknownConfig, NoImplicitAnyConfig, PrismaValidateDtosConfig, PrismaConverterConfig, NoDestructureConfig, NoUnmanagedExceptionsConfig, CatchErrorPatternConfig, ThrowCauseRequiredConfig, AngularNoDirectApiInResolverConfig, NoSymbolDiTokensConfig, NoShellSubstitutionConfig, BranchCreationGuardConfig, PrCreationGuardConfig, PrMergeCleanupConfig, NoDirectMainUpdateConfig, NoEditOnMainConfig, NoFileImportCyclesConfig, RuntimeArchitectureConfig, NoJsFilesConfig, ValidateTsInSrcConfig, } from './rule-configs';
|
|
17
|
+
export { MaxMethodLinesConfig, MaxFileLinesConfig, RequireReturnTypeConfig, NoInlineTypeLiteralsConfig, NoAnyUnknownConfig, NoImplicitAnyConfig, PrismaValidateDtosConfig, PrismaConverterConfig, NoDestructureConfig, NoUnmanagedExceptionsConfig, CatchErrorPatternConfig, ThrowCauseRequiredConfig, AngularNoDirectApiInResolverConfig, NoSymbolDiTokensConfig, NoShellSubstitutionConfig, BranchCreationGuardConfig, PrCreationGuardConfig, MergeInProgressGuardConfig, PrMergeCleanupConfig, NoDirectMainUpdateConfig, NoEditOnMainConfig, NoFileImportCyclesConfig, RuntimeArchitectureConfig, NoJsFilesConfig, ValidateTsInSrcConfig, BaseRuleConfig, } from './rule-configs';
|
|
18
|
+
export { METHOD_LIMIT_MODES, FILE_LIMIT_MODES, RETURN_TYPE_MODES, INLINE_TYPE_MODES, MODIFIED_CODE_MODES, PRISMA_DTOS_MODES, PRISMA_CONVERTER_MODES, DIRECT_API_RESOLVER_MODES, THROW_CAUSE_MODES, ON_OFF_MODES, VALIDATE_TS_MODES, } from './rule-configs';
|
|
19
|
+
export type { MethodLimitMode, FileLimitMode, ReturnTypeMode, InlineTypeMode, ModifiedCodeMode, PrismaValidateDtosMode, PrismaConverterMode, DirectApiResolverMode, ThrowCauseMode, OnOffMode, ValidateTsMode, } from './rule-configs';
|
|
20
|
+
export { GateDefinition, PrGateConfig, defaultGates, defaultPrGateConfig, loadPrGateConfig, } from './pr-gate-config';
|
package/src/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.NoJsFilesConfig = exports.RuntimeArchitectureConfig = exports.NoFileImportCyclesConfig = exports.NoEditOnMainConfig = exports.NoDirectMainUpdateConfig = exports.PrMergeCleanupConfig = exports.MergeInProgressGuardConfig = exports.PrCreationGuardConfig = exports.BranchCreationGuardConfig = exports.NoShellSubstitutionConfig = exports.NoSymbolDiTokensConfig = exports.AngularNoDirectApiInResolverConfig = exports.ThrowCauseRequiredConfig = exports.CatchErrorPatternConfig = exports.NoUnmanagedExceptionsConfig = exports.NoDestructureConfig = exports.PrismaConverterConfig = exports.PrismaValidateDtosConfig = exports.NoImplicitAnyConfig = exports.NoAnyUnknownConfig = exports.NoInlineTypeLiteralsConfig = exports.RequireReturnTypeConfig = exports.MaxFileLinesConfig = exports.MaxMethodLinesConfig = exports.WebpiecesRulesConfig = exports.MERGE_IN_PROGRESS_FILE = exports.MERGE_DIR_PREFIX = exports.WEBPIECES_TMP_DIR = exports.hasDisable = exports.RULE_NAMES = exports.WEBPIECES_DISABLE = exports.AbstractRule = exports.getCurrentBranch = exports.shouldSkipRule = exports.FieldDef = exports.validateWebpiecesConfig = exports.writeTemplate = exports.writeTemplateIfMissing = exports.loadTemplate = exports.defaultRulesDir = exports.defaultRules = exports.isPathExcluded = exports.loadWebpiecesRulesConfig = exports.CONFIG_FILENAME = exports.findConfigFile = exports.loadConfig = exports.toError = exports.InformAiError = exports.ResolvedRuleConfig = exports.ResolvedConfig = void 0;
|
|
4
|
+
exports.loadPrGateConfig = exports.defaultPrGateConfig = exports.defaultGates = exports.PrGateConfig = exports.GateDefinition = exports.VALIDATE_TS_MODES = exports.ON_OFF_MODES = exports.THROW_CAUSE_MODES = exports.DIRECT_API_RESOLVER_MODES = exports.PRISMA_CONVERTER_MODES = exports.PRISMA_DTOS_MODES = exports.MODIFIED_CODE_MODES = exports.INLINE_TYPE_MODES = exports.RETURN_TYPE_MODES = exports.FILE_LIMIT_MODES = exports.METHOD_LIMIT_MODES = exports.BaseRuleConfig = exports.ValidateTsInSrcConfig = void 0;
|
|
4
5
|
var types_1 = require("./types");
|
|
5
6
|
Object.defineProperty(exports, "ResolvedConfig", { enumerable: true, get: function () { return types_1.ResolvedConfig; } });
|
|
6
7
|
Object.defineProperty(exports, "ResolvedRuleConfig", { enumerable: true, get: function () { return types_1.ResolvedRuleConfig; } });
|
|
@@ -29,6 +30,15 @@ Object.defineProperty(exports, "FieldDef", { enumerable: true, get: function ()
|
|
|
29
30
|
var skip_rule_1 = require("./skip-rule");
|
|
30
31
|
Object.defineProperty(exports, "shouldSkipRule", { enumerable: true, get: function () { return skip_rule_1.shouldSkipRule; } });
|
|
31
32
|
Object.defineProperty(exports, "getCurrentBranch", { enumerable: true, get: function () { return skip_rule_1.getCurrentBranch; } });
|
|
33
|
+
var abstract_rule_1 = require("./abstract-rule");
|
|
34
|
+
Object.defineProperty(exports, "AbstractRule", { enumerable: true, get: function () { return abstract_rule_1.AbstractRule; } });
|
|
35
|
+
var constants_1 = require("./constants");
|
|
36
|
+
Object.defineProperty(exports, "WEBPIECES_DISABLE", { enumerable: true, get: function () { return constants_1.WEBPIECES_DISABLE; } });
|
|
37
|
+
Object.defineProperty(exports, "RULE_NAMES", { enumerable: true, get: function () { return constants_1.RULE_NAMES; } });
|
|
38
|
+
Object.defineProperty(exports, "hasDisable", { enumerable: true, get: function () { return constants_1.hasDisable; } });
|
|
39
|
+
Object.defineProperty(exports, "WEBPIECES_TMP_DIR", { enumerable: true, get: function () { return constants_1.WEBPIECES_TMP_DIR; } });
|
|
40
|
+
Object.defineProperty(exports, "MERGE_DIR_PREFIX", { enumerable: true, get: function () { return constants_1.MERGE_DIR_PREFIX; } });
|
|
41
|
+
Object.defineProperty(exports, "MERGE_IN_PROGRESS_FILE", { enumerable: true, get: function () { return constants_1.MERGE_IN_PROGRESS_FILE; } });
|
|
32
42
|
var WebpiecesRulesConfig_1 = require("./WebpiecesRulesConfig");
|
|
33
43
|
Object.defineProperty(exports, "WebpiecesRulesConfig", { enumerable: true, get: function () { return WebpiecesRulesConfig_1.WebpiecesRulesConfig; } });
|
|
34
44
|
var rule_configs_1 = require("./rule-configs");
|
|
@@ -49,6 +59,7 @@ Object.defineProperty(exports, "NoSymbolDiTokensConfig", { enumerable: true, get
|
|
|
49
59
|
Object.defineProperty(exports, "NoShellSubstitutionConfig", { enumerable: true, get: function () { return rule_configs_1.NoShellSubstitutionConfig; } });
|
|
50
60
|
Object.defineProperty(exports, "BranchCreationGuardConfig", { enumerable: true, get: function () { return rule_configs_1.BranchCreationGuardConfig; } });
|
|
51
61
|
Object.defineProperty(exports, "PrCreationGuardConfig", { enumerable: true, get: function () { return rule_configs_1.PrCreationGuardConfig; } });
|
|
62
|
+
Object.defineProperty(exports, "MergeInProgressGuardConfig", { enumerable: true, get: function () { return rule_configs_1.MergeInProgressGuardConfig; } });
|
|
52
63
|
Object.defineProperty(exports, "PrMergeCleanupConfig", { enumerable: true, get: function () { return rule_configs_1.PrMergeCleanupConfig; } });
|
|
53
64
|
Object.defineProperty(exports, "NoDirectMainUpdateConfig", { enumerable: true, get: function () { return rule_configs_1.NoDirectMainUpdateConfig; } });
|
|
54
65
|
Object.defineProperty(exports, "NoEditOnMainConfig", { enumerable: true, get: function () { return rule_configs_1.NoEditOnMainConfig; } });
|
|
@@ -56,4 +67,24 @@ Object.defineProperty(exports, "NoFileImportCyclesConfig", { enumerable: true, g
|
|
|
56
67
|
Object.defineProperty(exports, "RuntimeArchitectureConfig", { enumerable: true, get: function () { return rule_configs_1.RuntimeArchitectureConfig; } });
|
|
57
68
|
Object.defineProperty(exports, "NoJsFilesConfig", { enumerable: true, get: function () { return rule_configs_1.NoJsFilesConfig; } });
|
|
58
69
|
Object.defineProperty(exports, "ValidateTsInSrcConfig", { enumerable: true, get: function () { return rule_configs_1.ValidateTsInSrcConfig; } });
|
|
70
|
+
Object.defineProperty(exports, "BaseRuleConfig", { enumerable: true, get: function () { return rule_configs_1.BaseRuleConfig; } });
|
|
71
|
+
// Mode unions + their value arrays — the single source of truth shared with code-rules.
|
|
72
|
+
var rule_configs_2 = require("./rule-configs");
|
|
73
|
+
Object.defineProperty(exports, "METHOD_LIMIT_MODES", { enumerable: true, get: function () { return rule_configs_2.METHOD_LIMIT_MODES; } });
|
|
74
|
+
Object.defineProperty(exports, "FILE_LIMIT_MODES", { enumerable: true, get: function () { return rule_configs_2.FILE_LIMIT_MODES; } });
|
|
75
|
+
Object.defineProperty(exports, "RETURN_TYPE_MODES", { enumerable: true, get: function () { return rule_configs_2.RETURN_TYPE_MODES; } });
|
|
76
|
+
Object.defineProperty(exports, "INLINE_TYPE_MODES", { enumerable: true, get: function () { return rule_configs_2.INLINE_TYPE_MODES; } });
|
|
77
|
+
Object.defineProperty(exports, "MODIFIED_CODE_MODES", { enumerable: true, get: function () { return rule_configs_2.MODIFIED_CODE_MODES; } });
|
|
78
|
+
Object.defineProperty(exports, "PRISMA_DTOS_MODES", { enumerable: true, get: function () { return rule_configs_2.PRISMA_DTOS_MODES; } });
|
|
79
|
+
Object.defineProperty(exports, "PRISMA_CONVERTER_MODES", { enumerable: true, get: function () { return rule_configs_2.PRISMA_CONVERTER_MODES; } });
|
|
80
|
+
Object.defineProperty(exports, "DIRECT_API_RESOLVER_MODES", { enumerable: true, get: function () { return rule_configs_2.DIRECT_API_RESOLVER_MODES; } });
|
|
81
|
+
Object.defineProperty(exports, "THROW_CAUSE_MODES", { enumerable: true, get: function () { return rule_configs_2.THROW_CAUSE_MODES; } });
|
|
82
|
+
Object.defineProperty(exports, "ON_OFF_MODES", { enumerable: true, get: function () { return rule_configs_2.ON_OFF_MODES; } });
|
|
83
|
+
Object.defineProperty(exports, "VALIDATE_TS_MODES", { enumerable: true, get: function () { return rule_configs_2.VALIDATE_TS_MODES; } });
|
|
84
|
+
var pr_gate_config_1 = require("./pr-gate-config");
|
|
85
|
+
Object.defineProperty(exports, "GateDefinition", { enumerable: true, get: function () { return pr_gate_config_1.GateDefinition; } });
|
|
86
|
+
Object.defineProperty(exports, "PrGateConfig", { enumerable: true, get: function () { return pr_gate_config_1.PrGateConfig; } });
|
|
87
|
+
Object.defineProperty(exports, "defaultGates", { enumerable: true, get: function () { return pr_gate_config_1.defaultGates; } });
|
|
88
|
+
Object.defineProperty(exports, "defaultPrGateConfig", { enumerable: true, get: function () { return pr_gate_config_1.defaultPrGateConfig; } });
|
|
89
|
+
Object.defineProperty(exports, "loadPrGateConfig", { enumerable: true, get: function () { return pr_gate_config_1.loadPrGateConfig; } });
|
|
59
90
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/index.ts"],"names":[],"mappings":";;;;AAAA,iCAA0E;AAAjE,uGAAA,cAAc,OAAA;AAAE,2GAAA,kBAAkB,OAAA;AAC3C,qDAAkD;AAAzC,gHAAA,aAAa,OAAA;AACtB,uCAAqC;AAA5B,mGAAA,OAAO,OAAA;AAChB,6CAAsG;AAA7F,yGAAA,UAAU,OAAA;AAAE,6GAAA,cAAc,OAAA;AAAE,8GAAA,eAAe,OAAA;AAAE,uHAAA,wBAAwB,OAAA;AAE9E,iDAAiD;AAAxC,+GAAA,cAAc,OAAA;AACvB,iDAAgE;AAAvD,6GAAA,YAAY,OAAA;AAAE,gHAAA,eAAe,OAAA;AACtC,iDAAsF;AAA7E,6GAAA,YAAY,OAAA;AAAE,uHAAA,sBAAsB,OAAA;AAAE,8GAAA,aAAa,OAAA;AAC5D,qDAA4D;AAAnD,0HAAA,uBAAuB,OAAA;AAChC,yCAAuC;AAA9B,qGAAA,QAAQ,OAAA;AAEjB,yCAA+D;AAAtD,2GAAA,cAAc,OAAA;AAAE,6GAAA,gBAAgB,OAAA;AAEzC,iDAA+C;AAAtC,6GAAA,YAAY,OAAA;AACrB,yCAOqB;AANjB,8GAAA,iBAAiB,OAAA;AACjB,uGAAA,UAAU,OAAA;AACV,uGAAA,UAAU,OAAA;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;AACd,8GAAA,YAAY,OAAA;AACZ,8GAAA,YAAY,OAAA;AACZ,qHAAA,mBAAmB,OAAA;AACnB,kHAAA,gBAAgB,OAAA","sourcesContent":["export { ResolvedConfig, ResolvedRuleConfig, RuleOptions } from './types';\nexport { InformAiError } from './inform-ai-error';\nexport { toError } from './to-error';\nexport { loadConfig, findConfigFile, CONFIG_FILENAME, loadWebpiecesRulesConfig } from './load-config';\nexport type { LoadedWebpiecesConfig } from './load-config';\nexport { isPathExcluded } from './exclude-paths';\nexport { defaultRules, defaultRulesDir } from './default-rules';\nexport { loadTemplate, writeTemplateIfMissing, writeTemplate } from './load-template';\nexport { validateWebpiecesConfig } from './validate-config';\nexport { FieldDef } from './field-def';\nexport type { SchemaShape } from './field-def';\nexport { shouldSkipRule, getCurrentBranch } from './skip-rule';\nexport type { SkipRuleResult } from './skip-rule';\nexport { AbstractRule } from './abstract-rule';\nexport {\n WEBPIECES_DISABLE,\n RULE_NAMES,\n hasDisable,\n WEBPIECES_TMP_DIR,\n MERGE_DIR_PREFIX,\n MERGE_IN_PROGRESS_FILE,\n} from './constants';\nexport { WebpiecesRulesConfig } from './WebpiecesRulesConfig';\nexport {\n MaxMethodLinesConfig,\n MaxFileLinesConfig,\n RequireReturnTypeConfig,\n NoInlineTypeLiteralsConfig,\n NoAnyUnknownConfig,\n NoImplicitAnyConfig,\n PrismaValidateDtosConfig,\n PrismaConverterConfig,\n NoDestructureConfig,\n NoUnmanagedExceptionsConfig,\n CatchErrorPatternConfig,\n ThrowCauseRequiredConfig,\n AngularNoDirectApiInResolverConfig,\n NoSymbolDiTokensConfig,\n NoShellSubstitutionConfig,\n BranchCreationGuardConfig,\n PrCreationGuardConfig,\n MergeInProgressGuardConfig,\n PrMergeCleanupConfig,\n NoDirectMainUpdateConfig,\n NoEditOnMainConfig,\n NoFileImportCyclesConfig,\n RuntimeArchitectureConfig,\n NoJsFilesConfig,\n ValidateTsInSrcConfig,\n BaseRuleConfig,\n} from './rule-configs';\n// Mode unions + their value arrays — the single source of truth shared with code-rules.\nexport {\n METHOD_LIMIT_MODES,\n FILE_LIMIT_MODES,\n RETURN_TYPE_MODES,\n INLINE_TYPE_MODES,\n MODIFIED_CODE_MODES,\n PRISMA_DTOS_MODES,\n PRISMA_CONVERTER_MODES,\n DIRECT_API_RESOLVER_MODES,\n THROW_CAUSE_MODES,\n ON_OFF_MODES,\n VALIDATE_TS_MODES,\n} from './rule-configs';\nexport type {\n MethodLimitMode,\n FileLimitMode,\n ReturnTypeMode,\n InlineTypeMode,\n ModifiedCodeMode,\n PrismaValidateDtosMode,\n PrismaConverterMode,\n DirectApiResolverMode,\n ThrowCauseMode,\n OnOffMode,\n ValidateTsMode,\n} from './rule-configs';\nexport {\n GateDefinition,\n PrGateConfig,\n defaultGates,\n defaultPrGateConfig,\n loadPrGateConfig,\n} from './pr-gate-config';\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare class GateDefinition {
|
|
2
|
+
name: string;
|
|
3
|
+
patterns: string[];
|
|
4
|
+
severity: string;
|
|
5
|
+
constructor(name: string, patterns: string[], severity: string);
|
|
6
|
+
}
|
|
7
|
+
export declare class PrGateConfig {
|
|
8
|
+
mode: string;
|
|
9
|
+
buildCommand: string;
|
|
10
|
+
gates: GateDefinition[];
|
|
11
|
+
constructor(mode: string, buildCommand: string, gates: GateDefinition[]);
|
|
12
|
+
}
|
|
13
|
+
export declare function defaultGates(): GateDefinition[];
|
|
14
|
+
export declare function defaultPrGateConfig(): PrGateConfig;
|
|
15
|
+
/**
|
|
16
|
+
* Load the `pr-gate` section from webpieces.config.json, falling back to defaults for any
|
|
17
|
+
* field the consumer omits. Returns defaults entirely if no config file is found.
|
|
18
|
+
*/
|
|
19
|
+
export declare function loadPrGateConfig(cwd: string): PrGateConfig;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PrGateConfig = exports.GateDefinition = void 0;
|
|
4
|
+
exports.defaultGates = defaultGates;
|
|
5
|
+
exports.defaultPrGateConfig = defaultPrGateConfig;
|
|
6
|
+
exports.loadPrGateConfig = loadPrGateConfig;
|
|
7
|
+
const tslib_1 = require("tslib");
|
|
8
|
+
const fs = tslib_1.__importStar(require("fs"));
|
|
9
|
+
const load_config_1 = require("./load-config");
|
|
10
|
+
// PrGateConfig is the "special section" for the pr-gate dashboard. It does NOT live in the
|
|
11
|
+
// validated `rules` map (the FieldDef schema can't express nested object arrays), but as a
|
|
12
|
+
// top-level `pr-gate` key in webpieces.config.json. Loaded by loadPrGateConfig with defaults.
|
|
13
|
+
class GateDefinition {
|
|
14
|
+
name;
|
|
15
|
+
patterns;
|
|
16
|
+
severity; // 'warn' (yellow) | 'block' (red, fails the gate)
|
|
17
|
+
constructor(name, patterns, severity) {
|
|
18
|
+
this.name = name;
|
|
19
|
+
this.patterns = patterns;
|
|
20
|
+
this.severity = severity;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.GateDefinition = GateDefinition;
|
|
24
|
+
class PrGateConfig {
|
|
25
|
+
mode;
|
|
26
|
+
buildCommand;
|
|
27
|
+
gates;
|
|
28
|
+
constructor(mode, buildCommand, gates) {
|
|
29
|
+
this.mode = mode;
|
|
30
|
+
this.buildCommand = buildCommand;
|
|
31
|
+
this.gates = gates;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.PrGateConfig = PrGateConfig;
|
|
35
|
+
// Default infra gates — path-pattern based, tuned for this monorepo. Clients override the
|
|
36
|
+
// whole list via the `pr-gate.gates` array in webpieces.config.json.
|
|
37
|
+
function defaultGates() {
|
|
38
|
+
return [
|
|
39
|
+
new GateDefinition('API Changed', ['libraries/apis/**', '**/*Api.ts'], 'warn'),
|
|
40
|
+
new GateDefinition('Config Files Changed', ['**/package.json', '**/tsconfig*.json', 'nx.json', '**/*.config.*'], 'warn'),
|
|
41
|
+
new GateDefinition('Dependency Graph Changed', ['architecture/dependencies.json'], 'warn'),
|
|
42
|
+
new GateDefinition('Claude / Rules Changed', ['**/CLAUDE.md', '**/claude.*.md', '.claude/**', 'webpieces.config.json'], 'warn'),
|
|
43
|
+
];
|
|
44
|
+
}
|
|
45
|
+
function defaultPrGateConfig() {
|
|
46
|
+
return new PrGateConfig('ON', '', defaultGates());
|
|
47
|
+
}
|
|
48
|
+
function toGate(raw) {
|
|
49
|
+
return new GateDefinition(raw.name ?? '', raw.patterns ?? [], raw.severity ?? 'warn');
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Load the `pr-gate` section from webpieces.config.json, falling back to defaults for any
|
|
53
|
+
* field the consumer omits. Returns defaults entirely if no config file is found.
|
|
54
|
+
*/
|
|
55
|
+
function loadPrGateConfig(cwd) {
|
|
56
|
+
const defaults = defaultPrGateConfig();
|
|
57
|
+
const configPath = (0, load_config_1.findConfigFile)(cwd);
|
|
58
|
+
if (!configPath)
|
|
59
|
+
return defaults;
|
|
60
|
+
const parsed = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
61
|
+
const section = parsed['pr-gate'];
|
|
62
|
+
if (!section)
|
|
63
|
+
return defaults;
|
|
64
|
+
const mode = section.mode ?? defaults.mode;
|
|
65
|
+
const buildCommand = section.buildCommand ?? defaults.buildCommand;
|
|
66
|
+
const gates = section.gates !== undefined ? section.gates.map(toGate) : defaults.gates;
|
|
67
|
+
return new PrGateConfig(mode, buildCommand, gates);
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=pr-gate-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pr-gate-config.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/pr-gate-config.ts"],"names":[],"mappings":";;;AAiCA,oCAOC;AAED,kDAEC;AA2BD,4CAaC;;AApFD,+CAAyB;AACzB,+CAA+C;AAE/C,2FAA2F;AAC3F,2FAA2F;AAC3F,8FAA8F;AAE9F,MAAa,cAAc;IACvB,IAAI,CAAS;IACb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QAAQ,IAAI,EAAE,EAAE,GAAG,CAAC,QAAQ,IAAI,MAAM,CAAC,CAAC;AAC1F,CAAC;AAED;;;GAGG;AACH,SAAgB,gBAAgB,CAAC,GAAW;IACxC,MAAM,QAAQ,GAAG,mBAAmB,EAAE,CAAC;IACvC,MAAM,UAAU,GAAG,IAAA,4BAAc,EAAC,GAAG,CAAC,CAAC;IACvC,IAAI,CAAC,UAAU;QAAE,OAAO,QAAQ,CAAC;IAEjC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAwB,CAAC;IACtF,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;IAClC,IAAI,CAAC,OAAO;QAAE,OAAO,QAAQ,CAAC;IAE9B,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC;IAC3C,MAAM,YAAY,GAAG,OAAO,CAAC,YAAY,IAAI,QAAQ,CAAC,YAAY,CAAC;IACnE,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;IACvF,OAAO,IAAI,YAAY,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC;AACvD,CAAC","sourcesContent":["import * as fs from 'fs';\nimport { findConfigFile } from './load-config';\n\n// PrGateConfig is the \"special section\" for the pr-gate dashboard. It does NOT live in the\n// validated `rules` map (the FieldDef schema can't express nested object arrays), but as a\n// top-level `pr-gate` key in webpieces.config.json. Loaded by loadPrGateConfig with defaults.\n\nexport class GateDefinition {\n name: string;\n patterns: string[];\n severity: string; // 'warn' (yellow) | 'block' (red, fails the gate)\n\n constructor(name: string, patterns: string[], severity: string) {\n this.name = name;\n this.patterns = patterns;\n this.severity = severity;\n }\n}\n\nexport class PrGateConfig {\n mode: string;\n buildCommand: string;\n gates: GateDefinition[];\n\n constructor(mode: string, buildCommand: string, gates: GateDefinition[]) {\n this.mode = mode;\n this.buildCommand = buildCommand;\n this.gates = gates;\n }\n}\n\n// Default infra gates — path-pattern based, tuned for this monorepo. Clients override the\n// whole list via the `pr-gate.gates` array in webpieces.config.json.\nexport function defaultGates(): GateDefinition[] {\n return [\n new GateDefinition('API Changed', ['libraries/apis/**', '**/*Api.ts'], 'warn'),\n new GateDefinition('Config Files Changed', ['**/package.json', '**/tsconfig*.json', 'nx.json', '**/*.config.*'], 'warn'),\n new GateDefinition('Dependency Graph Changed', ['architecture/dependencies.json'], 'warn'),\n new GateDefinition('Claude / Rules Changed', ['**/CLAUDE.md', '**/claude.*.md', '.claude/**', 'webpieces.config.json'], 'warn'),\n ];\n}\n\nexport function defaultPrGateConfig(): PrGateConfig {\n return new PrGateConfig('ON', '', defaultGates());\n}\n\ninterface RawGate {\n name?: string;\n patterns?: string[];\n severity?: string;\n}\n\ninterface RawPrGateSection {\n mode?: string;\n buildCommand?: string;\n gates?: RawGate[];\n}\n\n// webpieces-disable no-any-unknown -- consumer JSON config has opaque shape until narrowed\ninterface RawConfigWithPrGate {\n 'pr-gate'?: RawPrGateSection;\n}\n\nfunction toGate(raw: RawGate): GateDefinition {\n return new GateDefinition(raw.name ?? '', raw.patterns ?? [], raw.severity ?? 'warn');\n}\n\n/**\n * Load the `pr-gate` section from webpieces.config.json, falling back to defaults for any\n * field the consumer omits. Returns defaults entirely if no config file is found.\n */\nexport function loadPrGateConfig(cwd: string): PrGateConfig {\n const defaults = defaultPrGateConfig();\n const configPath = findConfigFile(cwd);\n if (!configPath) return defaults;\n\n const parsed = JSON.parse(fs.readFileSync(configPath, 'utf8')) as RawConfigWithPrGate;\n const section = parsed['pr-gate'];\n if (!section) return defaults;\n\n const mode = section.mode ?? defaults.mode;\n const buildCommand = section.buildCommand ?? defaults.buildCommand;\n const gates = section.gates !== undefined ? section.gates.map(toGate) : defaults.gates;\n return new PrGateConfig(mode, buildCommand, gates);\n}\n"]}
|
package/src/rule-configs.d.ts
CHANGED
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
import { FieldDef, SchemaShape } from './field-def';
|
|
2
|
-
declare const METHOD_LIMIT_MODES: readonly ["OFF", "NEW_METHODS", "NEW_AND_MODIFIED_METHODS", "MODIFIED_FILES"];
|
|
3
|
-
type MethodLimitMode = typeof METHOD_LIMIT_MODES[number];
|
|
4
|
-
declare const FILE_LIMIT_MODES: readonly ["OFF", "MODIFIED_FILES"];
|
|
5
|
-
type FileLimitMode = typeof FILE_LIMIT_MODES[number];
|
|
6
|
-
declare const RETURN_TYPE_MODES: readonly ["OFF", "NEW_METHODS", "NEW_AND_MODIFIED_METHODS", "MODIFIED_FILES"];
|
|
7
|
-
type
|
|
8
|
-
declare const INLINE_TYPE_MODES: readonly ["OFF", "NEW_METHODS", "NEW_AND_MODIFIED_METHODS", "MODIFIED_FILES"];
|
|
9
|
-
type
|
|
10
|
-
declare const MODIFIED_CODE_MODES: readonly ["OFF", "MODIFIED_CODE", "MODIFIED_FILES"];
|
|
11
|
-
type ModifiedCodeMode = typeof MODIFIED_CODE_MODES[number];
|
|
12
|
-
declare const PRISMA_DTOS_MODES: readonly ["OFF", "MODIFIED_CLASS", "MODIFIED_FILES"];
|
|
13
|
-
type PrismaValidateDtosMode = typeof PRISMA_DTOS_MODES[number];
|
|
14
|
-
declare const PRISMA_CONVERTER_MODES: readonly ["OFF", "NEW_AND_MODIFIED_METHODS", "MODIFIED_FILES"];
|
|
15
|
-
type
|
|
16
|
-
declare const DIRECT_API_RESOLVER_MODES: readonly ["OFF", "MODIFIED_CODE", "NEW_AND_MODIFIED_METHODS", "MODIFIED_FILES"];
|
|
17
|
-
type DirectApiResolverMode = typeof DIRECT_API_RESOLVER_MODES[number];
|
|
18
|
-
declare const THROW_CAUSE_MODES: readonly ["ON", "OFF", "MODIFIED_CODE"];
|
|
19
|
-
type
|
|
20
|
-
declare const ON_OFF_MODES: readonly ["ON", "OFF"];
|
|
21
|
-
type OnOffMode = typeof ON_OFF_MODES[number];
|
|
22
|
-
declare const VALIDATE_TS_MODES: readonly ["ON", "OFF", "MODIFIED_FILES"];
|
|
23
|
-
type ValidateTsMode = typeof VALIDATE_TS_MODES[number];
|
|
2
|
+
export declare const METHOD_LIMIT_MODES: readonly ["OFF", "NEW_METHODS", "NEW_AND_MODIFIED_METHODS", "MODIFIED_FILES"];
|
|
3
|
+
export type MethodLimitMode = typeof METHOD_LIMIT_MODES[number];
|
|
4
|
+
export declare const FILE_LIMIT_MODES: readonly ["OFF", "MODIFIED_FILES"];
|
|
5
|
+
export type FileLimitMode = typeof FILE_LIMIT_MODES[number];
|
|
6
|
+
export declare const RETURN_TYPE_MODES: readonly ["OFF", "NEW_METHODS", "NEW_AND_MODIFIED_METHODS", "MODIFIED_FILES"];
|
|
7
|
+
export type ReturnTypeMode = typeof RETURN_TYPE_MODES[number];
|
|
8
|
+
export declare const INLINE_TYPE_MODES: readonly ["OFF", "NEW_METHODS", "NEW_AND_MODIFIED_METHODS", "MODIFIED_FILES"];
|
|
9
|
+
export type InlineTypeMode = typeof INLINE_TYPE_MODES[number];
|
|
10
|
+
export declare const MODIFIED_CODE_MODES: readonly ["OFF", "MODIFIED_CODE", "MODIFIED_FILES"];
|
|
11
|
+
export type ModifiedCodeMode = typeof MODIFIED_CODE_MODES[number];
|
|
12
|
+
export declare const PRISMA_DTOS_MODES: readonly ["OFF", "MODIFIED_CLASS", "MODIFIED_FILES"];
|
|
13
|
+
export type PrismaValidateDtosMode = typeof PRISMA_DTOS_MODES[number];
|
|
14
|
+
export declare const PRISMA_CONVERTER_MODES: readonly ["OFF", "NEW_AND_MODIFIED_METHODS", "MODIFIED_FILES"];
|
|
15
|
+
export type PrismaConverterMode = typeof PRISMA_CONVERTER_MODES[number];
|
|
16
|
+
export declare const DIRECT_API_RESOLVER_MODES: readonly ["OFF", "MODIFIED_CODE", "NEW_AND_MODIFIED_METHODS", "MODIFIED_FILES"];
|
|
17
|
+
export type DirectApiResolverMode = typeof DIRECT_API_RESOLVER_MODES[number];
|
|
18
|
+
export declare const THROW_CAUSE_MODES: readonly ["ON", "OFF", "MODIFIED_CODE"];
|
|
19
|
+
export type ThrowCauseMode = typeof THROW_CAUSE_MODES[number];
|
|
20
|
+
export declare const ON_OFF_MODES: readonly ["ON", "OFF"];
|
|
21
|
+
export type OnOffMode = typeof ON_OFF_MODES[number];
|
|
22
|
+
export declare const VALIDATE_TS_MODES: readonly ["ON", "OFF", "MODIFIED_FILES"];
|
|
23
|
+
export type ValidateTsMode = typeof VALIDATE_TS_MODES[number];
|
|
24
24
|
export declare abstract class BaseRuleConfig {
|
|
25
|
+
mode?: string;
|
|
25
26
|
ignoreModifiedUntilEpoch?: number;
|
|
26
27
|
ignoreRuleWhileOnBranch?: string;
|
|
27
28
|
}
|
|
@@ -42,12 +43,12 @@ export declare class MaxFileLinesConfig extends BaseRuleConfig {
|
|
|
42
43
|
static readonly SCHEMA: SchemaShape<MaxFileLinesConfig>;
|
|
43
44
|
}
|
|
44
45
|
export declare class RequireReturnTypeConfig extends BaseRuleConfig {
|
|
45
|
-
mode?:
|
|
46
|
+
mode?: ReturnTypeMode;
|
|
46
47
|
disableAllowed?: boolean;
|
|
47
48
|
static readonly SCHEMA: SchemaShape<RequireReturnTypeConfig>;
|
|
48
49
|
}
|
|
49
50
|
export declare class NoInlineTypeLiteralsConfig extends BaseRuleConfig {
|
|
50
|
-
mode?:
|
|
51
|
+
mode?: InlineTypeMode;
|
|
51
52
|
disableAllowed?: boolean;
|
|
52
53
|
static readonly SCHEMA: SchemaShape<NoInlineTypeLiteralsConfig>;
|
|
53
54
|
}
|
|
@@ -69,7 +70,7 @@ export declare class PrismaValidateDtosConfig extends BaseRuleConfig {
|
|
|
69
70
|
static readonly SCHEMA: SchemaShape<PrismaValidateDtosConfig>;
|
|
70
71
|
}
|
|
71
72
|
export declare class PrismaConverterConfig extends BaseRuleConfig {
|
|
72
|
-
mode?:
|
|
73
|
+
mode?: PrismaConverterMode;
|
|
73
74
|
disableAllowed?: boolean;
|
|
74
75
|
schemaPath?: string;
|
|
75
76
|
convertersPaths?: string[];
|
|
@@ -93,7 +94,7 @@ export declare class CatchErrorPatternConfig extends BaseRuleConfig {
|
|
|
93
94
|
static readonly SCHEMA: SchemaShape<CatchErrorPatternConfig>;
|
|
94
95
|
}
|
|
95
96
|
export declare class ThrowCauseRequiredConfig extends BaseRuleConfig {
|
|
96
|
-
mode?:
|
|
97
|
+
mode?: ThrowCauseMode;
|
|
97
98
|
disableAllowed?: boolean;
|
|
98
99
|
static readonly SCHEMA: SchemaShape<ThrowCauseRequiredConfig>;
|
|
99
100
|
}
|
|
@@ -120,10 +121,12 @@ export declare class BranchCreationGuardConfig extends BaseRuleConfig {
|
|
|
120
121
|
}
|
|
121
122
|
export declare class PrCreationGuardConfig extends BaseRuleConfig {
|
|
122
123
|
mode?: OnOffMode;
|
|
123
|
-
buildCommand?: string;
|
|
124
|
-
requireTextInPr?: string;
|
|
125
124
|
static readonly SCHEMA: SchemaShape<PrCreationGuardConfig>;
|
|
126
125
|
}
|
|
126
|
+
export declare class MergeInProgressGuardConfig extends BaseRuleConfig {
|
|
127
|
+
mode?: OnOffMode;
|
|
128
|
+
static readonly SCHEMA: SchemaShape<MergeInProgressGuardConfig>;
|
|
129
|
+
}
|
|
127
130
|
export declare class PrMergeCleanupConfig extends BaseRuleConfig {
|
|
128
131
|
mode?: OnOffMode;
|
|
129
132
|
static readonly SCHEMA: SchemaShape<PrMergeCleanupConfig>;
|
|
@@ -161,4 +164,3 @@ export declare class ValidateTsInSrcConfig extends BaseRuleConfig {
|
|
|
161
164
|
excludePaths?: string[];
|
|
162
165
|
static readonly SCHEMA: SchemaShape<ValidateTsInSrcConfig>;
|
|
163
166
|
}
|
|
164
|
-
export {};
|
package/src/rule-configs.js
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ValidateTsInSrcConfig = exports.NoJsFilesConfig = exports.RuntimeArchitectureConfig = exports.NoFileImportCyclesConfig = exports.NoEditOnMainConfig = exports.NoDirectMainUpdateConfig = exports.PrMergeCleanupConfig = exports.PrCreationGuardConfig = exports.BranchCreationGuardConfig = exports.NoShellSubstitutionConfig = exports.NoSymbolDiTokensConfig = exports.AngularNoDirectApiInResolverConfig = exports.ThrowCauseRequiredConfig = exports.CatchErrorPatternConfig = exports.NoUnmanagedExceptionsConfig = exports.NoDestructureConfig = exports.PrismaConverterConfig = exports.PrismaValidateDtosConfig = exports.NoImplicitAnyConfig = exports.NoAnyUnknownConfig = exports.NoInlineTypeLiteralsConfig = exports.RequireReturnTypeConfig = exports.MaxFileLinesConfig = exports.MaxMethodLinesConfig = exports.BASE_RULE_SCHEMA = exports.BaseRuleConfig = void 0;
|
|
3
|
+
exports.ValidateTsInSrcConfig = exports.NoJsFilesConfig = exports.RuntimeArchitectureConfig = exports.NoFileImportCyclesConfig = exports.NoEditOnMainConfig = exports.NoDirectMainUpdateConfig = exports.PrMergeCleanupConfig = exports.MergeInProgressGuardConfig = exports.PrCreationGuardConfig = exports.BranchCreationGuardConfig = exports.NoShellSubstitutionConfig = exports.NoSymbolDiTokensConfig = exports.AngularNoDirectApiInResolverConfig = exports.ThrowCauseRequiredConfig = exports.CatchErrorPatternConfig = exports.NoUnmanagedExceptionsConfig = exports.NoDestructureConfig = exports.PrismaConverterConfig = exports.PrismaValidateDtosConfig = exports.NoImplicitAnyConfig = exports.NoAnyUnknownConfig = exports.NoInlineTypeLiteralsConfig = exports.RequireReturnTypeConfig = exports.MaxFileLinesConfig = exports.MaxMethodLinesConfig = exports.BASE_RULE_SCHEMA = exports.BaseRuleConfig = exports.VALIDATE_TS_MODES = exports.ON_OFF_MODES = exports.THROW_CAUSE_MODES = exports.DIRECT_API_RESOLVER_MODES = exports.PRISMA_CONVERTER_MODES = exports.PRISMA_DTOS_MODES = exports.MODIFIED_CODE_MODES = exports.INLINE_TYPE_MODES = exports.RETURN_TYPE_MODES = exports.FILE_LIMIT_MODES = exports.METHOD_LIMIT_MODES = void 0;
|
|
4
4
|
const field_def_1 = require("./field-def");
|
|
5
5
|
// Mode const arrays — TypeScript union types derived from them, and FieldDef enum
|
|
6
6
|
// values reference the same array. Impossible for the type and runtime check to diverge.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
7
|
+
// Single source of truth for rule "mode" values. Exported so code-rules (and any other
|
|
8
|
+
// consumer) imports these instead of re-declaring the same unions — a rename here ripples
|
|
9
|
+
// everywhere at compile time. The FieldDef SCHEMA below references the same arrays, so the
|
|
10
|
+
// type and the runtime validation can never diverge.
|
|
11
|
+
exports.METHOD_LIMIT_MODES = ['OFF', 'NEW_METHODS', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'];
|
|
12
|
+
exports.FILE_LIMIT_MODES = ['OFF', 'MODIFIED_FILES'];
|
|
13
|
+
exports.RETURN_TYPE_MODES = ['OFF', 'NEW_METHODS', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'];
|
|
14
|
+
exports.INLINE_TYPE_MODES = ['OFF', 'NEW_METHODS', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'];
|
|
15
|
+
exports.MODIFIED_CODE_MODES = ['OFF', 'MODIFIED_CODE', 'MODIFIED_FILES'];
|
|
16
|
+
exports.PRISMA_DTOS_MODES = ['OFF', 'MODIFIED_CLASS', 'MODIFIED_FILES'];
|
|
17
|
+
exports.PRISMA_CONVERTER_MODES = ['OFF', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'];
|
|
18
|
+
exports.DIRECT_API_RESOLVER_MODES = ['OFF', 'MODIFIED_CODE', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'];
|
|
19
|
+
exports.THROW_CAUSE_MODES = ['ON', 'OFF', 'MODIFIED_CODE'];
|
|
20
|
+
exports.ON_OFF_MODES = ['ON', 'OFF'];
|
|
21
|
+
exports.VALIDATE_TS_MODES = ['ON', 'OFF', 'MODIFIED_FILES'];
|
|
18
22
|
// ---------------------------------------------------------------------------
|
|
19
23
|
// Universal escape hatches — EVERY rule supports temporarily disabling itself
|
|
20
24
|
// either while on a named git branch (ignoreRuleWhileOnBranch) or until an
|
|
@@ -24,6 +28,10 @@ const VALIDATE_TS_MODES = ['ON', 'OFF', 'MODIFIED_FILES'];
|
|
|
24
28
|
// values vary (ON/OFF vs MODIFIED_CODE vs NEW_AND_MODIFIED_METHODS, etc).
|
|
25
29
|
// ---------------------------------------------------------------------------
|
|
26
30
|
class BaseRuleConfig {
|
|
31
|
+
// `mode` is declared here (loosely typed) so the shared AbstractRule base can read it for
|
|
32
|
+
// on/off. Each concrete *Config narrows it to its own union (e.g. `mode?: ModifiedCodeMode`),
|
|
33
|
+
// which is an assignable (covariant) override.
|
|
34
|
+
mode;
|
|
27
35
|
ignoreModifiedUntilEpoch;
|
|
28
36
|
ignoreRuleWhileOnBranch;
|
|
29
37
|
}
|
|
@@ -33,11 +41,10 @@ exports.BASE_RULE_SCHEMA = {
|
|
|
33
41
|
ignoreRuleWhileOnBranch: field_def_1.FieldDef.optional('string'),
|
|
34
42
|
};
|
|
35
43
|
class MaxMethodLinesConfig extends BaseRuleConfig {
|
|
36
|
-
mode;
|
|
37
44
|
limit;
|
|
38
45
|
disableAllowed;
|
|
39
46
|
static SCHEMA = {
|
|
40
|
-
mode: new field_def_1.FieldDef('string', METHOD_LIMIT_MODES),
|
|
47
|
+
mode: new field_def_1.FieldDef('string', exports.METHOD_LIMIT_MODES),
|
|
41
48
|
limit: field_def_1.FieldDef.optional('number'),
|
|
42
49
|
disableAllowed: field_def_1.FieldDef.optional('boolean'),
|
|
43
50
|
...exports.BASE_RULE_SCHEMA,
|
|
@@ -45,11 +52,10 @@ class MaxMethodLinesConfig extends BaseRuleConfig {
|
|
|
45
52
|
}
|
|
46
53
|
exports.MaxMethodLinesConfig = MaxMethodLinesConfig;
|
|
47
54
|
class MaxFileLinesConfig extends BaseRuleConfig {
|
|
48
|
-
mode;
|
|
49
55
|
limit;
|
|
50
56
|
disableAllowed;
|
|
51
57
|
static SCHEMA = {
|
|
52
|
-
mode: new field_def_1.FieldDef('string', FILE_LIMIT_MODES),
|
|
58
|
+
mode: new field_def_1.FieldDef('string', exports.FILE_LIMIT_MODES),
|
|
53
59
|
limit: field_def_1.FieldDef.optional('number'),
|
|
54
60
|
disableAllowed: field_def_1.FieldDef.optional('boolean'),
|
|
55
61
|
...exports.BASE_RULE_SCHEMA,
|
|
@@ -57,52 +63,47 @@ class MaxFileLinesConfig extends BaseRuleConfig {
|
|
|
57
63
|
}
|
|
58
64
|
exports.MaxFileLinesConfig = MaxFileLinesConfig;
|
|
59
65
|
class RequireReturnTypeConfig extends BaseRuleConfig {
|
|
60
|
-
mode;
|
|
61
66
|
disableAllowed;
|
|
62
67
|
static SCHEMA = {
|
|
63
|
-
mode: new field_def_1.FieldDef('string', RETURN_TYPE_MODES),
|
|
68
|
+
mode: new field_def_1.FieldDef('string', exports.RETURN_TYPE_MODES),
|
|
64
69
|
disableAllowed: field_def_1.FieldDef.optional('boolean'),
|
|
65
70
|
...exports.BASE_RULE_SCHEMA,
|
|
66
71
|
};
|
|
67
72
|
}
|
|
68
73
|
exports.RequireReturnTypeConfig = RequireReturnTypeConfig;
|
|
69
74
|
class NoInlineTypeLiteralsConfig extends BaseRuleConfig {
|
|
70
|
-
mode;
|
|
71
75
|
disableAllowed;
|
|
72
76
|
static SCHEMA = {
|
|
73
|
-
mode: new field_def_1.FieldDef('string', INLINE_TYPE_MODES),
|
|
77
|
+
mode: new field_def_1.FieldDef('string', exports.INLINE_TYPE_MODES),
|
|
74
78
|
disableAllowed: field_def_1.FieldDef.optional('boolean'),
|
|
75
79
|
...exports.BASE_RULE_SCHEMA,
|
|
76
80
|
};
|
|
77
81
|
}
|
|
78
82
|
exports.NoInlineTypeLiteralsConfig = NoInlineTypeLiteralsConfig;
|
|
79
83
|
class NoAnyUnknownConfig extends BaseRuleConfig {
|
|
80
|
-
mode;
|
|
81
84
|
disableAllowed;
|
|
82
85
|
static SCHEMA = {
|
|
83
|
-
mode: new field_def_1.FieldDef('string', MODIFIED_CODE_MODES),
|
|
86
|
+
mode: new field_def_1.FieldDef('string', exports.MODIFIED_CODE_MODES),
|
|
84
87
|
disableAllowed: field_def_1.FieldDef.optional('boolean'),
|
|
85
88
|
...exports.BASE_RULE_SCHEMA,
|
|
86
89
|
};
|
|
87
90
|
}
|
|
88
91
|
exports.NoAnyUnknownConfig = NoAnyUnknownConfig;
|
|
89
92
|
class NoImplicitAnyConfig extends BaseRuleConfig {
|
|
90
|
-
mode;
|
|
91
93
|
disableAllowed;
|
|
92
94
|
static SCHEMA = {
|
|
93
|
-
mode: new field_def_1.FieldDef('string', MODIFIED_CODE_MODES),
|
|
95
|
+
mode: new field_def_1.FieldDef('string', exports.MODIFIED_CODE_MODES),
|
|
94
96
|
disableAllowed: field_def_1.FieldDef.optional('boolean'),
|
|
95
97
|
...exports.BASE_RULE_SCHEMA,
|
|
96
98
|
};
|
|
97
99
|
}
|
|
98
100
|
exports.NoImplicitAnyConfig = NoImplicitAnyConfig;
|
|
99
101
|
class PrismaValidateDtosConfig extends BaseRuleConfig {
|
|
100
|
-
mode;
|
|
101
102
|
disableAllowed;
|
|
102
103
|
prismaSchemaPath;
|
|
103
104
|
dtoSourcePaths;
|
|
104
105
|
static SCHEMA = {
|
|
105
|
-
mode: new field_def_1.FieldDef('string', PRISMA_DTOS_MODES),
|
|
106
|
+
mode: new field_def_1.FieldDef('string', exports.PRISMA_DTOS_MODES),
|
|
106
107
|
disableAllowed: field_def_1.FieldDef.optional('boolean'),
|
|
107
108
|
prismaSchemaPath: field_def_1.FieldDef.optional('string'),
|
|
108
109
|
dtoSourcePaths: field_def_1.FieldDef.optional('string[]'),
|
|
@@ -111,13 +112,12 @@ class PrismaValidateDtosConfig extends BaseRuleConfig {
|
|
|
111
112
|
}
|
|
112
113
|
exports.PrismaValidateDtosConfig = PrismaValidateDtosConfig;
|
|
113
114
|
class PrismaConverterConfig extends BaseRuleConfig {
|
|
114
|
-
mode;
|
|
115
115
|
disableAllowed;
|
|
116
116
|
schemaPath;
|
|
117
117
|
convertersPaths;
|
|
118
118
|
enforcePaths;
|
|
119
119
|
static SCHEMA = {
|
|
120
|
-
mode: new field_def_1.FieldDef('string', PRISMA_CONVERTER_MODES),
|
|
120
|
+
mode: new field_def_1.FieldDef('string', exports.PRISMA_CONVERTER_MODES),
|
|
121
121
|
disableAllowed: field_def_1.FieldDef.optional('boolean'),
|
|
122
122
|
schemaPath: field_def_1.FieldDef.optional('string'),
|
|
123
123
|
convertersPaths: field_def_1.FieldDef.optional('string[]'),
|
|
@@ -127,11 +127,10 @@ class PrismaConverterConfig extends BaseRuleConfig {
|
|
|
127
127
|
}
|
|
128
128
|
exports.PrismaConverterConfig = PrismaConverterConfig;
|
|
129
129
|
class NoDestructureConfig extends BaseRuleConfig {
|
|
130
|
-
mode;
|
|
131
130
|
allowTopLevel;
|
|
132
131
|
disableAllowed;
|
|
133
132
|
static SCHEMA = {
|
|
134
|
-
mode: new field_def_1.FieldDef('string', MODIFIED_CODE_MODES),
|
|
133
|
+
mode: new field_def_1.FieldDef('string', exports.MODIFIED_CODE_MODES),
|
|
135
134
|
allowTopLevel: field_def_1.FieldDef.optional('boolean'),
|
|
136
135
|
disableAllowed: field_def_1.FieldDef.optional('boolean'),
|
|
137
136
|
...exports.BASE_RULE_SCHEMA,
|
|
@@ -139,41 +138,37 @@ class NoDestructureConfig extends BaseRuleConfig {
|
|
|
139
138
|
}
|
|
140
139
|
exports.NoDestructureConfig = NoDestructureConfig;
|
|
141
140
|
class NoUnmanagedExceptionsConfig extends BaseRuleConfig {
|
|
142
|
-
mode;
|
|
143
141
|
disableAllowed;
|
|
144
142
|
static SCHEMA = {
|
|
145
|
-
mode: new field_def_1.FieldDef('string', MODIFIED_CODE_MODES),
|
|
143
|
+
mode: new field_def_1.FieldDef('string', exports.MODIFIED_CODE_MODES),
|
|
146
144
|
disableAllowed: field_def_1.FieldDef.optional('boolean'),
|
|
147
145
|
...exports.BASE_RULE_SCHEMA,
|
|
148
146
|
};
|
|
149
147
|
}
|
|
150
148
|
exports.NoUnmanagedExceptionsConfig = NoUnmanagedExceptionsConfig;
|
|
151
149
|
class CatchErrorPatternConfig extends BaseRuleConfig {
|
|
152
|
-
mode;
|
|
153
150
|
disableAllowed;
|
|
154
151
|
static SCHEMA = {
|
|
155
|
-
mode: new field_def_1.FieldDef('string', MODIFIED_CODE_MODES),
|
|
152
|
+
mode: new field_def_1.FieldDef('string', exports.MODIFIED_CODE_MODES),
|
|
156
153
|
disableAllowed: field_def_1.FieldDef.optional('boolean'),
|
|
157
154
|
...exports.BASE_RULE_SCHEMA,
|
|
158
155
|
};
|
|
159
156
|
}
|
|
160
157
|
exports.CatchErrorPatternConfig = CatchErrorPatternConfig;
|
|
161
158
|
class ThrowCauseRequiredConfig extends BaseRuleConfig {
|
|
162
|
-
mode;
|
|
163
159
|
disableAllowed;
|
|
164
160
|
static SCHEMA = {
|
|
165
|
-
mode: new field_def_1.FieldDef('string', THROW_CAUSE_MODES),
|
|
161
|
+
mode: new field_def_1.FieldDef('string', exports.THROW_CAUSE_MODES),
|
|
166
162
|
disableAllowed: field_def_1.FieldDef.optional('boolean'),
|
|
167
163
|
...exports.BASE_RULE_SCHEMA,
|
|
168
164
|
};
|
|
169
165
|
}
|
|
170
166
|
exports.ThrowCauseRequiredConfig = ThrowCauseRequiredConfig;
|
|
171
167
|
class AngularNoDirectApiInResolverConfig extends BaseRuleConfig {
|
|
172
|
-
mode;
|
|
173
168
|
disableAllowed;
|
|
174
169
|
enforcePaths;
|
|
175
170
|
static SCHEMA = {
|
|
176
|
-
mode: new field_def_1.FieldDef('string', DIRECT_API_RESOLVER_MODES),
|
|
171
|
+
mode: new field_def_1.FieldDef('string', exports.DIRECT_API_RESOLVER_MODES),
|
|
177
172
|
disableAllowed: field_def_1.FieldDef.optional('boolean'),
|
|
178
173
|
enforcePaths: field_def_1.FieldDef.optional('string[]'),
|
|
179
174
|
...exports.BASE_RULE_SCHEMA,
|
|
@@ -181,11 +176,10 @@ class AngularNoDirectApiInResolverConfig extends BaseRuleConfig {
|
|
|
181
176
|
}
|
|
182
177
|
exports.AngularNoDirectApiInResolverConfig = AngularNoDirectApiInResolverConfig;
|
|
183
178
|
class NoSymbolDiTokensConfig extends BaseRuleConfig {
|
|
184
|
-
mode;
|
|
185
179
|
disableAllowed;
|
|
186
180
|
allowedPaths;
|
|
187
181
|
static SCHEMA = {
|
|
188
|
-
mode: new field_def_1.FieldDef('string', MODIFIED_CODE_MODES),
|
|
182
|
+
mode: new field_def_1.FieldDef('string', exports.MODIFIED_CODE_MODES),
|
|
189
183
|
disableAllowed: field_def_1.FieldDef.optional('boolean'),
|
|
190
184
|
allowedPaths: field_def_1.FieldDef.optional('string[]'),
|
|
191
185
|
...exports.BASE_RULE_SCHEMA,
|
|
@@ -193,67 +187,63 @@ class NoSymbolDiTokensConfig extends BaseRuleConfig {
|
|
|
193
187
|
}
|
|
194
188
|
exports.NoSymbolDiTokensConfig = NoSymbolDiTokensConfig;
|
|
195
189
|
class NoShellSubstitutionConfig extends BaseRuleConfig {
|
|
196
|
-
mode;
|
|
197
190
|
static SCHEMA = {
|
|
198
|
-
mode: new field_def_1.FieldDef('string', ON_OFF_MODES),
|
|
191
|
+
mode: new field_def_1.FieldDef('string', exports.ON_OFF_MODES),
|
|
199
192
|
...exports.BASE_RULE_SCHEMA,
|
|
200
193
|
};
|
|
201
194
|
}
|
|
202
195
|
exports.NoShellSubstitutionConfig = NoShellSubstitutionConfig;
|
|
203
196
|
class BranchCreationGuardConfig extends BaseRuleConfig {
|
|
204
|
-
mode;
|
|
205
197
|
subBranchNaming;
|
|
206
198
|
static SCHEMA = {
|
|
207
|
-
mode: new field_def_1.FieldDef('string', ON_OFF_MODES),
|
|
199
|
+
mode: new field_def_1.FieldDef('string', exports.ON_OFF_MODES),
|
|
208
200
|
subBranchNaming: field_def_1.FieldDef.optional('string'),
|
|
209
201
|
...exports.BASE_RULE_SCHEMA,
|
|
210
202
|
};
|
|
211
203
|
}
|
|
212
204
|
exports.BranchCreationGuardConfig = BranchCreationGuardConfig;
|
|
213
205
|
class PrCreationGuardConfig extends BaseRuleConfig {
|
|
214
|
-
mode;
|
|
215
|
-
buildCommand;
|
|
216
|
-
requireTextInPr;
|
|
217
206
|
static SCHEMA = {
|
|
218
|
-
mode: new field_def_1.FieldDef('string', ON_OFF_MODES),
|
|
219
|
-
buildCommand: field_def_1.FieldDef.optional('string'),
|
|
220
|
-
requireTextInPr: field_def_1.FieldDef.optional('string'),
|
|
207
|
+
mode: new field_def_1.FieldDef('string', exports.ON_OFF_MODES),
|
|
221
208
|
...exports.BASE_RULE_SCHEMA,
|
|
222
209
|
};
|
|
223
210
|
}
|
|
224
211
|
exports.PrCreationGuardConfig = PrCreationGuardConfig;
|
|
212
|
+
class MergeInProgressGuardConfig extends BaseRuleConfig {
|
|
213
|
+
static SCHEMA = {
|
|
214
|
+
mode: new field_def_1.FieldDef('string', exports.ON_OFF_MODES),
|
|
215
|
+
...exports.BASE_RULE_SCHEMA,
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
exports.MergeInProgressGuardConfig = MergeInProgressGuardConfig;
|
|
225
219
|
class PrMergeCleanupConfig extends BaseRuleConfig {
|
|
226
|
-
mode;
|
|
227
220
|
static SCHEMA = {
|
|
228
|
-
mode: new field_def_1.FieldDef('string', ON_OFF_MODES),
|
|
221
|
+
mode: new field_def_1.FieldDef('string', exports.ON_OFF_MODES),
|
|
229
222
|
...exports.BASE_RULE_SCHEMA,
|
|
230
223
|
};
|
|
231
224
|
}
|
|
232
225
|
exports.PrMergeCleanupConfig = PrMergeCleanupConfig;
|
|
233
226
|
class NoDirectMainUpdateConfig extends BaseRuleConfig {
|
|
234
|
-
mode;
|
|
235
227
|
static SCHEMA = {
|
|
236
|
-
mode: new field_def_1.FieldDef('string', ON_OFF_MODES),
|
|
228
|
+
mode: new field_def_1.FieldDef('string', exports.ON_OFF_MODES),
|
|
237
229
|
...exports.BASE_RULE_SCHEMA,
|
|
238
230
|
};
|
|
239
231
|
}
|
|
240
232
|
exports.NoDirectMainUpdateConfig = NoDirectMainUpdateConfig;
|
|
241
233
|
class NoEditOnMainConfig extends BaseRuleConfig {
|
|
242
|
-
mode;
|
|
243
234
|
branchNamingConvention;
|
|
244
235
|
static SCHEMA = {
|
|
245
|
-
mode: new field_def_1.FieldDef('string', ON_OFF_MODES),
|
|
236
|
+
mode: new field_def_1.FieldDef('string', exports.ON_OFF_MODES),
|
|
246
237
|
branchNamingConvention: field_def_1.FieldDef.optional('string'),
|
|
247
238
|
...exports.BASE_RULE_SCHEMA,
|
|
248
239
|
};
|
|
249
240
|
}
|
|
250
241
|
exports.NoEditOnMainConfig = NoEditOnMainConfig;
|
|
251
242
|
class NoFileImportCyclesConfig extends BaseRuleConfig {
|
|
252
|
-
mode;
|
|
253
243
|
ignoreTypeOnly;
|
|
254
244
|
excludePackages;
|
|
255
245
|
static SCHEMA = {
|
|
256
|
-
mode: new field_def_1.FieldDef('string', ON_OFF_MODES),
|
|
246
|
+
mode: new field_def_1.FieldDef('string', exports.ON_OFF_MODES),
|
|
257
247
|
ignoreTypeOnly: field_def_1.FieldDef.optional('boolean'),
|
|
258
248
|
excludePackages: field_def_1.FieldDef.optional('string[]'),
|
|
259
249
|
...exports.BASE_RULE_SCHEMA,
|
|
@@ -261,12 +251,11 @@ class NoFileImportCyclesConfig extends BaseRuleConfig {
|
|
|
261
251
|
}
|
|
262
252
|
exports.NoFileImportCyclesConfig = NoFileImportCyclesConfig;
|
|
263
253
|
class RuntimeArchitectureConfig extends BaseRuleConfig {
|
|
264
|
-
mode;
|
|
265
254
|
servicePaths;
|
|
266
255
|
apiProjectPaths;
|
|
267
256
|
allowedCycles;
|
|
268
257
|
static SCHEMA = {
|
|
269
|
-
mode: new field_def_1.FieldDef('string', ON_OFF_MODES),
|
|
258
|
+
mode: new field_def_1.FieldDef('string', exports.ON_OFF_MODES),
|
|
270
259
|
servicePaths: field_def_1.FieldDef.optional('string[]'),
|
|
271
260
|
apiProjectPaths: field_def_1.FieldDef.optional('string[]'),
|
|
272
261
|
allowedCycles: field_def_1.FieldDef.optional('string[]'),
|
|
@@ -275,21 +264,19 @@ class RuntimeArchitectureConfig extends BaseRuleConfig {
|
|
|
275
264
|
}
|
|
276
265
|
exports.RuntimeArchitectureConfig = RuntimeArchitectureConfig;
|
|
277
266
|
class NoJsFilesConfig extends BaseRuleConfig {
|
|
278
|
-
mode;
|
|
279
267
|
allowedPaths;
|
|
280
268
|
static SCHEMA = {
|
|
281
|
-
mode: new field_def_1.FieldDef('string', ON_OFF_MODES),
|
|
269
|
+
mode: new field_def_1.FieldDef('string', exports.ON_OFF_MODES),
|
|
282
270
|
allowedPaths: field_def_1.FieldDef.optional('string[]'),
|
|
283
271
|
...exports.BASE_RULE_SCHEMA,
|
|
284
272
|
};
|
|
285
273
|
}
|
|
286
274
|
exports.NoJsFilesConfig = NoJsFilesConfig;
|
|
287
275
|
class ValidateTsInSrcConfig extends BaseRuleConfig {
|
|
288
|
-
mode;
|
|
289
276
|
allowedRootFiles;
|
|
290
277
|
excludePaths;
|
|
291
278
|
static SCHEMA = {
|
|
292
|
-
mode: new field_def_1.FieldDef('string', VALIDATE_TS_MODES),
|
|
279
|
+
mode: new field_def_1.FieldDef('string', exports.VALIDATE_TS_MODES),
|
|
293
280
|
allowedRootFiles: field_def_1.FieldDef.optional('string[]'),
|
|
294
281
|
excludePaths: field_def_1.FieldDef.optional('string[]'),
|
|
295
282
|
...exports.BASE_RULE_SCHEMA,
|
package/src/rule-configs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rule-configs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CAAU,MAAM,GAAuC;QACzD,IAAI,EAAE,IAAI,oBAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAC;QAC/C,gBAAgB,EAAE,oBAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC;QAC/C,YAAY,EAAE,oBAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC;QAC3C,GAAG,wBAAgB;KACtB,CAAC;;AAVN,sDAWC","sourcesContent":["import { FieldDef, SchemaShape } from './field-def';\n\n// Mode const arrays — TypeScript union types derived from them, and FieldDef enum\n// values reference the same array. Impossible for the type and runtime check to diverge.\n\nconst METHOD_LIMIT_MODES = ['OFF', 'NEW_METHODS', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'] as const;\ntype MethodLimitMode = typeof METHOD_LIMIT_MODES[number];\n\nconst FILE_LIMIT_MODES = ['OFF', 'MODIFIED_FILES'] as const;\ntype FileLimitMode = typeof FILE_LIMIT_MODES[number];\n\nconst RETURN_TYPE_MODES = ['OFF', 'NEW_METHODS', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'] as const;\ntype ReturnTypeModeLocal = typeof RETURN_TYPE_MODES[number];\n\nconst INLINE_TYPE_MODES = ['OFF', 'NEW_METHODS', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'] as const;\ntype InlineTypeModeLocal = typeof INLINE_TYPE_MODES[number];\n\nconst MODIFIED_CODE_MODES = ['OFF', 'MODIFIED_CODE', 'MODIFIED_FILES'] as const;\ntype ModifiedCodeMode = typeof MODIFIED_CODE_MODES[number];\n\nconst PRISMA_DTOS_MODES = ['OFF', 'MODIFIED_CLASS', 'MODIFIED_FILES'] as const;\ntype PrismaValidateDtosMode = typeof PRISMA_DTOS_MODES[number];\n\nconst PRISMA_CONVERTER_MODES = ['OFF', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'] as const;\ntype PrismaConverterModeLocal = typeof PRISMA_CONVERTER_MODES[number];\n\nconst DIRECT_API_RESOLVER_MODES = ['OFF', 'MODIFIED_CODE', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'] as const;\ntype DirectApiResolverMode = typeof DIRECT_API_RESOLVER_MODES[number];\n\nconst THROW_CAUSE_MODES = ['ON', 'OFF', 'MODIFIED_CODE'] as const;\ntype ThrowCauseModeLocal = typeof THROW_CAUSE_MODES[number];\n\nconst ON_OFF_MODES = ['ON', 'OFF'] as const;\ntype OnOffMode = typeof ON_OFF_MODES[number];\n\nconst VALIDATE_TS_MODES = ['ON', 'OFF', 'MODIFIED_FILES'] as const;\ntype ValidateTsMode = typeof VALIDATE_TS_MODES[number];\n\n// ---------------------------------------------------------------------------\n// Universal escape hatches — EVERY rule supports temporarily disabling itself\n// either while on a named git branch (ignoreRuleWhileOnBranch) or until an\n// epoch passes (ignoreModifiedUntilEpoch). Both are optional. They live on a\n// shared base class so the two fields (and their schema entries) are declared\n// once instead of repeated per rule. `mode` stays per-rule because its allowed\n// values vary (ON/OFF vs MODIFIED_CODE vs NEW_AND_MODIFIED_METHODS, etc).\n// ---------------------------------------------------------------------------\nexport abstract class BaseRuleConfig {\n ignoreModifiedUntilEpoch?: number;\n ignoreRuleWhileOnBranch?: string;\n}\n\nexport const BASE_RULE_SCHEMA = {\n ignoreModifiedUntilEpoch: FieldDef.optional('number'),\n ignoreRuleWhileOnBranch: FieldDef.optional('string'),\n};\n\nexport class MaxMethodLinesConfig extends BaseRuleConfig {\n mode?: MethodLimitMode;\n limit?: number;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<MaxMethodLinesConfig> = {\n mode: new FieldDef('string', METHOD_LIMIT_MODES),\n limit: FieldDef.optional('number'),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class MaxFileLinesConfig extends BaseRuleConfig {\n mode?: FileLimitMode;\n limit?: number;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<MaxFileLinesConfig> = {\n mode: new FieldDef('string', FILE_LIMIT_MODES),\n limit: FieldDef.optional('number'),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class RequireReturnTypeConfig extends BaseRuleConfig {\n mode?: ReturnTypeModeLocal;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<RequireReturnTypeConfig> = {\n mode: new FieldDef('string', RETURN_TYPE_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoInlineTypeLiteralsConfig extends BaseRuleConfig {\n mode?: InlineTypeModeLocal;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<NoInlineTypeLiteralsConfig> = {\n mode: new FieldDef('string', INLINE_TYPE_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoAnyUnknownConfig extends BaseRuleConfig {\n mode?: ModifiedCodeMode;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<NoAnyUnknownConfig> = {\n mode: new FieldDef('string', MODIFIED_CODE_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoImplicitAnyConfig extends BaseRuleConfig {\n mode?: ModifiedCodeMode;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<NoImplicitAnyConfig> = {\n mode: new FieldDef('string', MODIFIED_CODE_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class PrismaValidateDtosConfig extends BaseRuleConfig {\n mode?: PrismaValidateDtosMode;\n disableAllowed?: boolean;\n prismaSchemaPath?: string;\n dtoSourcePaths?: string[];\n\n static readonly SCHEMA: SchemaShape<PrismaValidateDtosConfig> = {\n mode: new FieldDef('string', PRISMA_DTOS_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n prismaSchemaPath: FieldDef.optional('string'),\n dtoSourcePaths: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class PrismaConverterConfig extends BaseRuleConfig {\n mode?: PrismaConverterModeLocal;\n disableAllowed?: boolean;\n schemaPath?: string;\n convertersPaths?: string[];\n enforcePaths?: string[];\n\n static readonly SCHEMA: SchemaShape<PrismaConverterConfig> = {\n mode: new FieldDef('string', PRISMA_CONVERTER_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n schemaPath: FieldDef.optional('string'),\n convertersPaths: FieldDef.optional('string[]'),\n enforcePaths: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoDestructureConfig extends BaseRuleConfig {\n mode?: ModifiedCodeMode;\n allowTopLevel?: boolean;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<NoDestructureConfig> = {\n mode: new FieldDef('string', MODIFIED_CODE_MODES),\n allowTopLevel: FieldDef.optional('boolean'),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoUnmanagedExceptionsConfig extends BaseRuleConfig {\n mode?: ModifiedCodeMode;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<NoUnmanagedExceptionsConfig> = {\n mode: new FieldDef('string', MODIFIED_CODE_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class CatchErrorPatternConfig extends BaseRuleConfig {\n mode?: ModifiedCodeMode;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<CatchErrorPatternConfig> = {\n mode: new FieldDef('string', MODIFIED_CODE_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class ThrowCauseRequiredConfig extends BaseRuleConfig {\n mode?: ThrowCauseModeLocal;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<ThrowCauseRequiredConfig> = {\n mode: new FieldDef('string', THROW_CAUSE_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class AngularNoDirectApiInResolverConfig extends BaseRuleConfig {\n mode?: DirectApiResolverMode;\n disableAllowed?: boolean;\n enforcePaths?: string[];\n\n static readonly SCHEMA: SchemaShape<AngularNoDirectApiInResolverConfig> = {\n mode: new FieldDef('string', DIRECT_API_RESOLVER_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n enforcePaths: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoSymbolDiTokensConfig extends BaseRuleConfig {\n mode?: ModifiedCodeMode;\n disableAllowed?: boolean;\n allowedPaths?: string[];\n\n static readonly SCHEMA: SchemaShape<NoSymbolDiTokensConfig> = {\n mode: new FieldDef('string', MODIFIED_CODE_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n allowedPaths: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoShellSubstitutionConfig extends BaseRuleConfig {\n mode?: OnOffMode;\n\n static readonly SCHEMA: SchemaShape<NoShellSubstitutionConfig> = {\n mode: new FieldDef('string', ON_OFF_MODES),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class BranchCreationGuardConfig extends BaseRuleConfig {\n mode?: OnOffMode;\n subBranchNaming?: string;\n\n static readonly SCHEMA: SchemaShape<BranchCreationGuardConfig> = {\n mode: new FieldDef('string', ON_OFF_MODES),\n subBranchNaming: FieldDef.optional('string'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class PrCreationGuardConfig extends BaseRuleConfig {\n mode?: OnOffMode;\n buildCommand?: string;\n requireTextInPr?: string;\n\n static readonly SCHEMA: SchemaShape<PrCreationGuardConfig> = {\n mode: new FieldDef('string', ON_OFF_MODES),\n buildCommand: FieldDef.optional('string'),\n requireTextInPr: FieldDef.optional('string'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class PrMergeCleanupConfig extends BaseRuleConfig {\n mode?: OnOffMode;\n\n static readonly SCHEMA: SchemaShape<PrMergeCleanupConfig> = {\n mode: new FieldDef('string', ON_OFF_MODES),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoDirectMainUpdateConfig extends BaseRuleConfig {\n mode?: OnOffMode;\n\n static readonly SCHEMA: SchemaShape<NoDirectMainUpdateConfig> = {\n mode: new FieldDef('string', ON_OFF_MODES),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoEditOnMainConfig extends BaseRuleConfig {\n mode?: OnOffMode;\n branchNamingConvention?: string;\n\n static readonly SCHEMA: SchemaShape<NoEditOnMainConfig> = {\n mode: new FieldDef('string', ON_OFF_MODES),\n branchNamingConvention: FieldDef.optional('string'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoFileImportCyclesConfig extends BaseRuleConfig {\n mode?: OnOffMode;\n ignoreTypeOnly?: boolean;\n excludePackages?: string[];\n\n static readonly SCHEMA: SchemaShape<NoFileImportCyclesConfig> = {\n mode: new FieldDef('string', ON_OFF_MODES),\n ignoreTypeOnly: FieldDef.optional('boolean'),\n excludePackages: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class RuntimeArchitectureConfig extends BaseRuleConfig {\n mode?: OnOffMode;\n servicePaths?: string[];\n apiProjectPaths?: string[];\n allowedCycles?: string[];\n\n static readonly SCHEMA: SchemaShape<RuntimeArchitectureConfig> = {\n mode: new FieldDef('string', ON_OFF_MODES),\n servicePaths: FieldDef.optional('string[]'),\n apiProjectPaths: FieldDef.optional('string[]'),\n allowedCycles: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoJsFilesConfig extends BaseRuleConfig {\n mode?: OnOffMode;\n allowedPaths?: string[];\n\n static readonly SCHEMA: SchemaShape<NoJsFilesConfig> = {\n mode: new FieldDef('string', ON_OFF_MODES),\n allowedPaths: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class ValidateTsInSrcConfig extends BaseRuleConfig {\n mode?: ValidateTsMode;\n allowedRootFiles?: string[];\n excludePaths?: string[];\n\n static readonly SCHEMA: SchemaShape<ValidateTsInSrcConfig> = {\n mode: new FieldDef('string', VALIDATE_TS_MODES),\n allowedRootFiles: FieldDef.optional('string[]'),\n excludePaths: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"rule-configs.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/rule-configs.ts"],"names":[],"mappings":";;;AAAA,2CAAoD;AAEpD,kFAAkF;AAClF,yFAAyF;AAEzF,uFAAuF;AACvF,0FAA0F;AAC1F,2FAA2F;AAC3F,qDAAqD;AACxC,QAAA,kBAAkB,GAAG,CAAC,KAAK,EAAE,aAAa,EAAE,0BAA0B,EAAE,gBAAgB,CAAU,CAAC;AAGnG,QAAA,gBAAgB,GAAG,CAAC,KAAK,EAAE,gBAAgB,CAAU,CAAC;AAGtD,QAAA,iBAAiB,GAAG,CAAC,KAAK,EAAE,aAAa,EAAE,0BAA0B,EAAE,gBAAgB,CAAU,CAAC;AAGlG,QAAA,iBAAiB,GAAG,CAAC,KAAK,EAAE,aAAa,EAAE,0BAA0B,EAAE,gBAAgB,CAAU,CAAC;AAGlG,QAAA,mBAAmB,GAAG,CAAC,KAAK,EAAE,eAAe,EAAE,gBAAgB,CAAU,CAAC;AAG1E,QAAA,iBAAiB,GAAG,CAAC,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,CAAU,CAAC;AAGzE,QAAA,sBAAsB,GAAG,CAAC,KAAK,EAAE,0BAA0B,EAAE,gBAAgB,CAAU,CAAC;AAGxF,QAAA,yBAAyB,GAAG,CAAC,KAAK,EAAE,eAAe,EAAE,0BAA0B,EAAE,gBAAgB,CAAU,CAAC;AAG5G,QAAA,iBAAiB,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,eAAe,CAAU,CAAC;AAG5D,QAAA,YAAY,GAAG,CAAC,IAAI,EAAE,KAAK,CAAU,CAAC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AAQ,CAAC,QAAQ,EAAE,yBAAiB,CAAC;QAC/C,gBAAgB,EAAE,oBAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC;QAC/C,YAAY,EAAE,oBAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC;QAC3C,GAAG,wBAAgB;KACtB,CAAC;;AAVN,sDAWC","sourcesContent":["import { FieldDef, SchemaShape } from './field-def';\n\n// Mode const arrays — TypeScript union types derived from them, and FieldDef enum\n// values reference the same array. Impossible for the type and runtime check to diverge.\n\n// Single source of truth for rule \"mode\" values. Exported so code-rules (and any other\n// consumer) imports these instead of re-declaring the same unions — a rename here ripples\n// everywhere at compile time. The FieldDef SCHEMA below references the same arrays, so the\n// type and the runtime validation can never diverge.\nexport const METHOD_LIMIT_MODES = ['OFF', 'NEW_METHODS', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'] as const;\nexport type MethodLimitMode = typeof METHOD_LIMIT_MODES[number];\n\nexport const FILE_LIMIT_MODES = ['OFF', 'MODIFIED_FILES'] as const;\nexport type FileLimitMode = typeof FILE_LIMIT_MODES[number];\n\nexport const RETURN_TYPE_MODES = ['OFF', 'NEW_METHODS', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'] as const;\nexport type ReturnTypeMode = typeof RETURN_TYPE_MODES[number];\n\nexport const INLINE_TYPE_MODES = ['OFF', 'NEW_METHODS', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'] as const;\nexport type InlineTypeMode = typeof INLINE_TYPE_MODES[number];\n\nexport const MODIFIED_CODE_MODES = ['OFF', 'MODIFIED_CODE', 'MODIFIED_FILES'] as const;\nexport type ModifiedCodeMode = typeof MODIFIED_CODE_MODES[number];\n\nexport const PRISMA_DTOS_MODES = ['OFF', 'MODIFIED_CLASS', 'MODIFIED_FILES'] as const;\nexport type PrismaValidateDtosMode = typeof PRISMA_DTOS_MODES[number];\n\nexport const PRISMA_CONVERTER_MODES = ['OFF', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'] as const;\nexport type PrismaConverterMode = typeof PRISMA_CONVERTER_MODES[number];\n\nexport const DIRECT_API_RESOLVER_MODES = ['OFF', 'MODIFIED_CODE', 'NEW_AND_MODIFIED_METHODS', 'MODIFIED_FILES'] as const;\nexport type DirectApiResolverMode = typeof DIRECT_API_RESOLVER_MODES[number];\n\nexport const THROW_CAUSE_MODES = ['ON', 'OFF', 'MODIFIED_CODE'] as const;\nexport type ThrowCauseMode = typeof THROW_CAUSE_MODES[number];\n\nexport const ON_OFF_MODES = ['ON', 'OFF'] as const;\nexport type OnOffMode = typeof ON_OFF_MODES[number];\n\nexport const VALIDATE_TS_MODES = ['ON', 'OFF', 'MODIFIED_FILES'] as const;\nexport type ValidateTsMode = typeof VALIDATE_TS_MODES[number];\n\n// ---------------------------------------------------------------------------\n// Universal escape hatches — EVERY rule supports temporarily disabling itself\n// either while on a named git branch (ignoreRuleWhileOnBranch) or until an\n// epoch passes (ignoreModifiedUntilEpoch). Both are optional. They live on a\n// shared base class so the two fields (and their schema entries) are declared\n// once instead of repeated per rule. `mode` stays per-rule because its allowed\n// values vary (ON/OFF vs MODIFIED_CODE vs NEW_AND_MODIFIED_METHODS, etc).\n// ---------------------------------------------------------------------------\nexport abstract class BaseRuleConfig {\n // `mode` is declared here (loosely typed) so the shared AbstractRule base can read it for\n // on/off. Each concrete *Config narrows it to its own union (e.g. `mode?: ModifiedCodeMode`),\n // which is an assignable (covariant) override.\n mode?: string;\n ignoreModifiedUntilEpoch?: number;\n ignoreRuleWhileOnBranch?: string;\n}\n\nexport const BASE_RULE_SCHEMA = {\n ignoreModifiedUntilEpoch: FieldDef.optional('number'),\n ignoreRuleWhileOnBranch: FieldDef.optional('string'),\n};\n\nexport class MaxMethodLinesConfig extends BaseRuleConfig {\n declare mode?: MethodLimitMode;\n limit?: number;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<MaxMethodLinesConfig> = {\n mode: new FieldDef('string', METHOD_LIMIT_MODES),\n limit: FieldDef.optional('number'),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class MaxFileLinesConfig extends BaseRuleConfig {\n declare mode?: FileLimitMode;\n limit?: number;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<MaxFileLinesConfig> = {\n mode: new FieldDef('string', FILE_LIMIT_MODES),\n limit: FieldDef.optional('number'),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class RequireReturnTypeConfig extends BaseRuleConfig {\n declare mode?: ReturnTypeMode;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<RequireReturnTypeConfig> = {\n mode: new FieldDef('string', RETURN_TYPE_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoInlineTypeLiteralsConfig extends BaseRuleConfig {\n declare mode?: InlineTypeMode;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<NoInlineTypeLiteralsConfig> = {\n mode: new FieldDef('string', INLINE_TYPE_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoAnyUnknownConfig extends BaseRuleConfig {\n declare mode?: ModifiedCodeMode;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<NoAnyUnknownConfig> = {\n mode: new FieldDef('string', MODIFIED_CODE_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoImplicitAnyConfig extends BaseRuleConfig {\n declare mode?: ModifiedCodeMode;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<NoImplicitAnyConfig> = {\n mode: new FieldDef('string', MODIFIED_CODE_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class PrismaValidateDtosConfig extends BaseRuleConfig {\n declare mode?: PrismaValidateDtosMode;\n disableAllowed?: boolean;\n prismaSchemaPath?: string;\n dtoSourcePaths?: string[];\n\n static readonly SCHEMA: SchemaShape<PrismaValidateDtosConfig> = {\n mode: new FieldDef('string', PRISMA_DTOS_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n prismaSchemaPath: FieldDef.optional('string'),\n dtoSourcePaths: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class PrismaConverterConfig extends BaseRuleConfig {\n declare mode?: PrismaConverterMode;\n disableAllowed?: boolean;\n schemaPath?: string;\n convertersPaths?: string[];\n enforcePaths?: string[];\n\n static readonly SCHEMA: SchemaShape<PrismaConverterConfig> = {\n mode: new FieldDef('string', PRISMA_CONVERTER_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n schemaPath: FieldDef.optional('string'),\n convertersPaths: FieldDef.optional('string[]'),\n enforcePaths: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoDestructureConfig extends BaseRuleConfig {\n declare mode?: ModifiedCodeMode;\n allowTopLevel?: boolean;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<NoDestructureConfig> = {\n mode: new FieldDef('string', MODIFIED_CODE_MODES),\n allowTopLevel: FieldDef.optional('boolean'),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoUnmanagedExceptionsConfig extends BaseRuleConfig {\n declare mode?: ModifiedCodeMode;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<NoUnmanagedExceptionsConfig> = {\n mode: new FieldDef('string', MODIFIED_CODE_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class CatchErrorPatternConfig extends BaseRuleConfig {\n declare mode?: ModifiedCodeMode;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<CatchErrorPatternConfig> = {\n mode: new FieldDef('string', MODIFIED_CODE_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class ThrowCauseRequiredConfig extends BaseRuleConfig {\n declare mode?: ThrowCauseMode;\n disableAllowed?: boolean;\n\n static readonly SCHEMA: SchemaShape<ThrowCauseRequiredConfig> = {\n mode: new FieldDef('string', THROW_CAUSE_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class AngularNoDirectApiInResolverConfig extends BaseRuleConfig {\n declare mode?: DirectApiResolverMode;\n disableAllowed?: boolean;\n enforcePaths?: string[];\n\n static readonly SCHEMA: SchemaShape<AngularNoDirectApiInResolverConfig> = {\n mode: new FieldDef('string', DIRECT_API_RESOLVER_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n enforcePaths: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoSymbolDiTokensConfig extends BaseRuleConfig {\n declare mode?: ModifiedCodeMode;\n disableAllowed?: boolean;\n allowedPaths?: string[];\n\n static readonly SCHEMA: SchemaShape<NoSymbolDiTokensConfig> = {\n mode: new FieldDef('string', MODIFIED_CODE_MODES),\n disableAllowed: FieldDef.optional('boolean'),\n allowedPaths: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoShellSubstitutionConfig extends BaseRuleConfig {\n declare mode?: OnOffMode;\n\n static readonly SCHEMA: SchemaShape<NoShellSubstitutionConfig> = {\n mode: new FieldDef('string', ON_OFF_MODES),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class BranchCreationGuardConfig extends BaseRuleConfig {\n declare mode?: OnOffMode;\n subBranchNaming?: string;\n\n static readonly SCHEMA: SchemaShape<BranchCreationGuardConfig> = {\n mode: new FieldDef('string', ON_OFF_MODES),\n subBranchNaming: FieldDef.optional('string'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class PrCreationGuardConfig extends BaseRuleConfig {\n declare mode?: OnOffMode;\n\n static readonly SCHEMA: SchemaShape<PrCreationGuardConfig> = {\n mode: new FieldDef('string', ON_OFF_MODES),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class MergeInProgressGuardConfig extends BaseRuleConfig {\n declare mode?: OnOffMode;\n\n static readonly SCHEMA: SchemaShape<MergeInProgressGuardConfig> = {\n mode: new FieldDef('string', ON_OFF_MODES),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class PrMergeCleanupConfig extends BaseRuleConfig {\n declare mode?: OnOffMode;\n\n static readonly SCHEMA: SchemaShape<PrMergeCleanupConfig> = {\n mode: new FieldDef('string', ON_OFF_MODES),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoDirectMainUpdateConfig extends BaseRuleConfig {\n declare mode?: OnOffMode;\n\n static readonly SCHEMA: SchemaShape<NoDirectMainUpdateConfig> = {\n mode: new FieldDef('string', ON_OFF_MODES),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoEditOnMainConfig extends BaseRuleConfig {\n declare mode?: OnOffMode;\n branchNamingConvention?: string;\n\n static readonly SCHEMA: SchemaShape<NoEditOnMainConfig> = {\n mode: new FieldDef('string', ON_OFF_MODES),\n branchNamingConvention: FieldDef.optional('string'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoFileImportCyclesConfig extends BaseRuleConfig {\n declare mode?: OnOffMode;\n ignoreTypeOnly?: boolean;\n excludePackages?: string[];\n\n static readonly SCHEMA: SchemaShape<NoFileImportCyclesConfig> = {\n mode: new FieldDef('string', ON_OFF_MODES),\n ignoreTypeOnly: FieldDef.optional('boolean'),\n excludePackages: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class RuntimeArchitectureConfig extends BaseRuleConfig {\n declare mode?: OnOffMode;\n servicePaths?: string[];\n apiProjectPaths?: string[];\n allowedCycles?: string[];\n\n static readonly SCHEMA: SchemaShape<RuntimeArchitectureConfig> = {\n mode: new FieldDef('string', ON_OFF_MODES),\n servicePaths: FieldDef.optional('string[]'),\n apiProjectPaths: FieldDef.optional('string[]'),\n allowedCycles: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class NoJsFilesConfig extends BaseRuleConfig {\n declare mode?: OnOffMode;\n allowedPaths?: string[];\n\n static readonly SCHEMA: SchemaShape<NoJsFilesConfig> = {\n mode: new FieldDef('string', ON_OFF_MODES),\n allowedPaths: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n\nexport class ValidateTsInSrcConfig extends BaseRuleConfig {\n declare mode?: ValidateTsMode;\n allowedRootFiles?: string[];\n excludePaths?: string[];\n\n static readonly SCHEMA: SchemaShape<ValidateTsInSrcConfig> = {\n mode: new FieldDef('string', VALIDATE_TS_MODES),\n allowedRootFiles: FieldDef.optional('string[]'),\n excludePaths: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n"]}
|
package/src/validate-config.js
CHANGED
|
@@ -22,6 +22,7 @@ const RULE_SCHEMAS = {
|
|
|
22
22
|
'no-shell-substitution': rule_configs_1.NoShellSubstitutionConfig.SCHEMA,
|
|
23
23
|
'branch-creation-guard': rule_configs_1.BranchCreationGuardConfig.SCHEMA,
|
|
24
24
|
'pr-creation-guard': rule_configs_1.PrCreationGuardConfig.SCHEMA,
|
|
25
|
+
'merge-in-progress-guard': rule_configs_1.MergeInProgressGuardConfig.SCHEMA,
|
|
25
26
|
'pr-merge-cleanup': rule_configs_1.PrMergeCleanupConfig.SCHEMA,
|
|
26
27
|
'no-direct-main-update': rule_configs_1.NoDirectMainUpdateConfig.SCHEMA,
|
|
27
28
|
'no-edit-on-main': rule_configs_1.NoEditOnMainConfig.SCHEMA,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-config.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/validate-config.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"validate-config.js","sourceRoot":"","sources":["../../../../../packages/tooling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I,CAAC,IAAI,QAAQ,MAAM,GAAG,aAAa,QAAQ,CAAC,IAAI,SAAS,OAAO,KAAK,GAAG,CAAC,CAAC;YACzF,CAAC;iBAAM,IAAI,QAAQ,CAAC,UAAU,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,KAAe,CAAC,EAAE,CAAC;gBAC/E,MAAM,CAAC,IAAI,CAAC,IAAI,QAAQ,MAAM,GAAG,QAAQ,KAAK,mCAAmC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACxH,CAAC;QACL,CAAC;IACL,CAAC;IAED,0EAA0E;IAC1E,gFAAgF;IAChF,mEAAmE;IACnE,KAAK,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;QAC5D,IAAI,CAAC,CAAC,QAAQ,IAAI,QAAQ,CAAC,EAAE,CAAC;YAC1B,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;QACtD,CAAC;IACL,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC","sourcesContent":["import { FieldDef } from './field-def';\nimport {\n MaxMethodLinesConfig,\n MaxFileLinesConfig,\n RequireReturnTypeConfig,\n NoInlineTypeLiteralsConfig,\n NoAnyUnknownConfig,\n NoImplicitAnyConfig,\n PrismaValidateDtosConfig,\n PrismaConverterConfig,\n NoDestructureConfig,\n NoUnmanagedExceptionsConfig,\n CatchErrorPatternConfig,\n ThrowCauseRequiredConfig,\n AngularNoDirectApiInResolverConfig,\n NoSymbolDiTokensConfig,\n NoShellSubstitutionConfig,\n BranchCreationGuardConfig,\n PrCreationGuardConfig,\n MergeInProgressGuardConfig,\n PrMergeCleanupConfig,\n NoDirectMainUpdateConfig,\n NoEditOnMainConfig,\n NoFileImportCyclesConfig,\n RuntimeArchitectureConfig,\n NoJsFilesConfig,\n ValidateTsInSrcConfig,\n} from './rule-configs';\n\n// Thin lookup table — each entry delegates to the class's own SCHEMA.\n// No field lists here; all schemas live with their config class.\nconst RULE_SCHEMAS: Record<string, Record<string, FieldDef>> = {\n 'max-method-lines': MaxMethodLinesConfig.SCHEMA,\n 'max-file-lines': MaxFileLinesConfig.SCHEMA,\n 'require-return-type': RequireReturnTypeConfig.SCHEMA,\n 'no-inline-type-literals': NoInlineTypeLiteralsConfig.SCHEMA,\n 'no-any-unknown': NoAnyUnknownConfig.SCHEMA,\n 'no-implicit-any': NoImplicitAnyConfig.SCHEMA,\n 'prisma-validate-dtos': PrismaValidateDtosConfig.SCHEMA,\n 'prisma-converter': PrismaConverterConfig.SCHEMA,\n 'no-destructure': NoDestructureConfig.SCHEMA,\n 'no-unmanaged-exceptions': NoUnmanagedExceptionsConfig.SCHEMA,\n 'catch-error-pattern': CatchErrorPatternConfig.SCHEMA,\n 'throw-cause-required': ThrowCauseRequiredConfig.SCHEMA,\n 'angular-no-direct-api-in-resolver': AngularNoDirectApiInResolverConfig.SCHEMA,\n 'no-symbol-di-tokens': NoSymbolDiTokensConfig.SCHEMA,\n 'no-shell-substitution': NoShellSubstitutionConfig.SCHEMA,\n 'branch-creation-guard': BranchCreationGuardConfig.SCHEMA,\n 'pr-creation-guard': PrCreationGuardConfig.SCHEMA,\n 'merge-in-progress-guard': MergeInProgressGuardConfig.SCHEMA,\n 'pr-merge-cleanup': PrMergeCleanupConfig.SCHEMA,\n 'no-direct-main-update': NoDirectMainUpdateConfig.SCHEMA,\n 'no-edit-on-main': NoEditOnMainConfig.SCHEMA,\n 'no-file-import-cycles': NoFileImportCyclesConfig.SCHEMA,\n 'runtime-architecture': RuntimeArchitectureConfig.SCHEMA,\n 'no-js-files': NoJsFilesConfig.SCHEMA,\n 'validate-ts-in-src': ValidateTsInSrcConfig.SCHEMA,\n};\n\nfunction valueHint(def: FieldDef): string {\n return def.enumValues\n ? `\"${def.enumValues.join(' | ')}\"`\n : def.type === 'string[]' ? '[\"<string>\", ...]'\n : def.type === 'number' ? '<number>'\n : def.type === 'boolean' ? '<boolean>'\n : '\"<string>\"';\n}\n\nfunction missingRuleSnippet(ruleName: string, schema: Record<string, FieldDef>): string {\n // Only required fields go in the copy-paste entry. Optional fields (e.g. the\n // universal escape hatches ignoreRuleWhileOnBranch / ignoreModifiedUntilEpoch)\n // are listed separately so the snippet doesn't over-state what's mandatory.\n const fields = Object.keys(schema);\n const required = fields.filter(f => !schema[f].optional);\n const optional = fields.filter(f => schema[f].optional);\n\n const requiredLines = required.map(f => ` \"${f}\": ${valueHint(schema[f])}`);\n let out =\n `[${ruleName}] Not configured in webpieces.config.json. Add this entry to the \"rules\" section\\n` +\n `(choose values appropriate for your project):\\n\\n` +\n ` \"${ruleName}\": {\\n${requiredLines.join(',\\n')}\\n }`;\n\n if (optional.length > 0) {\n const optionalLines = optional.map(f => ` \"${f}\": ${valueHint(schema[f])}`);\n out +=\n `\\n\\nOptional fields you may add to this rule (omit if not needed):\\n` +\n `${optionalLines.join(',\\n')}`;\n }\n return out;\n}\n\n// webpieces-disable no-any-unknown -- rawRules values are opaque JSON; each field is validated individually\nexport function validateWebpiecesConfig(\n rawRules: Record<string, Record<string, unknown>>,\n): string[] {\n const errors: string[] = [];\n\n // Check field-level correctness for rules that are present\n for (const [ruleName, entry] of Object.entries(rawRules)) {\n const schema = RULE_SCHEMAS[ruleName];\n if (!schema) continue; // custom/unknown rule — no schema to validate against\n for (const [key, value] of Object.entries(entry)) {\n const fieldDef = schema[key];\n if (!fieldDef) {\n errors.push(`[${ruleName}] Unknown field \"${key}\". Valid fields: [${Object.keys(schema).join(', ')}]`);\n continue;\n }\n if (fieldDef.type === 'string[]') {\n if (!Array.isArray(value) || !value.every(v => typeof v === 'string'))\n errors.push(`[${ruleName}] \"${key}\" must be string[], got ${typeof value}.`);\n } else if (typeof value !== fieldDef.type) {\n errors.push(`[${ruleName}] \"${key}\" must be ${fieldDef.type}, got ${typeof value}.`);\n } else if (fieldDef.enumValues && !fieldDef.enumValues.includes(value as string)) {\n errors.push(`[${ruleName}] \"${key}\" = \"${value}\" is not valid. Must be one of: ${fieldDef.enumValues.join(', ')}.`);\n }\n }\n }\n\n // Every built-in rule must be explicitly configured — no silent defaults.\n // When a new rule is added to the framework, this check surfaces it immediately\n // with a ready-to-copy snippet so AI can configure it in one pass.\n for (const [ruleName, schema] of Object.entries(RULE_SCHEMAS)) {\n if (!(ruleName in rawRules)) {\n errors.push(missingRuleSnippet(ruleName, schema));\n }\n }\n\n return errors;\n}\n"]}
|