@antelopejs/tooling-configs 0.2.9 → 0.2.10

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/README.md CHANGED
@@ -97,7 +97,7 @@ export default defineConfig({
97
97
  | Imports | `import/no-cycle`, `import/no-self-import`, `import/no-duplicates` | error |
98
98
  | Type-aware | `typescript/no-floating-promises` and eight more type-aware rules | error |
99
99
  | Complexity | `max-params` 5, `max-lines-per-function` 120, `max-lines` 500, `max-depth` 4, `complexity` 20 | error |
100
- | Anti-slop | all 15 vendored rules | error |
100
+ | Anti-slop | all 15 vendored rules; `no-runtime-typeof` with `allowInTypeGuards`, so a `typeof` inside a type predicate or assertion function passes | error |
101
101
  | Guardrails | `antelopejs/no-comments`; in test files `antelopejs/no-fs-read-in-tests`, `antelopejs/no-constant-value-assertion`, `antelopejs/no-typeof-function-only-test` and `antelopejs/require-assertion` | error |
102
102
  | Import sorting | `perfectionist/sort-imports`, autofixed by `oxlint --fix` | off |
103
103
 
@@ -42,8 +42,16 @@ interface AntelopePresetOptions {
42
42
  }
43
43
  /** Every vendored anti-slop rule, also used to lint this package from source. */
44
44
  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"];
45
- /** All vendored rules at one severity, without resolving the published plugin. */
46
- declare function antiSlopRules(severity?: Severity): Record<string, Severity>;
45
+ /**
46
+ * All vendored rules at one severity, without resolving the published plugin.
47
+ * `no-runtime-typeof` accepts a `typeof` whose nearest function returns a type
48
+ * predicate or an assertion: that function is the decoder the rule asks for.
49
+ */
50
+ declare function antiSlopRules(severity?: Severity): {
51
+ [k: string]: "off" | "error" | [Severity, {
52
+ allowInTypeGuards: true;
53
+ }];
54
+ };
47
55
  /** Jest matcher semantics and module restrictions are not portable to Mocha, Chai, and Vitest. */
48
56
  declare const FRAMEWORK_SPECIFIC_JEST_RULES: {
49
57
  readonly "jest/no-conditional-expect": "off";
@@ -133,7 +141,11 @@ declare function antelopePreset(options?: AntelopePresetOptions): {
133
141
  name: string;
134
142
  specifier: string;
135
143
  }[];
136
- rules: Record<string, Severity>;
144
+ rules: {
145
+ [k: string]: "off" | "error" | [Severity, {
146
+ allowInTypeGuards: true;
147
+ }];
148
+ };
137
149
  } | {
138
150
  extends: {
139
151
  plugins: "jest"[];
package/dist/oxc/lint.mjs CHANGED
@@ -73,9 +73,13 @@ function basePreset(importCycles) {
73
73
  }
74
74
  });
75
75
  }
76
- /** All vendored rules at one severity, without resolving the published plugin. */
76
+ /**
77
+ * All vendored rules at one severity, without resolving the published plugin.
78
+ * `no-runtime-typeof` accepts a `typeof` whose nearest function returns a type
79
+ * predicate or an assertion: that function is the decoder the rule asks for.
80
+ */
77
81
  function antiSlopRules(severity = "error") {
78
- return Object.fromEntries(ANTI_SLOP_RULES.map((rule) => [`anti-slop/${rule}`, severity]));
82
+ return Object.fromEntries(ANTI_SLOP_RULES.map((rule) => [`anti-slop/${rule}`, rule === "no-runtime-typeof" ? [severity, { allowInTypeGuards: true }] : severity]));
79
83
  }
80
84
  function antiSlopPreset() {
81
85
  return defineConfig({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antelopejs/tooling-configs",
3
- "version": "0.2.9",
3
+ "version": "0.2.10",
4
4
  "description": "Shared tooling presets for AntelopeJS repositories: oxlint (with the vendored anti-slop rules), oxfmt, ESLint for Nuxt layers, Knip, and an interface range check",
5
5
  "keywords": [
6
6
  "antelopejs",