@webpieces/eslint-rules 0.4.847 → 0.4.849

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webpieces/eslint-rules",
3
- "version": "0.4.847",
3
+ "version": "0.4.849",
4
4
  "description": "ESLint rules for WebPieces code patterns and architecture enforcement",
5
5
  "type": "commonjs",
6
6
  "main": "./src/index.js",
@@ -8,7 +8,8 @@
8
8
  ".": "./src/index.js",
9
9
  "./recommended": "./recommended.mjs",
10
10
  "./package.json": "./package.json",
11
- "./rule-pack": "./src/rule-pack.js"
11
+ "./rule-pack": "./src/rule-pack.js",
12
+ "./rule-runtime": "./src/rule-runtime.js"
12
13
  },
13
14
  "files": [
14
15
  "src/**/*",
@@ -23,8 +24,9 @@
23
24
  "directory": "packages/tooling/eslint-rules"
24
25
  },
25
26
  "dependencies": {
26
- "@webpieces/rules-config": "0.4.847",
27
- "@webpieces/rules-sdk": "0.4.847"
27
+ "@webpieces/rules-config": "0.4.849",
28
+ "@webpieces/rules-sdk": "0.4.849",
29
+ "@webpieces/tooling-common": "0.4.849"
28
30
  },
29
31
  "peerDependencies": {
30
32
  "eslint": ">=8.0.0"
package/src/index.d.ts CHANGED
@@ -1,30 +1,2 @@
1
- /**
2
- * ESLint plugin for WebPieces
3
- * Provides rules for enforcing WebPieces code patterns
4
- *
5
- * This plugin is automatically included in @webpieces/nx-webpieces-rules
6
- *
7
- * Available rules:
8
- * - catch-error-pattern: Enforce toError() usage in catch blocks (HOW to handle)
9
- * - no-unmanaged-exceptions: Discourage try-catch outside tests (WHERE to handle)
10
- * - max-method-lines: Enforce maximum method length (default: 70 lines; describe/suite/context
11
- * callbacks in test files are containers, not methods, and are not counted)
12
- * - max-file-lines: Enforce maximum file length (default: 700 lines)
13
- * - enforce-architecture: Enforce architecture dependency boundaries
14
- * - no-json-property-primitive-type: Ban @JsonProperty({ type: String/Number/Boolean })
15
- * - require-typed-template: Require [templateClassType] on ng-template with let- variables (Angular)
16
- * - no-mat-cell-def: Ban *matCellDef/*matHeaderCellDef — use div-grid tables (Angular)
17
- */
18
- declare const _default: {
19
- rules: {
20
- 'catch-error-pattern': import("eslint").Rule.RuleModule;
21
- 'no-unmanaged-exceptions': import("eslint").Rule.RuleModule;
22
- 'max-method-lines': import("eslint").Rule.RuleModule;
23
- 'max-file-lines': import("eslint").Rule.RuleModule;
24
- 'enforce-architecture': import("eslint").Rule.RuleModule;
25
- 'no-json-property-primitive-type': import("eslint").Rule.RuleModule;
26
- 'require-typed-template': import("eslint").Rule.RuleModule;
27
- 'no-mat-cell-def': import("eslint").Rule.RuleModule;
28
- };
29
- };
1
+ declare const _default: import("./rule-runtime").LintPlugin;
30
2
  export = _default;
package/src/index.js CHANGED
@@ -1,40 +1,5 @@
1
1
  "use strict";
2
- /**
3
- * ESLint plugin for WebPieces
4
- * Provides rules for enforcing WebPieces code patterns
5
- *
6
- * This plugin is automatically included in @webpieces/nx-webpieces-rules
7
- *
8
- * Available rules:
9
- * - catch-error-pattern: Enforce toError() usage in catch blocks (HOW to handle)
10
- * - no-unmanaged-exceptions: Discourage try-catch outside tests (WHERE to handle)
11
- * - max-method-lines: Enforce maximum method length (default: 70 lines; describe/suite/context
12
- * callbacks in test files are containers, not methods, and are not counted)
13
- * - max-file-lines: Enforce maximum file length (default: 700 lines)
14
- * - enforce-architecture: Enforce architecture dependency boundaries
15
- * - no-json-property-primitive-type: Ban @JsonProperty({ type: String/Number/Boolean })
16
- * - require-typed-template: Require [templateClassType] on ng-template with let- variables (Angular)
17
- * - no-mat-cell-def: Ban *matCellDef/*matHeaderCellDef — use div-grid tables (Angular)
18
- */
19
- const tslib_1 = require("tslib");
20
- const catch_error_pattern_1 = tslib_1.__importDefault(require("./rules/catch-error-pattern"));
21
- const no_unmanaged_exceptions_1 = tslib_1.__importDefault(require("./rules/no-unmanaged-exceptions"));
22
- const max_method_lines_1 = tslib_1.__importDefault(require("./rules/max-method-lines"));
23
- const max_file_lines_1 = tslib_1.__importDefault(require("./rules/max-file-lines"));
24
- const enforce_architecture_1 = tslib_1.__importDefault(require("./rules/enforce-architecture"));
25
- const no_json_property_primitive_type_1 = tslib_1.__importDefault(require("./rules/no-json-property-primitive-type"));
26
- const require_typed_template_1 = tslib_1.__importDefault(require("./rules/require-typed-template"));
27
- const no_mat_cell_def_1 = tslib_1.__importDefault(require("./rules/no-mat-cell-def"));
28
- module.exports = {
29
- rules: {
30
- 'catch-error-pattern': catch_error_pattern_1.default,
31
- 'no-unmanaged-exceptions': no_unmanaged_exceptions_1.default,
32
- 'max-method-lines': max_method_lines_1.default,
33
- 'max-file-lines': max_file_lines_1.default,
34
- 'enforce-architecture': enforce_architecture_1.default,
35
- 'no-json-property-primitive-type': no_json_property_primitive_type_1.default,
36
- 'require-typed-template': require_typed_template_1.default,
37
- 'no-mat-cell-def': no_mat_cell_def_1.default,
38
- },
39
- };
2
+ /** The ESLint plugin's implementation table is derived from owner entries. Activation comes from explicit policy config. */
3
+ const rule_runtime_1 = require("./rule-runtime");
4
+ module.exports = new rule_runtime_1.LintRuleRuntime().plugin();
40
5
  //# sourceMappingURL=index.js.map
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/tooling/eslint-rules/src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;AAEH,8FAA4D;AAC5D,sGAAoE;AACpE,wFAAsD;AACtD,oFAAkD;AAClD,gGAA+D;AAC/D,sHAAkF;AAClF,oGAAkE;AAClE,sFAAmD;AAEnD,iBAAS;IACL,KAAK,EAAE;QACH,qBAAqB,EAAE,6BAAiB;QACxC,yBAAyB,EAAE,iCAAqB;QAChD,kBAAkB,EAAE,0BAAc;QAClC,gBAAgB,EAAE,wBAAY;QAC9B,sBAAsB,EAAE,8BAAmB;QAC3C,iCAAiC,EAAE,yCAA2B;QAC9D,wBAAwB,EAAE,gCAAoB;QAC9C,iBAAiB,EAAE,yBAAY;KAClC;CACJ,CAAC","sourcesContent":["/**\n * ESLint plugin for WebPieces\n * Provides rules for enforcing WebPieces code patterns\n *\n * This plugin is automatically included in @webpieces/nx-webpieces-rules\n *\n * Available rules:\n * - catch-error-pattern: Enforce toError() usage in catch blocks (HOW to handle)\n * - no-unmanaged-exceptions: Discourage try-catch outside tests (WHERE to handle)\n * - max-method-lines: Enforce maximum method length (default: 70 lines; describe/suite/context\n * callbacks in test files are containers, not methods, and are not counted)\n * - max-file-lines: Enforce maximum file length (default: 700 lines)\n * - enforce-architecture: Enforce architecture dependency boundaries\n * - no-json-property-primitive-type: Ban @JsonProperty({ type: String/Number/Boolean })\n * - require-typed-template: Require [templateClassType] on ng-template with let- variables (Angular)\n * - no-mat-cell-def: Ban *matCellDef/*matHeaderCellDef — use div-grid tables (Angular)\n */\n\nimport catchErrorPattern from './rules/catch-error-pattern';\nimport noUnmanagedExceptions from './rules/no-unmanaged-exceptions';\nimport maxMethodLines from './rules/max-method-lines';\nimport maxFileLines from './rules/max-file-lines';\nimport enforceArchitecture from './rules/enforce-architecture';\nimport noJsonPropertyPrimitiveType from './rules/no-json-property-primitive-type';\nimport requireTypedTemplate from './rules/require-typed-template';\nimport noMatCellDef from './rules/no-mat-cell-def';\n\nexport = {\n rules: {\n 'catch-error-pattern': catchErrorPattern,\n 'no-unmanaged-exceptions': noUnmanagedExceptions,\n 'max-method-lines': maxMethodLines,\n 'max-file-lines': maxFileLines,\n 'enforce-architecture': enforceArchitecture,\n 'no-json-property-primitive-type': noJsonPropertyPrimitiveType,\n 'require-typed-template': requireTypedTemplate,\n 'no-mat-cell-def': noMatCellDef,\n },\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/tooling/eslint-rules/src/index.ts"],"names":[],"mappings":";AAAA,4HAA4H;AAC5H,iDAAiD;AAEjD,iBAAS,IAAI,8BAAe,EAAE,CAAC,MAAM,EAAE,CAAC","sourcesContent":["/** The ESLint plugin's implementation table is derived from owner entries. Activation comes from explicit policy config. */\nimport { LintRuleRuntime } from './rule-runtime';\n\nexport = new LintRuleRuntime().plugin();\n"]}
@@ -0,0 +1,9 @@
1
+ import { OwnedRuleDefinition } from '@webpieces/rules-sdk';
2
+ export declare class LintPolicy {
3
+ readonly id: string;
4
+ readonly ownerPack: string;
5
+ readonly implementationExport: string;
6
+ constructor(id: string, ownerPack: string, implementationExport: string);
7
+ }
8
+ export declare const LINT_POLICIES: readonly LintPolicy[];
9
+ export declare const ownedRules: OwnedRuleDefinition[];
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ownedRules = exports.LINT_POLICIES = exports.LintPolicy = void 0;
4
+ const rules_sdk_1 = require("@webpieces/rules-sdk");
5
+ const lint_rule_config_1 = require("./lint-rule-config");
6
+ const rule_settings_1 = require("./rule-settings");
7
+ const rule_help_1 = require("./rule-help");
8
+ class LintPolicy {
9
+ id;
10
+ ownerPack;
11
+ implementationExport;
12
+ constructor(id, ownerPack, implementationExport) {
13
+ this.id = id;
14
+ this.ownerPack = ownerPack;
15
+ this.implementationExport = implementationExport;
16
+ }
17
+ }
18
+ exports.LintPolicy = LintPolicy;
19
+ exports.LINT_POLICIES = [
20
+ new LintPolicy('catch-error-pattern', '@webpieces/code-rules', 'catchErrorPattern'),
21
+ new LintPolicy('no-unmanaged-exceptions', '@webpieces/code-rules', 'noUnmanagedExceptions'),
22
+ new LintPolicy('max-method-lines', '@webpieces/code-rules', 'maxMethodLines'),
23
+ new LintPolicy('max-file-lines', '@webpieces/code-rules', 'maxFileLines'),
24
+ new LintPolicy('enforce-architecture', '@webpieces/eslint-rules', 'enforceArchitecture'),
25
+ new LintPolicy('no-json-property-primitive-type', '@webpieces/eslint-rules', 'noJsonPropertyPrimitiveType'),
26
+ new LintPolicy('require-typed-template', '@webpieces/eslint-rules', 'requireTypedTemplate'),
27
+ new LintPolicy('no-mat-cell-def', '@webpieces/eslint-rules', 'noMatCellDef'),
28
+ ];
29
+ exports.ownedRules = exports.LINT_POLICIES.filter((policy) => policy.ownerPack === '@webpieces/eslint-rules').map((policy) => new rules_sdk_1.OwnedRuleDefinition(policy.id, lint_rule_config_1.LintRuleConfig.SCHEMA, rules_sdk_1.RULE_SCHEMA_API_VERSION, rule_settings_1.optionalTuning[policy.id], rule_settings_1.recommendedSeeds[policy.id], 'lint', rule_help_1.ruleHelp[policy.id]));
30
+ //# sourceMappingURL=lint-policy-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lint-policy-registry.js","sourceRoot":"","sources":["../../../../../packages/tooling/eslint-rules/src/lint-policy-registry.ts"],"names":[],"mappings":";;;AAAA,oDAAoF;AACpF,yDAAoD;AACpD,mDAAmE;AACnE,2CAAuC;AAEvC,MAAa,UAAU;IAEN;IACA;IACA;IAHb,YACa,EAAU,EACV,SAAiB,EACjB,oBAA4B;QAF5B,OAAE,GAAF,EAAE,CAAQ;QACV,cAAS,GAAT,SAAS,CAAQ;QACjB,yBAAoB,GAApB,oBAAoB,CAAQ;IACtC,CAAC;CACP;AAND,gCAMC;AAEY,QAAA,aAAa,GAA0B;IAChD,IAAI,UAAU,CAAC,qBAAqB,EAAE,uBAAuB,EAAE,mBAAmB,CAAC;IACnF,IAAI,UAAU,CAAC,yBAAyB,EAAE,uBAAuB,EAAE,uBAAuB,CAAC;IAC3F,IAAI,UAAU,CAAC,kBAAkB,EAAE,uBAAuB,EAAE,gBAAgB,CAAC;IAC7E,IAAI,UAAU,CAAC,gBAAgB,EAAE,uBAAuB,EAAE,cAAc,CAAC;IACzE,IAAI,UAAU,CAAC,sBAAsB,EAAE,yBAAyB,EAAE,qBAAqB,CAAC;IACxF,IAAI,UAAU,CACV,iCAAiC,EACjC,yBAAyB,EACzB,6BAA6B,CAChC;IACD,IAAI,UAAU,CAAC,wBAAwB,EAAE,yBAAyB,EAAE,sBAAsB,CAAC;IAC3F,IAAI,UAAU,CAAC,iBAAiB,EAAE,yBAAyB,EAAE,cAAc,CAAC;CAC/E,CAAC;AAEW,QAAA,UAAU,GAAG,qBAAa,CAAC,MAAM,CAC1C,CAAC,MAAkB,EAAE,EAAE,CAAC,MAAM,CAAC,SAAS,KAAK,yBAAyB,CACzE,CAAC,GAAG,CACD,CAAC,MAAkB,EAAE,EAAE,CACnB,IAAI,+BAAmB,CACnB,MAAM,CAAC,EAAE,EACT,iCAAc,CAAC,MAAM,EACrB,mCAAuB,EACvB,8BAAc,CAAC,MAAM,CAAC,EAAE,CAAC,EACzB,gCAAgB,CAAC,MAAM,CAAC,EAAE,CAAC,EAC3B,MAAM,EACN,oBAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CACtB,CACR,CAAC","sourcesContent":["import { OwnedRuleDefinition, RULE_SCHEMA_API_VERSION } from '@webpieces/rules-sdk';\nimport { LintRuleConfig } from './lint-rule-config';\nimport { optionalTuning, recommendedSeeds } from './rule-settings';\nimport { ruleHelp } from './rule-help';\n\nexport class LintPolicy {\n constructor(\n readonly id: string,\n readonly ownerPack: string,\n readonly implementationExport: string,\n ) {}\n}\n\nexport const LINT_POLICIES: readonly LintPolicy[] = [\n new LintPolicy('catch-error-pattern', '@webpieces/code-rules', 'catchErrorPattern'),\n new LintPolicy('no-unmanaged-exceptions', '@webpieces/code-rules', 'noUnmanagedExceptions'),\n new LintPolicy('max-method-lines', '@webpieces/code-rules', 'maxMethodLines'),\n new LintPolicy('max-file-lines', '@webpieces/code-rules', 'maxFileLines'),\n new LintPolicy('enforce-architecture', '@webpieces/eslint-rules', 'enforceArchitecture'),\n new LintPolicy(\n 'no-json-property-primitive-type',\n '@webpieces/eslint-rules',\n 'noJsonPropertyPrimitiveType',\n ),\n new LintPolicy('require-typed-template', '@webpieces/eslint-rules', 'requireTypedTemplate'),\n new LintPolicy('no-mat-cell-def', '@webpieces/eslint-rules', 'noMatCellDef'),\n];\n\nexport const ownedRules = LINT_POLICIES.filter(\n (policy: LintPolicy) => policy.ownerPack === '@webpieces/eslint-rules',\n).map(\n (policy: LintPolicy) =>\n new OwnedRuleDefinition(\n policy.id,\n LintRuleConfig.SCHEMA,\n RULE_SCHEMA_API_VERSION,\n optionalTuning[policy.id],\n recommendedSeeds[policy.id],\n 'lint',\n ruleHelp[policy.id],\n ),\n);\n"]}
@@ -0,0 +1,3 @@
1
+ import { RuleHelp } from '@webpieces/rules-sdk';
2
+ /** Owner-authored guidance consumed by the registry catalog. */
3
+ export declare const ruleHelp: Readonly<Record<string, RuleHelp>>;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ruleHelp = void 0;
4
+ const rules_sdk_1 = require("@webpieces/rules-sdk");
5
+ /** Owner-authored guidance consumed by the registry catalog. */
6
+ exports.ruleHelp = {
7
+ 'enforce-architecture': new rules_sdk_1.RuleHelp('Respect declared architecture boundaries in linted imports.', 'Apply this policy in source, or review its explicit settings in {configFile}. An intentional opt-out requires complete OFF settings.'),
8
+ 'no-json-property-primitive-type': new rules_sdk_1.RuleHelp('Use the prescribed JSON property typing convention.', 'Apply this policy in source, or review its explicit settings in {configFile}. An intentional opt-out requires complete OFF settings.'),
9
+ 'require-typed-template': new rules_sdk_1.RuleHelp('Use typed template declarations in governed Angular code.', 'Apply this policy in source, or review its explicit settings in {configFile}. An intentional opt-out requires complete OFF settings.'),
10
+ 'no-mat-cell-def': new rules_sdk_1.RuleHelp('Use the governed table-cell template pattern instead of matCellDef.', 'Apply this policy in source, or review its explicit settings in {configFile}. An intentional opt-out requires complete OFF settings.'),
11
+ };
12
+ //# sourceMappingURL=rule-help.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rule-help.js","sourceRoot":"","sources":["../../../../../packages/tooling/eslint-rules/src/rule-help.ts"],"names":[],"mappings":";;;AAAA,oDAAgD;AAEhD,gEAAgE;AACnD,QAAA,QAAQ,GAAuC;IACxD,sBAAsB,EAAE,IAAI,oBAAQ,CAChC,6DAA6D,EAC7D,sIAAsI,CACzI;IACD,iCAAiC,EAAE,IAAI,oBAAQ,CAC3C,qDAAqD,EACrD,sIAAsI,CACzI;IACD,wBAAwB,EAAE,IAAI,oBAAQ,CAClC,2DAA2D,EAC3D,sIAAsI,CACzI;IACD,iBAAiB,EAAE,IAAI,oBAAQ,CAC3B,qEAAqE,EACrE,sIAAsI,CACzI;CACJ,CAAC","sourcesContent":["import { RuleHelp } from '@webpieces/rules-sdk';\n\n/** Owner-authored guidance consumed by the registry catalog. */\nexport const ruleHelp: Readonly<Record<string, RuleHelp>> = {\n 'enforce-architecture': new RuleHelp(\n 'Respect declared architecture boundaries in linted imports.',\n 'Apply this policy in source, or review its explicit settings in {configFile}. An intentional opt-out requires complete OFF settings.',\n ),\n 'no-json-property-primitive-type': new RuleHelp(\n 'Use the prescribed JSON property typing convention.',\n 'Apply this policy in source, or review its explicit settings in {configFile}. An intentional opt-out requires complete OFF settings.',\n ),\n 'require-typed-template': new RuleHelp(\n 'Use typed template declarations in governed Angular code.',\n 'Apply this policy in source, or review its explicit settings in {configFile}. An intentional opt-out requires complete OFF settings.',\n ),\n 'no-mat-cell-def': new RuleHelp(\n 'Use the governed table-cell template pattern instead of matCellDef.',\n 'Apply this policy in source, or review its explicit settings in {configFile}. An intentional opt-out requires complete OFF settings.',\n ),\n};\n"]}
package/src/rule-pack.js CHANGED
@@ -1,22 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.rulePackManifest = void 0;
4
- const rule_settings_1 = require("./rule-settings");
5
4
  const rules_sdk_1 = require("@webpieces/rules-sdk");
5
+ const lint_policy_registry_1 = require("./lint-policy-registry");
6
6
  const package_json_1 = require("../package.json");
7
- const lint_rule_config_1 = require("./lint-rule-config");
8
- /** Lint-only policies own their explicit schema and contribute to the code-owned policies. */
9
- const ownedRuleIds = [
10
- "enforce-architecture",
11
- "no-json-property-primitive-type",
12
- "require-typed-template",
13
- "no-mat-cell-def"
14
- ];
15
- exports.rulePackManifest = new rules_sdk_1.RulePackManifest('@webpieces/eslint-rules', package_json_1.version, rules_sdk_1.RULE_PACK_API_VERSION, ownedRuleIds.map(id => new rules_sdk_1.OwnedRuleDefinition(id, lint_rule_config_1.LintRuleConfig.SCHEMA, rules_sdk_1.RULE_SCHEMA_API_VERSION, rule_settings_1.optionalTuning[id], rule_settings_1.recommendedSeeds[id], 'lint')), [
16
- ...ownedRuleIds.map(id => new rules_sdk_1.RuleContribution(id, '@webpieces/eslint-rules', 'lint')),
17
- new rules_sdk_1.RuleContribution('catch-error-pattern', '@webpieces/code-rules', 'lint'),
18
- new rules_sdk_1.RuleContribution('no-unmanaged-exceptions', '@webpieces/code-rules', 'lint'),
19
- new rules_sdk_1.RuleContribution('max-method-lines', '@webpieces/code-rules', 'lint'),
20
- new rules_sdk_1.RuleContribution('max-file-lines', '@webpieces/code-rules', 'lint'),
21
- ], [], []);
7
+ exports.rulePackManifest = new rules_sdk_1.RulePackManifest('@webpieces/eslint-rules', package_json_1.version, rules_sdk_1.RULE_PACK_API_VERSION, lint_policy_registry_1.ownedRules, lint_policy_registry_1.LINT_POLICIES.map((policy) => new rules_sdk_1.RuleContribution(policy.id, policy.ownerPack, 'lint', '@webpieces/eslint-rules/rule-runtime')), [], []);
22
8
  //# sourceMappingURL=rule-pack.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"rule-pack.js","sourceRoot":"","sources":["../../../../../packages/tooling/eslint-rules/src/rule-pack.ts"],"names":[],"mappings":";;;AAAA,mDAAmE;AACnE,oDAA+I;AAC/I,kDAA0C;AAC1C,yDAAoD;AAEpD,8FAA8F;AAC9F,MAAM,YAAY,GAAG;IACjB,sBAAsB;IACtB,iCAAiC;IACjC,wBAAwB;IACxB,iBAAiB;CACX,CAAC;AAEE,QAAA,gBAAgB,GAAG,IAAI,4BAAgB,CAChD,yBAAyB,EACzB,sBAAO,EACP,iCAAqB,EACrB,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,+BAAmB,CAAC,EAAE,EAAE,iCAAc,CAAC,MAAM,EAAE,mCAAuB,EAAE,8BAAc,CAAC,EAAE,CAAC,EAAE,gCAAgB,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,EACrJ;IACI,GAAG,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,4BAAgB,CAAC,EAAE,EAAE,yBAAyB,EAAE,MAAM,CAAC,CAAC;IACtF,IAAI,4BAAgB,CAAC,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,CAAC;IAC5E,IAAI,4BAAgB,CAAC,yBAAyB,EAAE,uBAAuB,EAAE,MAAM,CAAC;IAChF,IAAI,4BAAgB,CAAC,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,CAAC;IACzE,IAAI,4BAAgB,CAAC,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,CAAC;CAC1E,EACD,EAAE,EACF,EAAE,CACL,CAAC","sourcesContent":["import { optionalTuning, recommendedSeeds } from './rule-settings';\nimport { OwnedRuleDefinition, RuleContribution, RulePackManifest, RULE_PACK_API_VERSION, RULE_SCHEMA_API_VERSION } from '@webpieces/rules-sdk';\nimport { version } from '../package.json';\nimport { LintRuleConfig } from './lint-rule-config';\n\n/** Lint-only policies own their explicit schema and contribute to the code-owned policies. */\nconst ownedRuleIds = [\n \"enforce-architecture\",\n \"no-json-property-primitive-type\",\n \"require-typed-template\",\n \"no-mat-cell-def\"\n] as const;\n\nexport const rulePackManifest = new RulePackManifest(\n '@webpieces/eslint-rules',\n version,\n RULE_PACK_API_VERSION,\n ownedRuleIds.map(id => new OwnedRuleDefinition(id, LintRuleConfig.SCHEMA, RULE_SCHEMA_API_VERSION, optionalTuning[id], recommendedSeeds[id], 'lint')),\n [\n ...ownedRuleIds.map(id => new RuleContribution(id, '@webpieces/eslint-rules', 'lint')),\n new RuleContribution('catch-error-pattern', '@webpieces/code-rules', 'lint'),\n new RuleContribution('no-unmanaged-exceptions', '@webpieces/code-rules', 'lint'),\n new RuleContribution('max-method-lines', '@webpieces/code-rules', 'lint'),\n new RuleContribution('max-file-lines', '@webpieces/code-rules', 'lint'),\n ],\n [],\n [],\n);\n"]}
1
+ {"version":3,"file":"rule-pack.js","sourceRoot":"","sources":["../../../../../packages/tooling/eslint-rules/src/rule-pack.ts"],"names":[],"mappings":";;;AAAA,oDAAiG;AACjG,iEAA+E;AAC/E,kDAA0C;AAE7B,QAAA,gBAAgB,GAAG,IAAI,4BAAgB,CAChD,yBAAyB,EACzB,sBAAO,EACP,iCAAqB,EACrB,iCAAU,EACV,oCAAa,CAAC,GAAG,CACb,CAAC,MAAkB,EAAE,EAAE,CACnB,IAAI,4BAAgB,CAChB,MAAM,CAAC,EAAE,EACT,MAAM,CAAC,SAAS,EAChB,MAAM,EACN,sCAAsC,CACzC,CACR,EACD,EAAE,EACF,EAAE,CACL,CAAC","sourcesContent":["import { RuleContribution, RulePackManifest, RULE_PACK_API_VERSION } from '@webpieces/rules-sdk';\nimport { LINT_POLICIES, ownedRules, LintPolicy } from './lint-policy-registry';\nimport { version } from '../package.json';\n\nexport const rulePackManifest = new RulePackManifest(\n '@webpieces/eslint-rules',\n version,\n RULE_PACK_API_VERSION,\n ownedRules,\n LINT_POLICIES.map(\n (policy: LintPolicy) =>\n new RuleContribution(\n policy.id,\n policy.ownerPack,\n 'lint',\n '@webpieces/eslint-rules/rule-runtime',\n ),\n ),\n [],\n [],\n);\n"]}
@@ -0,0 +1,17 @@
1
+ import type { Rule } from 'eslint';
2
+ import { PolicyRuntimeRequest } from '@webpieces/rules-sdk';
3
+ export declare class LintPlugin {
4
+ readonly rules: Readonly<Record<string, Rule.RuleModule>>;
5
+ constructor(rules: Readonly<Record<string, Rule.RuleModule>>);
6
+ }
7
+ export declare class LintPolicyExecution {
8
+ readonly ruleId: string;
9
+ readonly severity: 'error' | 'off';
10
+ constructor(ruleId: string, severity: 'error' | 'off');
11
+ }
12
+ /** Activation follows explicit owner policy; client-authored ESLint implementation options remain in its ESLint config. */
13
+ export declare class LintRuleRuntime {
14
+ plugin(): LintPlugin;
15
+ create(request: PolicyRuntimeRequest): readonly LintPolicyExecution[];
16
+ }
17
+ export declare const lintRuleRuntime: LintRuleRuntime;
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.lintRuleRuntime = exports.LintRuleRuntime = exports.LintPolicyExecution = exports.LintPlugin = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const tooling_common_1 = require("@webpieces/tooling-common");
6
+ const rules_config_1 = require("@webpieces/rules-config");
7
+ const lint_policy_registry_1 = require("./lint-policy-registry");
8
+ const implementations = tslib_1.__importStar(require("./rules"));
9
+ class LintPlugin {
10
+ rules;
11
+ constructor(rules) {
12
+ this.rules = rules;
13
+ }
14
+ }
15
+ exports.LintPlugin = LintPlugin;
16
+ class LintActivation extends rules_config_1.AbstractRule {
17
+ }
18
+ class LintPolicyExecution {
19
+ ruleId;
20
+ severity;
21
+ constructor(ruleId, severity) {
22
+ this.ruleId = ruleId;
23
+ this.severity = severity;
24
+ }
25
+ }
26
+ exports.LintPolicyExecution = LintPolicyExecution;
27
+ /** Activation follows explicit owner policy; client-authored ESLint implementation options remain in its ESLint config. */
28
+ class LintRuleRuntime {
29
+ plugin() {
30
+ const rules = {};
31
+ for (const policy of lint_policy_registry_1.LINT_POLICIES) {
32
+ rules[policy.id] = implementations[policy.implementationExport];
33
+ }
34
+ return new LintPlugin(rules);
35
+ }
36
+ create(request) {
37
+ return request.ruleIds.map((id) => {
38
+ const policy = lint_policy_registry_1.LINT_POLICIES.find((entry) => entry.id === id);
39
+ const config = request.configs[id];
40
+ if (!policy || !config)
41
+ throw new tooling_common_1.InformAiError(`Missing declared lint contribution or explicit settings for ${id}.`);
42
+ const active = new LintActivation(config, id, id).shouldRun();
43
+ return new LintPolicyExecution(id, active ? 'error' : 'off');
44
+ });
45
+ }
46
+ }
47
+ exports.LintRuleRuntime = LintRuleRuntime;
48
+ exports.lintRuleRuntime = new LintRuleRuntime();
49
+ //# sourceMappingURL=rule-runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rule-runtime.js","sourceRoot":"","sources":["../../../../../packages/tooling/eslint-rules/src/rule-runtime.ts"],"names":[],"mappings":";;;;AACA,8DAA0D;AAE1D,0DAAuD;AACvD,iEAAmE;AACnE,iEAA2C;AAE3C,MAAa,UAAU;IACE;IAArB,YAAqB,KAAgD;QAAhD,UAAK,GAAL,KAAK,CAA2C;IAAG,CAAC;CAC5E;AAFD,gCAEC;AAED,MAAM,cAAe,SAAQ,2BAA4B;CAAG;AAE5D,MAAa,mBAAmB;IAEf;IACA;IAFb,YACa,MAAc,EACd,QAAyB;QADzB,WAAM,GAAN,MAAM,CAAQ;QACd,aAAQ,GAAR,QAAQ,CAAiB;IACnC,CAAC;CACP;AALD,kDAKC;AAED,2HAA2H;AAC3H,MAAa,eAAe;IACxB,MAAM;QACF,MAAM,KAAK,GAAoC,EAAE,CAAC;QAClD,KAAK,MAAM,MAAM,IAAI,oCAAa,EAAE,CAAC;YACjC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,GAAI,eAAmD,CACnE,MAAM,CAAC,oBAAoB,CAC9B,CAAC;QACN,CAAC;QACD,OAAO,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;IAED,MAAM,CAAC,OAA6B;QAChC,OAAO,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,EAAU,EAAE,EAAE;YACtC,MAAM,MAAM,GAAG,oCAAa,CAAC,IAAI,CAAC,CAAC,KAAiB,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;YAC1E,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YACnC,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM;gBAClB,MAAM,IAAI,8BAAa,CACnB,+DAA+D,EAAE,GAAG,CACvE,CAAC;YACN,MAAM,MAAM,GAAG,IAAI,cAAc,CAAC,MAAwB,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC;YAChF,OAAO,IAAI,mBAAmB,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAvBD,0CAuBC;AAEY,QAAA,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC","sourcesContent":["import type { Rule } from 'eslint';\nimport { InformAiError } from '@webpieces/tooling-common';\nimport { BaseRuleConfig, PolicyRuntimeRequest } from '@webpieces/rules-sdk';\nimport { AbstractRule } from '@webpieces/rules-config';\nimport { LINT_POLICIES, LintPolicy } from './lint-policy-registry';\nimport * as implementations from './rules';\n\nexport class LintPlugin {\n constructor(readonly rules: Readonly<Record<string, Rule.RuleModule>>) {}\n}\n\nclass LintActivation extends AbstractRule<BaseRuleConfig> {}\n\nexport class LintPolicyExecution {\n constructor(\n readonly ruleId: string,\n readonly severity: 'error' | 'off',\n ) {}\n}\n\n/** Activation follows explicit owner policy; client-authored ESLint implementation options remain in its ESLint config. */\nexport class LintRuleRuntime {\n plugin(): LintPlugin {\n const rules: Record<string, Rule.RuleModule> = {};\n for (const policy of LINT_POLICIES) {\n rules[policy.id] = (implementations as Record<string, Rule.RuleModule>)[\n policy.implementationExport\n ];\n }\n return new LintPlugin(rules);\n }\n\n create(request: PolicyRuntimeRequest): readonly LintPolicyExecution[] {\n return request.ruleIds.map((id: string) => {\n const policy = LINT_POLICIES.find((entry: LintPolicy) => entry.id === id);\n const config = request.configs[id];\n if (!policy || !config)\n throw new InformAiError(\n `Missing declared lint contribution or explicit settings for ${id}.`,\n );\n const active = new LintActivation(config as BaseRuleConfig, id, id).shouldRun();\n return new LintPolicyExecution(id, active ? 'error' : 'off');\n });\n }\n}\n\nexport const lintRuleRuntime = new LintRuleRuntime();\n"]}
@@ -0,0 +1,8 @@
1
+ export { default as catchErrorPattern } from './catch-error-pattern';
2
+ export { default as noUnmanagedExceptions } from './no-unmanaged-exceptions';
3
+ export { default as maxMethodLines } from './max-method-lines';
4
+ export { default as maxFileLines } from './max-file-lines';
5
+ export { default as enforceArchitecture } from './enforce-architecture';
6
+ export { default as noJsonPropertyPrimitiveType } from './no-json-property-primitive-type';
7
+ export { default as requireTypedTemplate } from './require-typed-template';
8
+ export { default as noMatCellDef } from './no-mat-cell-def';
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.noMatCellDef = exports.requireTypedTemplate = exports.noJsonPropertyPrimitiveType = exports.enforceArchitecture = exports.maxFileLines = exports.maxMethodLines = exports.noUnmanagedExceptions = exports.catchErrorPattern = void 0;
4
+ const tslib_1 = require("tslib");
5
+ var catch_error_pattern_1 = require("./catch-error-pattern");
6
+ Object.defineProperty(exports, "catchErrorPattern", { enumerable: true, get: function () { return tslib_1.__importDefault(catch_error_pattern_1).default; } });
7
+ var no_unmanaged_exceptions_1 = require("./no-unmanaged-exceptions");
8
+ Object.defineProperty(exports, "noUnmanagedExceptions", { enumerable: true, get: function () { return tslib_1.__importDefault(no_unmanaged_exceptions_1).default; } });
9
+ var max_method_lines_1 = require("./max-method-lines");
10
+ Object.defineProperty(exports, "maxMethodLines", { enumerable: true, get: function () { return tslib_1.__importDefault(max_method_lines_1).default; } });
11
+ var max_file_lines_1 = require("./max-file-lines");
12
+ Object.defineProperty(exports, "maxFileLines", { enumerable: true, get: function () { return tslib_1.__importDefault(max_file_lines_1).default; } });
13
+ var enforce_architecture_1 = require("./enforce-architecture");
14
+ Object.defineProperty(exports, "enforceArchitecture", { enumerable: true, get: function () { return tslib_1.__importDefault(enforce_architecture_1).default; } });
15
+ var no_json_property_primitive_type_1 = require("./no-json-property-primitive-type");
16
+ Object.defineProperty(exports, "noJsonPropertyPrimitiveType", { enumerable: true, get: function () { return tslib_1.__importDefault(no_json_property_primitive_type_1).default; } });
17
+ var require_typed_template_1 = require("./require-typed-template");
18
+ Object.defineProperty(exports, "requireTypedTemplate", { enumerable: true, get: function () { return tslib_1.__importDefault(require_typed_template_1).default; } });
19
+ var no_mat_cell_def_1 = require("./no-mat-cell-def");
20
+ Object.defineProperty(exports, "noMatCellDef", { enumerable: true, get: function () { return tslib_1.__importDefault(no_mat_cell_def_1).default; } });
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/tooling/eslint-rules/src/rules/index.ts"],"names":[],"mappings":";;;;AAAA,6DAAqE;AAA5D,iJAAA,OAAO,OAAqB;AACrC,qEAA6E;AAApE,yJAAA,OAAO,OAAyB;AACzC,uDAA+D;AAAtD,2IAAA,OAAO,OAAkB;AAClC,mDAA2D;AAAlD,uIAAA,OAAO,OAAgB;AAChC,+DAAwE;AAA/D,oJAAA,OAAO,OAAuB;AACvC,qFAA2F;AAAlF,uKAAA,OAAO,OAA+B;AAC/C,mEAA2E;AAAlE,uJAAA,OAAO,OAAwB;AACxC,qDAA4D;AAAnD,wIAAA,OAAO,OAAgB","sourcesContent":["export { default as catchErrorPattern } from './catch-error-pattern';\nexport { default as noUnmanagedExceptions } from './no-unmanaged-exceptions';\nexport { default as maxMethodLines } from './max-method-lines';\nexport { default as maxFileLines } from './max-file-lines';\nexport { default as enforceArchitecture } from './enforce-architecture';\nexport { default as noJsonPropertyPrimitiveType } from './no-json-property-primitive-type';\nexport { default as requireTypedTemplate } from './require-typed-template';\nexport { default as noMatCellDef } from './no-mat-cell-def';\n"]}