@antelopejs/tooling-configs 0.0.3 → 0.0.5

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/oxc/fmt.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { n as IGNORE_PATTERNS, t as AGENT_IGNORE_PATTERNS } from "../shared-DYvliWWW.mjs";
1
+ import { n as IGNORE_PATTERNS, t as AGENT_IGNORE_PATTERNS } from "../shared-COc6SJpd.mjs";
2
2
  import { defineConfig } from "oxfmt";
3
3
  //#region src/oxc/fmt.ts
4
4
  /**
@@ -53,15 +53,30 @@ interface AntelopePresetOptions {
53
53
  });
54
54
  /**
55
55
  * Import sorting through `eslint-plugin-perfectionist`, autofixed by
56
- * `oxlint --fix`. Repositories that still let Biome organize imports must
57
- * leave this off until they drop that assist, or the two tools fight.
56
+ * `oxlint --fix`.
57
+ *
58
+ * Off by default, because the sort moves value imports across side-effect
59
+ * imports and module evaluation order is load-bearing in an AntelopeJS
60
+ * module: `import "./components"` is what puts the decorated classes in the
61
+ * registry. Running it over the cms/dms repositories moved
62
+ * `import { CORE_SCHEMA_NAME } from ".../constants"` from before
63
+ * `import "./db"` to after `import "./routes"` -- in a file whose comment
64
+ * says the position is deliberate -- and broke the package at require time.
65
+ * Nothing in a typecheck or a build catches it.
66
+ *
67
+ * `sortSideEffects: false` is not enough: it keeps side-effect imports in
68
+ * place (verified across 1402 files, none moved) but lets everything else
69
+ * cross them. `partitionByNewLine`, which would fix that, is refused by
70
+ * perfectionist 5.11 -- it conflicts with both `newlinesBetween` and
71
+ * `newlinesInside`. Turn this back on when the rule can guarantee that no
72
+ * import crosses a side-effect import.
58
73
  *
59
74
  * The plugin is an optional peer dependency: it pulls ESLint and
60
- * typescript-eslint in with it, which a repository that turns this off has no
75
+ * typescript-eslint in with it, which a repository leaving this off has no
61
76
  * reason to install. Add `eslint-plugin-perfectionist` alongside this package
62
- * when leaving it on.
77
+ * when turning it on.
63
78
  *
64
- * @default true
79
+ * @default false
65
80
  */
66
81
  importSorting?: boolean;
67
82
  /**
@@ -82,6 +97,40 @@ interface AntelopePresetOptions {
82
97
  typeAware?: boolean;
83
98
  }
84
99
  /** Every generic anti-slop rule, exported so this package can lint itself. */
100
+ /**
101
+ * The anti-slop rules left off by default.
102
+ *
103
+ * Measured across the sixteen cms/dms repositories: these seven produced 3038
104
+ * of the 3429 anti-slop findings, and every sample we read was either the
105
+ * correct idiom or a design change well beyond a lint pass.
106
+ *
107
+ * - `require-safety-comment-for-type-assertion` (1283) is satisfied by writing
108
+ * a comment, so at that volume it manufactures the noise it exists to fight.
109
+ * Removing assertions is the goal; annotating them is not.
110
+ * - `no-unknown-parameters` (566) and `no-unknown-returns` (104) fire on catch
111
+ * handlers, where `unknown` is the only correct type, and on the parsers
112
+ * whose whole job is to take unknown in and hand typed values out.
113
+ * - `no-runtime-typeof` (460) assumes a validation layer above the check. In a
114
+ * CMS reading Vault responses, WebSocket frames and user-defined rows, the
115
+ * `typeof` *is* that layer.
116
+ * - `no-unsafe-dictionary-type` (442) is right in a business application and
117
+ * wrong here: tables and columns defined at run time have no compile-time
118
+ * schema, which is the product, not a typing gap.
119
+ * - `no-shape-in-symbol-names` (104) matches a substring in identifiers and
120
+ * catches domain words such as `BlueGreenShape`.
121
+ * - `no-module-mocking` (79) is a test-architecture position, not cleanup.
122
+ * - `no-known-value-widening` (201) is the near miss. Of 174 sampled, 96 are
123
+ * `return accumulator` where the object was filled in a loop from run-time
124
+ * keys, so the open dictionary is the honest type and there is no evidence to
125
+ * preserve; the rule reads them as stable consts because assigning a property
126
+ * is not a write to the binding. The 53 real ones -- annotated object
127
+ * literals that should use `satisfies` -- are worth fixing by hand, and are,
128
+ * but not at the price of 96 suppressions. Narrowing the rule to literals
129
+ * would make it worth turning back on.
130
+ *
131
+ * A repository that wants one back enables it in its own `rules` block.
132
+ */
133
+ declare const ANTI_SLOP_RULES_OFF_BY_DEFAULT: readonly ["no-known-value-widening", "no-module-mocking", "no-runtime-typeof", "no-shape-in-symbol-names", "no-unknown-parameters", "no-unknown-returns", "no-unsafe-dictionary-type", "require-safety-comment-for-type-assertion"];
85
134
  declare const ANTI_SLOP_RULES: readonly ["no-chained-type-assertions", "no-conditional-empty-object-spread", "no-known-value-widening", "no-module-mocking", "no-object-parameters", "no-reflect-apply", "no-reflect-get", "no-runtime-typeof", "no-shape-in-symbol-names", "no-unknown-parameters", "no-unknown-returns", "no-unknown-type-aliases", "no-unsafe-dictionary-type", "no-widen-then-assert", "require-safety-comment-for-type-assertion"];
86
135
  /**
87
136
  * The anti-slop rules at one severity. Exported for this repository's own config:
@@ -118,6 +167,7 @@ declare function antelopePreset(options?: AntelopePresetOptions): {
118
167
  argsIgnorePattern: "^_";
119
168
  varsIgnorePattern: "^_";
120
169
  caughtErrorsIgnorePattern: "^_";
170
+ ignoreRestSiblings: true;
121
171
  }];
122
172
  "eslint/eqeqeq": ["error", "always", {
123
173
  null: "ignore";
@@ -145,9 +195,7 @@ declare function antelopePreset(options?: AntelopePresetOptions): {
145
195
  name: string;
146
196
  specifier: string;
147
197
  }[];
148
- rules: {
149
- [k: string]: Severity;
150
- };
198
+ rules: Record<string, Severity>;
151
199
  } | {
152
200
  rules: {
153
201
  "eslint/max-params": [Severity, {
@@ -176,6 +224,7 @@ declare function antelopePreset(options?: AntelopePresetOptions): {
176
224
  "perfectionist/sort-imports": ["error", {
177
225
  type: "line-length";
178
226
  order: "asc";
227
+ sortSideEffects: boolean;
179
228
  internalPattern: string[];
180
229
  groups: string[][];
181
230
  }];
@@ -186,4 +235,4 @@ declare function antelopePreset(options?: AntelopePresetOptions): {
186
235
  };
187
236
  };
188
237
  //#endregion
189
- export { ANTELOPE_IGNORE_PATTERNS, ANTI_SLOP_RULES, AntelopePresetOptions, ComplexityThresholds, DEFAULT_COMPLEXITY_THRESHOLDS, antelopePreset, antiSlopRules };
238
+ export { ANTELOPE_IGNORE_PATTERNS, ANTI_SLOP_RULES, ANTI_SLOP_RULES_OFF_BY_DEFAULT, AntelopePresetOptions, ComplexityThresholds, DEFAULT_COMPLEXITY_THRESHOLDS, antelopePreset, antiSlopRules };
package/dist/oxc/lint.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { n as IGNORE_PATTERNS, t as AGENT_IGNORE_PATTERNS } from "../shared-DYvliWWW.mjs";
1
+ import { n as IGNORE_PATTERNS, t as AGENT_IGNORE_PATTERNS } from "../shared-COc6SJpd.mjs";
2
2
  import { defineConfig } from "oxlint";
3
3
  //#region src/oxc/lint.ts
4
4
  /**
@@ -23,6 +23,49 @@ const DEFAULT_COMPLEXITY_THRESHOLDS = {
23
23
  complexity: 20
24
24
  };
25
25
  /** Every generic anti-slop rule, exported so this package can lint itself. */
26
+ /**
27
+ * The anti-slop rules left off by default.
28
+ *
29
+ * Measured across the sixteen cms/dms repositories: these seven produced 3038
30
+ * of the 3429 anti-slop findings, and every sample we read was either the
31
+ * correct idiom or a design change well beyond a lint pass.
32
+ *
33
+ * - `require-safety-comment-for-type-assertion` (1283) is satisfied by writing
34
+ * a comment, so at that volume it manufactures the noise it exists to fight.
35
+ * Removing assertions is the goal; annotating them is not.
36
+ * - `no-unknown-parameters` (566) and `no-unknown-returns` (104) fire on catch
37
+ * handlers, where `unknown` is the only correct type, and on the parsers
38
+ * whose whole job is to take unknown in and hand typed values out.
39
+ * - `no-runtime-typeof` (460) assumes a validation layer above the check. In a
40
+ * CMS reading Vault responses, WebSocket frames and user-defined rows, the
41
+ * `typeof` *is* that layer.
42
+ * - `no-unsafe-dictionary-type` (442) is right in a business application and
43
+ * wrong here: tables and columns defined at run time have no compile-time
44
+ * schema, which is the product, not a typing gap.
45
+ * - `no-shape-in-symbol-names` (104) matches a substring in identifiers and
46
+ * catches domain words such as `BlueGreenShape`.
47
+ * - `no-module-mocking` (79) is a test-architecture position, not cleanup.
48
+ * - `no-known-value-widening` (201) is the near miss. Of 174 sampled, 96 are
49
+ * `return accumulator` where the object was filled in a loop from run-time
50
+ * keys, so the open dictionary is the honest type and there is no evidence to
51
+ * preserve; the rule reads them as stable consts because assigning a property
52
+ * is not a write to the binding. The 53 real ones -- annotated object
53
+ * literals that should use `satisfies` -- are worth fixing by hand, and are,
54
+ * but not at the price of 96 suppressions. Narrowing the rule to literals
55
+ * would make it worth turning back on.
56
+ *
57
+ * A repository that wants one back enables it in its own `rules` block.
58
+ */
59
+ const ANTI_SLOP_RULES_OFF_BY_DEFAULT = [
60
+ "no-known-value-widening",
61
+ "no-module-mocking",
62
+ "no-runtime-typeof",
63
+ "no-shape-in-symbol-names",
64
+ "no-unknown-parameters",
65
+ "no-unknown-returns",
66
+ "no-unsafe-dictionary-type",
67
+ "require-safety-comment-for-type-assertion"
68
+ ];
26
69
  const ANTI_SLOP_RULES = [
27
70
  "no-chained-type-assertions",
28
71
  "no-conditional-empty-object-spread",
@@ -63,7 +106,8 @@ function basePreset(cycleSeverity) {
63
106
  "eslint/no-unused-vars": ["error", {
64
107
  argsIgnorePattern: "^_",
65
108
  varsIgnorePattern: "^_",
66
- caughtErrorsIgnorePattern: "^_"
109
+ caughtErrorsIgnorePattern: "^_",
110
+ ignoreRestSiblings: true
67
111
  }],
68
112
  "eslint/eqeqeq": [
69
113
  "error",
@@ -84,7 +128,8 @@ function basePreset(cycleSeverity) {
84
128
  * so linting never waits on a build.
85
129
  */
86
130
  function antiSlopRules(severity) {
87
- return Object.fromEntries(ANTI_SLOP_RULES.map((rule) => [`anti-slop/${rule}`, severity]));
131
+ const off = new Set(ANTI_SLOP_RULES_OFF_BY_DEFAULT);
132
+ return Object.fromEntries(ANTI_SLOP_RULES.map((rule) => [`anti-slop/${rule}`, off.has(rule) ? "off" : severity]));
88
133
  }
89
134
  function antiSlopPreset(severity) {
90
135
  return defineConfig({
@@ -92,7 +137,7 @@ function antiSlopPreset(severity) {
92
137
  name: "anti-slop",
93
138
  specifier: "@antelopejs/tooling-configs/oxc/anti-slop"
94
139
  }],
95
- rules: Object.fromEntries(ANTI_SLOP_RULES.map((rule) => [`anti-slop/${rule}`, severity]))
140
+ rules: antiSlopRules(severity)
96
141
  });
97
142
  }
98
143
  function complexityPreset(thresholds, severity) {
@@ -137,20 +182,17 @@ function importSortingPreset() {
137
182
  rules: { "perfectionist/sort-imports": ["error", {
138
183
  type: "line-length",
139
184
  order: "asc",
185
+ sortSideEffects: false,
140
186
  internalPattern: ["^@/.*", "^~/.*"],
141
- groups: [
142
- ["side-effect", "side-effect-style"],
143
- ["builtin", "external"],
144
- [
145
- "internal",
146
- "subpath",
147
- "parent",
148
- "sibling",
149
- "index",
150
- "style",
151
- "unknown"
152
- ]
153
- ]
187
+ groups: [["builtin", "external"], [
188
+ "internal",
189
+ "subpath",
190
+ "parent",
191
+ "sibling",
192
+ "index",
193
+ "style",
194
+ "unknown"
195
+ ]]
154
196
  }] }
155
197
  });
156
198
  }
@@ -187,10 +229,10 @@ function antelopePreset(options = {}) {
187
229
  options.typeAware === false ? null : typeAwarePreset(),
188
230
  antiSlopSeverity === "off" ? null : antiSlopPreset(antiSlopSeverity),
189
231
  complexitySeverity === "off" ? null : complexityPreset(complexityThresholds, complexitySeverity),
190
- options.importSorting === false ? null : importSortingPreset()
232
+ options.importSorting === true ? importSortingPreset() : null
191
233
  ].filter((config) => config !== null),
192
234
  rules: { "typescript/no-floating-promises": options.typeAware === false ? "off" : "error" }
193
235
  });
194
236
  }
195
237
  //#endregion
196
- export { ANTELOPE_IGNORE_PATTERNS, ANTI_SLOP_RULES, DEFAULT_COMPLEXITY_THRESHOLDS, antelopePreset, antiSlopRules };
238
+ export { ANTELOPE_IGNORE_PATTERNS, ANTI_SLOP_RULES, ANTI_SLOP_RULES_OFF_BY_DEFAULT, DEFAULT_COMPLEXITY_THRESHOLDS, antelopePreset, antiSlopRules };
@@ -10,7 +10,8 @@ const IGNORE_PATTERNS = [
10
10
  "**/.output/**",
11
11
  "**/output/**",
12
12
  "**/generated-layers.json",
13
- "**/i18n-registry.generated.ts"
13
+ "**/i18n-registry.generated.ts",
14
+ ".github/ISSUE_TEMPLATE/**"
14
15
  ];
15
16
  /** Agent tooling directories: assets we install, not source we own. */
16
17
  const AGENT_IGNORE_PATTERNS = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antelopejs/tooling-configs",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "Shared tooling presets for AntelopeJS projects: oxlint (incl. vendored anti-slop) and Knip",
5
5
  "keywords": [
6
6
  "antelopejs",