@sarj/eslint-plugin 2.3.0 → 2.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -72,9 +72,6 @@ declare const rules: {
72
72
  "no-secret-in-log": _typescript_eslint_utils_ts_eslint.RuleModule<"noSecretInLog", readonly [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
73
73
  name: string;
74
74
  };
75
- "no-template-literal-in-log": _typescript_eslint_utils_ts_eslint.RuleModule<"noTemplateLiteralInLog", readonly [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
76
- name: string;
77
- };
78
75
  "prefer-string-literal-union": _typescript_eslint_utils_ts_eslint.RuleModule<"bareChoiceField" | "comparisonCluster", readonly [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
79
76
  name: string;
80
77
  };
@@ -159,9 +156,6 @@ declare const plugin: {
159
156
  "no-secret-in-log": _typescript_eslint_utils_ts_eslint.RuleModule<"noSecretInLog", readonly [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
160
157
  name: string;
161
158
  };
162
- "no-template-literal-in-log": _typescript_eslint_utils_ts_eslint.RuleModule<"noTemplateLiteralInLog", readonly [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
163
- name: string;
164
- };
165
159
  "prefer-string-literal-union": _typescript_eslint_utils_ts_eslint.RuleModule<"bareChoiceField" | "comparisonCluster", readonly [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
166
160
  name: string;
167
161
  };
@@ -192,7 +186,6 @@ declare const plugin: {
192
186
  "@sarj/prefer-semantic-colors": string;
193
187
  "@sarj/no-fat-try-blocks": string;
194
188
  "@sarj/no-cors-wildcard-with-credentials": string;
195
- "@sarj/no-template-literal-in-log": string;
196
189
  "@sarj/no-secret-in-log": string;
197
190
  "@sarj/single-public-export": string;
198
191
  "@sarj/prefer-string-literal-union": string;
@@ -223,7 +216,6 @@ declare const plugin: {
223
216
  "@sarj/prefer-semantic-colors": string;
224
217
  "@sarj/no-fat-try-blocks": string;
225
218
  "@sarj/no-cors-wildcard-with-credentials": string;
226
- "@sarj/no-template-literal-in-log": string;
227
219
  "@sarj/no-secret-in-log": string;
228
220
  "@sarj/single-public-export": string;
229
221
  "@sarj/prefer-string-literal-union": string;
package/dist/index.d.ts CHANGED
@@ -72,9 +72,6 @@ declare const rules: {
72
72
  "no-secret-in-log": _typescript_eslint_utils_ts_eslint.RuleModule<"noSecretInLog", readonly [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
73
73
  name: string;
74
74
  };
75
- "no-template-literal-in-log": _typescript_eslint_utils_ts_eslint.RuleModule<"noTemplateLiteralInLog", readonly [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
76
- name: string;
77
- };
78
75
  "prefer-string-literal-union": _typescript_eslint_utils_ts_eslint.RuleModule<"bareChoiceField" | "comparisonCluster", readonly [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
79
76
  name: string;
80
77
  };
@@ -159,9 +156,6 @@ declare const plugin: {
159
156
  "no-secret-in-log": _typescript_eslint_utils_ts_eslint.RuleModule<"noSecretInLog", readonly [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
160
157
  name: string;
161
158
  };
162
- "no-template-literal-in-log": _typescript_eslint_utils_ts_eslint.RuleModule<"noTemplateLiteralInLog", readonly [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
163
- name: string;
164
- };
165
159
  "prefer-string-literal-union": _typescript_eslint_utils_ts_eslint.RuleModule<"bareChoiceField" | "comparisonCluster", readonly [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
166
160
  name: string;
167
161
  };
@@ -192,7 +186,6 @@ declare const plugin: {
192
186
  "@sarj/prefer-semantic-colors": string;
193
187
  "@sarj/no-fat-try-blocks": string;
194
188
  "@sarj/no-cors-wildcard-with-credentials": string;
195
- "@sarj/no-template-literal-in-log": string;
196
189
  "@sarj/no-secret-in-log": string;
197
190
  "@sarj/single-public-export": string;
198
191
  "@sarj/prefer-string-literal-union": string;
@@ -223,7 +216,6 @@ declare const plugin: {
223
216
  "@sarj/prefer-semantic-colors": string;
224
217
  "@sarj/no-fat-try-blocks": string;
225
218
  "@sarj/no-cors-wildcard-with-credentials": string;
226
- "@sarj/no-template-literal-in-log": string;
227
219
  "@sarj/no-secret-in-log": string;
228
220
  "@sarj/single-public-export": string;
229
221
  "@sarj/prefer-string-literal-union": string;
package/dist/index.js CHANGED
@@ -2557,120 +2557,9 @@ var no_secret_in_log_default = ESLintUtils23.RuleCreator(
2557
2557
  }
2558
2558
  });
2559
2559
 
2560
- // src/rules/no-template-literal-in-log.ts
2561
- import { ESLintUtils as ESLintUtils24 } from "@typescript-eslint/utils";
2562
- var LOG_METHODS2 = /* @__PURE__ */ new Set([
2563
- "debug",
2564
- "info",
2565
- "warn",
2566
- "warning",
2567
- "error",
2568
- "exception",
2569
- "critical",
2570
- "trace",
2571
- "log",
2572
- "fatal",
2573
- "success"
2574
- ]);
2575
- var LOGGER_NAMES2 = /* @__PURE__ */ new Set([
2576
- "console",
2577
- "logger",
2578
- "log",
2579
- "_log",
2580
- "_logger"
2581
- ]);
2582
- var LOGGER_FACTORIES2 = /* @__PURE__ */ new Set([
2583
- "getlogger",
2584
- "createlogger"
2585
- ]);
2586
- function looksLikeLogger(node) {
2587
- switch (node.type) {
2588
- case "Identifier": {
2589
- const name = node.name.toLowerCase();
2590
- return LOGGER_NAMES2.has(name) || LOGGER_FACTORIES2.has(name);
2591
- }
2592
- case "MemberExpression": {
2593
- if (!node.computed && node.property.type === "Identifier") {
2594
- const prop = node.property.name.toLowerCase();
2595
- if (LOGGER_NAMES2.has(prop) || LOGGER_FACTORIES2.has(prop)) {
2596
- return true;
2597
- }
2598
- }
2599
- return looksLikeLogger(node.object);
2600
- }
2601
- case "CallExpression":
2602
- return looksLikeLogger(node.callee);
2603
- default:
2604
- return false;
2605
- }
2606
- }
2607
- function findInterpolatingTemplate(node) {
2608
- if (node.type === "TemplateLiteral") {
2609
- return node.expressions.length > 0 ? node : null;
2610
- }
2611
- if (node.type === "BinaryExpression" && node.operator === "+") {
2612
- return findInterpolatingTemplate(node.left) ?? findInterpolatingTemplate(node.right);
2613
- }
2614
- return null;
2615
- }
2616
- function messageArg(node, method, receiver) {
2617
- const levelFirst = method === "log" && !isConsoleReceiver(receiver);
2618
- const arg = node.arguments[levelFirst ? 1 : 0];
2619
- if (arg === void 0 || arg.type === "SpreadElement") {
2620
- return null;
2621
- }
2622
- return arg;
2623
- }
2624
- function isConsoleReceiver(node) {
2625
- return node.type === "Identifier" && node.name === "console";
2626
- }
2627
- var no_template_literal_in_log_default = ESLintUtils24.RuleCreator(
2628
- (name) => `https://github.com/sarj-ai/standards/blob/main/packages/typescript/src/rules/${name}.ts`
2629
- )({
2630
- name: "no-template-literal-in-log",
2631
- meta: {
2632
- type: "problem",
2633
- docs: {
2634
- description: "Disallow an interpolating template literal as a logging message \u2014 pass variables as structured fields so logs stay filterable and templates stay constant."
2635
- },
2636
- schema: [],
2637
- messages: {
2638
- noTemplateLiteralInLog: "Interpolating template literal as a logging message \u2014 pass variables as structured fields (logger.info('msg', { key })) instead."
2639
- }
2640
- },
2641
- defaultOptions: [],
2642
- create(context) {
2643
- return {
2644
- CallExpression(node) {
2645
- const callee = node.callee;
2646
- if (callee.type !== "MemberExpression" || callee.computed) {
2647
- return;
2648
- }
2649
- if (callee.property.type !== "Identifier") {
2650
- return;
2651
- }
2652
- const method = callee.property.name;
2653
- if (!LOG_METHODS2.has(method)) {
2654
- return;
2655
- }
2656
- if (!looksLikeLogger(callee.object)) {
2657
- return;
2658
- }
2659
- const arg = messageArg(node, method, callee.object);
2660
- if (arg === null) {
2661
- return;
2662
- }
2663
- if (findInterpolatingTemplate(arg) !== null) {
2664
- context.report({ node, messageId: "noTemplateLiteralInLog" });
2665
- }
2666
- }
2667
- };
2668
- }
2669
- });
2670
-
2671
2560
  // src/rules/prefer-string-literal-union.ts
2672
2561
  import {
2673
- ESLintUtils as ESLintUtils25,
2562
+ ESLintUtils as ESLintUtils24,
2674
2563
  AST_NODE_TYPES as AST_NODE_TYPES12
2675
2564
  } from "@typescript-eslint/utils";
2676
2565
  var CHOICE_TOKENS = /* @__PURE__ */ new Set([
@@ -2746,7 +2635,7 @@ function strLiteral(node) {
2746
2635
  }
2747
2636
  return null;
2748
2637
  }
2749
- var prefer_string_literal_union_default = ESLintUtils25.RuleCreator(
2638
+ var prefer_string_literal_union_default = ESLintUtils24.RuleCreator(
2750
2639
  (name) => `https://github.com/sarj-ai/linting/blob/main/packages/typescript/src/rules/${name}.ts`
2751
2640
  )({
2752
2641
  name: "prefer-string-literal-union",
@@ -2907,7 +2796,7 @@ var prefer_string_literal_union_default = ESLintUtils25.RuleCreator(
2907
2796
  });
2908
2797
 
2909
2798
  // src/rules/single-public-export.ts
2910
- import { ESLintUtils as ESLintUtils26, AST_NODE_TYPES as AST_NODE_TYPES13 } from "@typescript-eslint/utils";
2799
+ import { ESLintUtils as ESLintUtils25, AST_NODE_TYPES as AST_NODE_TYPES13 } from "@typescript-eslint/utils";
2911
2800
  var JUNK_DRAWER_STEMS = /* @__PURE__ */ new Set([
2912
2801
  "util",
2913
2802
  "utils",
@@ -3012,7 +2901,7 @@ var summarizeExports = (body) => {
3012
2901
  }
3013
2902
  return { names, hasReExport, candidate };
3014
2903
  };
3015
- var single_public_export_default = ESLintUtils26.RuleCreator(
2904
+ var single_public_export_default = ESLintUtils25.RuleCreator(
3016
2905
  (name) => `https://github.com/sarj-ai/standards/blob/main/packages/typescript/src/rules/${name}.ts`
3017
2906
  )({
3018
2907
  name: "single-public-export",
@@ -3076,14 +2965,13 @@ var rules = {
3076
2965
  "no-cors-wildcard-with-credentials": no_cors_wildcard_with_credentials_default,
3077
2966
  "no-fat-try-blocks": no_fat_try_blocks_default,
3078
2967
  "no-secret-in-log": no_secret_in_log_default,
3079
- "no-template-literal-in-log": no_template_literal_in_log_default,
3080
2968
  "prefer-string-literal-union": prefer_string_literal_union_default,
3081
2969
  "single-public-export": single_public_export_default
3082
2970
  };
3083
2971
  var plugin = {
3084
2972
  meta: {
3085
2973
  name: "@sarj/eslint-plugin",
3086
- version: "2.3.0"
2974
+ version: "2.3.1"
3087
2975
  },
3088
2976
  rules,
3089
2977
  configs: {
@@ -3112,7 +3000,6 @@ var plugin = {
3112
3000
  // Ported from sarj-python-lint (SARJ), corpus-validated FP~0.
3113
3001
  "@sarj/no-fat-try-blocks": "warn",
3114
3002
  "@sarj/no-cors-wildcard-with-credentials": "warn",
3115
- "@sarj/no-template-literal-in-log": "warn",
3116
3003
  "@sarj/no-secret-in-log": "warn",
3117
3004
  "@sarj/single-public-export": "warn",
3118
3005
  "@sarj/prefer-string-literal-union": "warn"
@@ -3147,7 +3034,6 @@ var plugin = {
3147
3034
  // Ported from sarj-python-lint (SARJ), corpus-validated FP~0.
3148
3035
  "@sarj/no-fat-try-blocks": "error",
3149
3036
  "@sarj/no-cors-wildcard-with-credentials": "error",
3150
- "@sarj/no-template-literal-in-log": "error",
3151
3037
  "@sarj/no-secret-in-log": "error",
3152
3038
  "@sarj/single-public-export": "error",
3153
3039
  // High-volume/stylistic — warn until rollout proves FP rate.