@venizia/dev-configs 0.5.0-1 → 0.5.0-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.
Files changed (177) hide show
  1. package/README.md +18 -13
  2. package/dist/checks/purity/manifest.js +11 -3
  3. package/dist/checks/purity/manifest.js.map +1 -1
  4. package/dist/checks/purity/probe.js +19 -2
  5. package/dist/checks/purity/probe.js.map +1 -1
  6. package/dist/checks/split-report.js +2 -1
  7. package/dist/checks/split-report.js.map +1 -1
  8. package/dist/checks/test-controls.d.ts +9 -1
  9. package/dist/checks/test-controls.js +9 -3
  10. package/dist/checks/test-controls.js.map +1 -1
  11. package/dist/checks/test-dead-code.d.ts +9 -1
  12. package/dist/checks/test-dead-code.js +13 -2
  13. package/dist/checks/test-dead-code.js.map +1 -1
  14. package/dist/checks/test-mutate.d.ts +9 -1
  15. package/dist/checks/test-mutate.js +12 -6
  16. package/dist/checks/test-mutate.js.map +1 -1
  17. package/dist/cli/check.js +42 -38
  18. package/dist/cli/check.js.map +1 -1
  19. package/dist/cli/clean.js +3 -2
  20. package/dist/cli/clean.js.map +1 -1
  21. package/dist/cli/codemod/any-aliases.d.ts +1 -1
  22. package/dist/cli/codemod/any-aliases.js +14 -13
  23. package/dist/cli/codemod/any-aliases.js.map +1 -1
  24. package/dist/cli/codemod/async-style.d.ts +1 -1
  25. package/dist/cli/codemod/async-style.js +18 -17
  26. package/dist/cli/codemod/async-style.js.map +1 -1
  27. package/dist/cli/codemod/binding-keys.d.ts +32 -1
  28. package/dist/cli/codemod/binding-keys.js +238 -58
  29. package/dist/cli/codemod/binding-keys.js.map +1 -1
  30. package/dist/cli/codemod/class-renames.d.ts +39 -0
  31. package/dist/cli/codemod/class-renames.js +297 -0
  32. package/dist/cli/codemod/class-renames.js.map +1 -0
  33. package/dist/cli/codemod/connector-imports.d.ts +1 -1
  34. package/dist/cli/codemod/connector-imports.js +13 -12
  35. package/dist/cli/codemod/connector-imports.js.map +1 -1
  36. package/dist/cli/codemod/const-class-sets.d.ts +55 -0
  37. package/dist/cli/codemod/const-class-sets.js +219 -0
  38. package/dist/cli/codemod/const-class-sets.js.map +1 -0
  39. package/dist/cli/codemod/const-classes.d.ts +21 -3
  40. package/dist/cli/codemod/const-classes.js +151 -36
  41. package/dist/cli/codemod/const-classes.js.map +1 -1
  42. package/dist/cli/codemod/drop-redundant-casts.d.ts +6 -1
  43. package/dist/cli/codemod/drop-redundant-casts.js +27 -19
  44. package/dist/cli/codemod/drop-redundant-casts.js.map +1 -1
  45. package/dist/cli/codemod/env-get.d.ts +3 -3
  46. package/dist/cli/codemod/env-get.js +19 -18
  47. package/dist/cli/codemod/env-get.js.map +1 -1
  48. package/dist/cli/codemod/files.d.ts +4 -2
  49. package/dist/cli/codemod/files.js +7 -8
  50. package/dist/cli/codemod/files.js.map +1 -1
  51. package/dist/cli/codemod/function-to-arrow.d.ts +76 -0
  52. package/dist/cli/codemod/function-to-arrow.js +357 -0
  53. package/dist/cli/codemod/function-to-arrow.js.map +1 -0
  54. package/dist/cli/codemod/index.js +25 -4
  55. package/dist/cli/codemod/index.js.map +1 -1
  56. package/dist/cli/codemod/namespace-functions/index.d.ts +1 -1
  57. package/dist/cli/codemod/namespace-functions/index.js +14 -13
  58. package/dist/cli/codemod/namespace-functions/index.js.map +1 -1
  59. package/dist/cli/codemod/namespace-functions/mappings/dev-configs.js +3 -3
  60. package/dist/cli/codemod/namespace-functions/mappings/dev-configs.js.map +1 -1
  61. package/dist/cli/codemod/namespace-functions/mappings/helpers.js +1 -1
  62. package/dist/cli/codemod/namespace-functions/mappings/helpers.js.map +1 -1
  63. package/dist/cli/codemod/typed-route-context.d.ts +58 -0
  64. package/dist/cli/codemod/typed-route-context.js +918 -0
  65. package/dist/cli/codemod/typed-route-context.js.map +1 -0
  66. package/dist/cli/index.js +5 -4
  67. package/dist/cli/index.js.map +1 -1
  68. package/dist/common/cli-output.d.ts +16 -0
  69. package/dist/common/cli-output.js +49 -0
  70. package/dist/common/cli-output.js.map +1 -0
  71. package/dist/compilers/bun.js +1 -1
  72. package/dist/compilers/bun.js.map +1 -1
  73. package/dist/linters/eslint.js +1 -1
  74. package/dist/linters/eslint.js.map +1 -1
  75. package/dist/linters/house/browser-api-patterns.d.ts +43 -0
  76. package/dist/linters/house/browser-api-patterns.js +87 -0
  77. package/dist/linters/house/browser-api-patterns.js.map +1 -0
  78. package/dist/linters/house/common.d.ts +17 -2
  79. package/dist/linters/house/common.js +18 -2
  80. package/dist/linters/house/common.js.map +1 -1
  81. package/dist/linters/house/configs.js +25 -0
  82. package/dist/linters/house/configs.js.map +1 -1
  83. package/dist/linters/house/const-class-values.rule.d.ts +2 -2
  84. package/dist/linters/house/const-class-values.rule.js +14 -5
  85. package/dist/linters/house/const-class-values.rule.js.map +1 -1
  86. package/dist/linters/house/effect-cleanup-consistency.rule.d.ts +2 -2
  87. package/dist/linters/house/effect-cleanup-consistency.rule.js +1 -1
  88. package/dist/linters/house/effect-cleanup-consistency.rule.js.map +1 -1
  89. package/dist/linters/house/framework-api-patterns.d.ts +54 -0
  90. package/dist/linters/house/framework-api-patterns.js +62 -0
  91. package/dist/linters/house/framework-api-patterns.js.map +1 -0
  92. package/dist/linters/house/framework-exports.d.ts +62 -0
  93. package/dist/linters/house/framework-exports.js +325 -0
  94. package/dist/linters/house/framework-exports.js.map +1 -0
  95. package/dist/linters/house/import-support.d.ts +56 -0
  96. package/dist/linters/house/import-support.js +179 -0
  97. package/dist/linters/house/import-support.js.map +1 -0
  98. package/dist/linters/house/index.d.ts +12 -0
  99. package/dist/linters/house/index.js +15 -1
  100. package/dist/linters/house/index.js.map +1 -1
  101. package/dist/linters/house/max-params-own.rule.d.ts +2 -2
  102. package/dist/linters/house/max-params-own.rule.js +1 -1
  103. package/dist/linters/house/max-params-own.rule.js.map +1 -1
  104. package/dist/linters/house/no-async-hook-callback.rule.d.ts +2 -2
  105. package/dist/linters/house/no-async-hook-callback.rule.js +1 -1
  106. package/dist/linters/house/no-async-hook-callback.rule.js.map +1 -1
  107. package/dist/linters/house/no-await-new-chain.rule.d.ts +2 -2
  108. package/dist/linters/house/no-await-new-chain.rule.js +1 -1
  109. package/dist/linters/house/no-await-new-chain.rule.js.map +1 -1
  110. package/dist/linters/house/no-await-promise-chain.rule.d.ts +2 -2
  111. package/dist/linters/house/no-await-promise-chain.rule.js +5 -5
  112. package/dist/linters/house/no-await-promise-chain.rule.js.map +1 -1
  113. package/dist/linters/house/no-inline-await.rule.d.ts +2 -2
  114. package/dist/linters/house/no-inline-await.rule.js +1 -1
  115. package/dist/linters/house/no-inline-await.rule.js.map +1 -1
  116. package/dist/linters/house/no-leaked-render.rule.d.ts +2 -2
  117. package/dist/linters/house/no-leaked-render.rule.js +1 -1
  118. package/dist/linters/house/no-leaked-render.rule.js.map +1 -1
  119. package/dist/linters/house/no-new-error.rule.d.ts +2 -2
  120. package/dist/linters/house/no-new-error.rule.js +2 -2
  121. package/dist/linters/house/no-new-error.rule.js.map +1 -1
  122. package/dist/linters/house/no-parent-import.rule.d.ts +45 -0
  123. package/dist/linters/house/no-parent-import.rule.js +176 -0
  124. package/dist/linters/house/no-parent-import.rule.js.map +1 -0
  125. package/dist/linters/house/no-return-await.rule.d.ts +2 -2
  126. package/dist/linters/house/no-return-await.rule.js +1 -1
  127. package/dist/linters/house/no-return-await.rule.js.map +1 -1
  128. package/dist/linters/house/no-shadow-framework-type.rule.d.ts +24 -0
  129. package/dist/linters/house/no-shadow-framework-type.rule.js +100 -0
  130. package/dist/linters/house/no-shadow-framework-type.rule.js.map +1 -0
  131. package/dist/linters/house/no-silent-catch.rule.d.ts +2 -2
  132. package/dist/linters/house/no-silent-catch.rule.js +3 -3
  133. package/dist/linters/house/no-silent-catch.rule.js.map +1 -1
  134. package/dist/linters/house/no-unbraced-case.rule.d.ts +2 -2
  135. package/dist/linters/house/no-unbraced-case.rule.js +1 -1
  136. package/dist/linters/house/no-unbraced-case.rule.js.map +1 -1
  137. package/dist/linters/house/plugin.d.ts +1 -1
  138. package/dist/linters/house/plugin.js +18 -2
  139. package/dist/linters/house/plugin.js.map +1 -1
  140. package/dist/linters/house/prefer-framework-api.rule.d.ts +83 -0
  141. package/dist/linters/house/prefer-framework-api.rule.js +562 -0
  142. package/dist/linters/house/prefer-framework-api.rule.js.map +1 -0
  143. package/dist/linters/house/prefer-http-method.rule.d.ts +22 -0
  144. package/dist/linters/house/prefer-http-method.rule.js +182 -0
  145. package/dist/linters/house/prefer-http-method.rule.js.map +1 -0
  146. package/dist/linters/house/prefer-promise-sleep.rule.d.ts +26 -0
  147. package/dist/linters/house/prefer-promise-sleep.rule.js +155 -0
  148. package/dist/linters/house/prefer-promise-sleep.rule.js.map +1 -0
  149. package/dist/linters/house/prefer-tnullable.rule.d.ts +25 -0
  150. package/dist/linters/house/prefer-tnullable.rule.js +124 -0
  151. package/dist/linters/house/prefer-tnullable.rule.js.map +1 -0
  152. package/dist/linters/house/typed-route-context.rule.d.ts +19 -0
  153. package/dist/linters/house/typed-route-context.rule.js +334 -0
  154. package/dist/linters/house/typed-route-context.rule.js.map +1 -0
  155. package/dist/linters/house/zod-schema-convention.rule.d.ts +82 -0
  156. package/dist/linters/house/zod-schema-convention.rule.js +477 -0
  157. package/dist/linters/house/zod-schema-convention.rule.js.map +1 -0
  158. package/dist/linters/oxlint.js +11 -1
  159. package/dist/linters/oxlint.js.map +1 -1
  160. package/dist/linters/react-eslint.js.map +1 -1
  161. package/dist/linters/rules/naming-convention.rule.d.ts +4 -1
  162. package/dist/linters/rules/naming-convention.rule.js +30 -1
  163. package/dist/linters/rules/naming-convention.rule.js.map +1 -1
  164. package/dist/linters/rules/no-restricted-properties.rule.js +1 -1
  165. package/dist/linters/rules/no-restricted-properties.rule.js.map +1 -1
  166. package/dist/testing/index.d.ts +2 -2
  167. package/dist/testing/index.js +2 -2
  168. package/dist/testing/index.js.map +1 -1
  169. package/dist/testing/{rejection.helper.d.ts → rejection.utility.d.ts} +4 -4
  170. package/dist/testing/{rejection.helper.js → rejection.utility.js} +7 -7
  171. package/dist/testing/rejection.utility.js.map +1 -0
  172. package/dist/testing/{spawn.helper.d.ts → spawn.utility.d.ts} +2 -2
  173. package/dist/testing/{spawn.helper.js → spawn.utility.js} +6 -6
  174. package/dist/testing/spawn.utility.js.map +1 -0
  175. package/package.json +7 -7
  176. package/dist/testing/rejection.helper.js.map +0 -1
  177. package/dist/testing/spawn.helper.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zod-schema-convention.rule.js","sourceRoot":"","sources":["../../../src/linters/house/zod-schema-convention.rule.ts"],"names":[],"mappings":";;;AAAA,yCAAuD;AAGvD,qCAAyE;AAwBzE;;;;;;;;;GASG;AACH,MAAa,uBAAuB;aAClB,SAAI,GAAG,GAAG,+BAAsB,wBAAwB,CAAC;aAEjD,eAAU,GAAG,gBAAgB,CAAC;IAEtD,wFAAwF;aAChE,gBAAW,GAAG,mBAAmB,CAAC;aAElC,gBAAW,GAAG,2BAA2B,CAAC;aAE1C,WAAM,GAAG,sBAAsB,CAAC;IAExD,oHAAoH;aAC5F,oBAAe,GAAG,wBAAwB,CAAC;IAEnE,0EAA0E;aAClD,cAAS,GAAG,WAAW,CAAC;aAExB,cAAS,GAAG,0DAA0D,CAAC;IAE/F,kGAAkG;aAC1E,gBAAW,GAAG,IAAI,GAAG,CAAC;QAC5C,OAAO;QACP,QAAQ;QACR,OAAO;QACP,MAAM;QACN,SAAS;QACT,MAAM;QACN,UAAU;QACV,YAAY;KACb,CAAC,CAAC;IAEH,yGAAyG;aACjF,iBAAY,GAAG,IAAI,GAAG,CAAC;QAC7C,OAAO;QACP,YAAY;QACZ,WAAW;QACX,gBAAgB;QAChB,QAAQ;QACR,aAAa;QACb,YAAY;QACZ,iBAAiB;QACjB,QAAQ;QACR,aAAa;QACb,YAAY;QACZ,iBAAiB;QACjB,KAAK;QACL,cAAc;QACd,cAAc;QACd,eAAe;QACf,cAAc;QACd,cAAc;QACd,aAAa;QACb,UAAU;QACV,gBAAgB;QA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ACL,QAAQ;YACR;gBACE,UAAU;gBACV,QAAQ;gBACR,WAAW,EAAE,CAAC,GAAG,WAAW,CAAC;gBAC7B,UAAU,EAAE,CAAC,GAAG,UAAU,CAAC;gBAC3B,UAAU;gBACV,aAAa;gBACb,aAAa,EAAE,CAAC,GAAG,aAAa,CAAC;gBACjC,WAAW;gBACX,MAAM,EAAE,CAAC,GAAG,MAAM,CAAC;aACpB;SACF,CAAC;IACJ,CAAC;;AAvmBH,0DAwmBC","sourcesContent":["import { matchesGlob, relative, sep } from 'node:path';\nimport type { Linter, Rule, Scope } from 'eslint';\nimport type { TRuleSeverity } from '../rules/common';\nimport { AstNode, AstNodeTypes, HOUSE_PLUGIN_NAMESPACE } from './common';\n\n/** The checks of `@venizia/zod-schema-convention`, as its options take them. */\nexport interface IZodSchemaConventionOptions {\n /** A const that holds a schema is PascalCase and ends in `Schema`. @default true */\n schemaName?: boolean;\n /** A type inferred from a schema `XSchema` is named `TX` or `XType`. @default true */\n typeName?: boolean;\n /** Globs, from the working directory, of the files where an object schema is `z.strictObject`. @default [] */\n strictPaths?: ReadonlyArray<string>;\n /** Globs, from the working directory, of the files where `z.any()` is refused. @default [] */\n noAnyPaths?: ReadonlyArray<string>;\n /** `z.object({ ... }).strict()` is written `z.strictObject({ ... })`, in every file. @default true */\n strictCall?: boolean;\n /** Refuses `.passthrough()` on a schema. @default true */\n noPassthrough?: boolean;\n /** Globs, from the working directory, of the files where `z.coerce` is refused. @default [] */\n noCoercePaths?: ReadonlyArray<string>;\n /** Skips test files. @default true */\n ignoreTests?: boolean;\n /** Names of consts and types the two name checks leave alone. @default [] */\n ignore?: ReadonlyArray<string>;\n}\n\n/**\n * `@venizia/zod-schema-convention`. How a zod schema is named, how its inferred types are named, that a strict object\n * is written `z.strictObject` and `.passthrough()` is not used and, in the files a project lists, that objects are\n * strict and `any` and `z.coerce` are not used.\n *\n * A schema is recognised file by file, without types: a call chain that starts at an import of `zod` (or `z` of\n * `@hono/zod-openapi`), at another schema const of the file, or at an import named `...Schema` / `..._SCHEMA` through a\n * method that builds a schema (`extend`, `pick`, ...). An imported schema under another name, a member\n * (`this.schema.extend`), a factory's result and a schema held in an object are not followed.\n */\nexport class ZodSchemaConventionRule {\n static readonly NAME = `${HOUSE_PLUGIN_NAMESPACE}/zod-schema-convention`;\n\n private static readonly ZOD_SOURCE = /^zod(?:\\/.*)?$/;\n\n /** Re-exports `z` next to its own functions (`createRoute`), so only its `z` is zod. */\n private static readonly HONO_SOURCE = '@hono/zod-openapi';\n\n private static readonly SCHEMA_NAME = /^[A-Z][A-Za-z0-9]*Schema$/;\n\n private static readonly SUFFIX = /_?(?:Schema|SCHEMA)$/;\n\n /** An import that names a schema: something before the suffix, so a bare `Schema` of another library is not one. */\n private static readonly IMPORTED_SCHEMA = /^.+(?:Schema|_SCHEMA)$/;\n\n /** zod's classes: `ZodError.create([])` answers a value, not a schema. */\n private static readonly ZOD_CLASS = /^Zod[A-Z]/;\n\n private static readonly TEST_FILE = /(?:^|[\\\\/])__tests__[\\\\/]|\\.(?:test|spec)\\.[cm]?[jt]sx?$/;\n\n /** The methods that make a schema of an imported one; any other call on it may answer a value. */\n private static readonly DERIVATIONS = new Set([\n 'array',\n 'extend',\n 'merge',\n 'omit',\n 'partial',\n 'pick',\n 'required',\n 'safeExtend',\n ]);\n\n /** A chain through one of these answers a value, an error report or a part of a schema, not a schema. */\n private static readonly NOT_A_SCHEMA = new Set([\n 'parse',\n 'parseAsync',\n 'safeParse',\n 'safeParseAsync',\n 'decode',\n 'decodeAsync',\n 'safeDecode',\n 'safeDecodeAsync',\n 'encode',\n 'encodeAsync',\n 'safeEncode',\n 'safeEncodeAsync',\n 'spa',\n 'toJSONSchema',\n 'toJsonSchema',\n 'prettifyError',\n 'treeifyError',\n 'flattenError',\n 'formatError',\n 'registry',\n 'globalRegistry',\n 'locales',\n 'config',\n 'isOptional',\n 'isNullable',\n 'shape',\n 'def',\n '_def',\n '_zod',\n 'description',\n 'options',\n 'implement',\n 'implementAsync',\n 'regexes',\n ]);\n\n /** The wrappers a type adds around an expression. */\n private static readonly WRAPPERS = new Set<string>([\n AstNodeTypes.AS_EXPRESSION,\n AstNodeTypes.SATISFIES_EXPRESSION,\n AstNodeTypes.NON_NULL_EXPRESSION,\n AstNodeTypes.CHAIN_EXPRESSION,\n ]);\n\n private static readonly INFERENCES = new Set<unknown>(['infer', 'input', 'output']);\n\n private static readString(opts: { node: unknown; path: ReadonlyArray<string> }): string {\n const value = opts.path.reduce<unknown>(\n (node, key) => AstNode.readField({ node, key }),\n opts.node,\n );\n\n return typeof value === 'string' ? value : '';\n }\n\n /** Whether the member access `node` leaves the schema: its value is not one. */\n private static isOutside(opts: { node: Rule.Node; member: string }): boolean {\n const { node, member } = opts;\n const parent: unknown = AstNode.readField({ node, key: 'parent' });\n const args: unknown = AstNode.readField({ node: parent, key: 'arguments' });\n const isCalled = AstNode.readField({ node: parent, key: 'callee' }) === node;\n\n if (ZodSchemaConventionRule.NOT_A_SCHEMA.has(member)) {\n return true;\n }\n\n if (ZodSchemaConventionRule.ZOD_CLASS.test(member)) {\n return true;\n }\n\n // `z.enum([...])` builds a schema and `.enum` reads its values; `.meta(info)` builds one and `.meta()` reads it.\n if (member === 'enum') {\n return !isCalled;\n }\n\n return member === 'meta' && Array.isArray(args) && args.length === 0;\n }\n\n /**\n * The identifier a call chain starts from, the member its first call goes through (`''` when it calls the identifier\n * itself), when it has a call and stays a schema.\n */\n private static chainOf(opts: { expression: unknown }) {\n let node: unknown = opts.expression;\n let hasCall = false;\n let firstCall = '';\n\n while (AstNode.isNode(node)) {\n const type = AstNode.getType({ node });\n\n if (type === AstNodeTypes.IDENTIFIER) {\n return hasCall ? { root: node, firstCall } : undefined;\n }\n\n if (type === AstNodeTypes.CALL_EXPRESSION) {\n const callee = AstNode.readField({ node, key: 'callee' });\n\n hasCall = true;\n firstCall = ZodSchemaConventionRule.readString({\n node: callee,\n path: ['property', 'name'],\n });\n node = callee;\n continue;\n }\n\n if (type === AstNodeTypes.MEMBER_EXPRESSION) {\n const member = ZodSchemaConventionRule.readString({ node, path: ['property', 'name'] });\n\n if (ZodSchemaConventionRule.isOutside({ node, member })) {\n return undefined;\n }\n\n node = AstNode.readField({ node, key: 'object' });\n continue;\n }\n\n if (type === undefined || !ZodSchemaConventionRule.WRAPPERS.has(type)) {\n return undefined;\n }\n\n node = AstNode.readField({ node, key: 'expression' });\n }\n\n return undefined;\n }\n\n /** The declaration an identifier resolves to, from the scope it is read in. */\n private static definitionOf(opts: {\n context: Rule.RuleContext;\n node: Rule.Node;\n }): Scope.Definition | undefined {\n const { context, node } = opts;\n const name = ZodSchemaConventionRule.readString({ node, path: ['name'] });\n let scope: Scope.Scope | null = context.sourceCode.getScope(node);\n\n while (scope) {\n const variable = scope.set.get(name);\n\n if (variable && variable.defs.length > 0) {\n return variable.defs[0];\n }\n\n scope = scope.upper;\n }\n\n return undefined;\n }\n\n /** The name zod exports what an import binds, when the import is zod's: `''` for a default or a namespace. */\n private static zodImport(opts: { definition: Scope.Definition | undefined }): string | undefined {\n const { definition } = opts;\n\n if (definition?.type !== 'ImportBinding') {\n return undefined;\n }\n\n const source = ZodSchemaConventionRule.readString({\n node: definition.parent,\n path: ['source', 'value'],\n });\n const imported = ZodSchemaConventionRule.readString({\n node: definition.node,\n path: ['imported', 'name'],\n });\n\n if (source === ZodSchemaConventionRule.HONO_SOURCE) {\n return imported === 'z' ? imported : undefined;\n }\n\n return ZodSchemaConventionRule.ZOD_SOURCE.test(source) &&\n !ZodSchemaConventionRule.NOT_A_SCHEMA.has(imported) &&\n !ZodSchemaConventionRule.ZOD_CLASS.test(imported)\n ? imported\n : undefined;\n }\n\n /**\n * Whether `expression` builds a schema; `seen` stops a declaration that refers to itself. `isNameTrusted` also takes\n * an import named `...Schema` for one.\n */\n private static isSchema(opts: {\n context: Rule.RuleContext;\n expression: unknown;\n seen: Set<unknown>;\n isNameTrusted: boolean;\n }): boolean {\n const { context, expression, seen, isNameTrusted } = opts;\n const chain = ZodSchemaConventionRule.chainOf({ expression });\n\n if (chain === undefined || seen.has(expression)) {\n return false;\n }\n\n seen.add(expression);\n\n const definition = ZodSchemaConventionRule.definitionOf({ context, node: chain.root });\n\n if (ZodSchemaConventionRule.zodImport({ definition }) !== undefined) {\n return true;\n }\n\n if (definition?.type === 'ImportBinding') {\n const name = ZodSchemaConventionRule.readString({ node: chain.root, path: ['name'] });\n\n // The derivation is the first call: what a call before it answers is not followed.\n return (\n isNameTrusted &&\n ZodSchemaConventionRule.IMPORTED_SCHEMA.test(name) &&\n ZodSchemaConventionRule.DERIVATIONS.has(chain.firstCall)\n );\n }\n\n return ZodSchemaConventionRule.isSchemaConst({ context, definition, seen, isNameTrusted });\n }\n\n /** Whether a declaration is a const or a variable that holds a schema. */\n private static isSchemaConst(opts: {\n context: Rule.RuleContext;\n definition: Scope.Definition | undefined;\n seen: Set<unknown>;\n isNameTrusted: boolean;\n }): boolean {\n const { context, definition, seen, isNameTrusted } = opts;\n\n return (\n definition?.type === 'Variable' &&\n ZodSchemaConventionRule.isSchema({\n context,\n expression: AstNode.readField({ node: definition.node, key: 'init' }),\n seen,\n isNameTrusted,\n })\n );\n }\n\n /** `saleOrder`, `SALE_ORDER` and `SaleOrder` are all `SaleOrder`. */\n private static toPascalCase(opts: { name: string }): string {\n const isUpper = /^[A-Z0-9_$]+$/.test(opts.name);\n\n return opts.name\n .split(/[_$]+/)\n .map((word) => (isUpper ? word.toLowerCase() : word))\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join('');\n }\n\n /** The name of the schema a type alias infers from, and by which inference; `undefined` for any other type. */\n private static inferenceOf(opts: { context: Rule.RuleContext; node: Rule.Node }) {\n const { context, node } = opts;\n const annotation = AstNode.readField({ node, key: 'typeAnnotation' });\n const typeName = AstNode.readField({ node: annotation, key: 'typeName' });\n const left = AstNode.readField({ node: typeName, key: 'left' });\n const kind = ZodSchemaConventionRule.readString({ node: typeName, path: ['right', 'name'] });\n const args = AstNode.readField({\n node: AstNode.readField({ node: annotation, key: 'typeArguments' }),\n key: 'params',\n });\n const query = Array.isArray(args) ? args[0] : undefined;\n\n if (\n !AstNode.isNode(left) ||\n !ZodSchemaConventionRule.INFERENCES.has(kind) ||\n AstNode.getType({ node: query }) !== AstNodeTypes.TYPE_QUERY\n ) {\n return undefined;\n }\n\n const definition = ZodSchemaConventionRule.definitionOf({ context, node: left });\n const target = AstNode.readField({ node: query, key: 'exprName' });\n const schema =\n ZodSchemaConventionRule.readString({ node: target, path: ['name'] }) ||\n ZodSchemaConventionRule.readString({ node: target, path: ['right', 'name'] });\n\n return ZodSchemaConventionRule.zodImport({ definition }) === undefined || schema === ''\n ? undefined\n : { schema, kind };\n }\n\n private static matches(opts: { context: Rule.RuleContext; globs: unknown }): boolean {\n const { context, globs } = opts;\n const path = relative(context.cwd, context.filename).split(sep).join('/');\n\n return (\n Array.isArray(globs) &&\n globs.some((glob) => typeof glob === 'string' && matchesGlob(path, glob))\n );\n }\n\n static readonly RULE: Rule.RuleModule = {\n meta: {\n type: 'suggestion',\n fixable: 'code',\n schema: [\n {\n type: 'object',\n properties: {\n schemaName: { type: 'boolean' },\n typeName: { type: 'boolean' },\n strictPaths: { type: 'array', items: { type: 'string' } },\n noAnyPaths: { type: 'array', items: { type: 'string' } },\n strictCall: { type: 'boolean' },\n noPassthrough: { type: 'boolean' },\n noCoercePaths: { type: 'array', items: { type: 'string' } },\n ignoreTests: { type: 'boolean' },\n ignore: { type: 'array', items: { type: 'string' } },\n },\n additionalProperties: false,\n },\n ],\n messages: {\n schemaName:\n 'A const that holds a zod schema is PascalCase and ends in `Schema`: `{{name}} → {{expected}}`.',\n typeName:\n 'A type inferred from `{{schema}}` is named `{{expected}}` or `{{other}}`, not `{{name}}`.',\n strict: 'An object schema here is strict: `z.strictObject({ ... })`.',\n any: '`z.any()` accepts everything: describe the value, or use `z.unknown()` and narrow it.',\n strictCall:\n '`z.object(...).strict()` is `z.strictObject(...)`: write the strict object directly.',\n passthrough:\n '`.passthrough()` is deprecated: write `z.looseObject({ ... })`, or `.loose()` on a schema you did not declare here.',\n coerce:\n '`z.coerce` accepts what it can convert, `\"abc\"` as `NaN` included: declare both sides with `z.codec`.',\n },\n },\n create: (context) => {\n const options: unknown = context.options[0];\n const read = (key: string) => AstNode.readField({ node: options, key });\n\n if (\n read('ignoreTests') !== false &&\n ZodSchemaConventionRule.TEST_FILE.test(context.filename)\n ) {\n return {};\n }\n\n const configured = read('ignore');\n const ignored = new Set<unknown>(Array.isArray(configured) ? configured : []);\n const isStrict = ZodSchemaConventionRule.matches({ context, globs: read('strictPaths') });\n const isNoAny = ZodSchemaConventionRule.matches({ context, globs: read('noAnyPaths') });\n const isNoCoerce = ZodSchemaConventionRule.matches({ context, globs: read('noCoercePaths') });\n const isStrictCallChecked = read('strictCall') !== false;\n const isPassthroughChecked = read('noPassthrough') !== false;\n\n const checkName = (node: Rule.Node) => {\n const parent: unknown = AstNode.readField({ node, key: 'parent' });\n const id = AstNode.readField({ node, key: 'id' });\n const name = ZodSchemaConventionRule.readString({ node: id, path: ['name'] });\n\n if (\n AstNode.readField({ node: parent, key: 'kind' }) !== 'const' ||\n name === '' ||\n ignored.has(name) ||\n ZodSchemaConventionRule.SCHEMA_NAME.test(name) ||\n !ZodSchemaConventionRule.isSchema({\n context,\n expression: AstNode.readField({ node, key: 'init' }),\n seen: new Set(),\n isNameTrusted: true,\n })\n ) {\n return;\n }\n\n const base = ZodSchemaConventionRule.toPascalCase({\n name: name.replace(/_?(?:schema|Schema|SCHEMA)$/, ''),\n });\n\n context.report({\n node: AstNode.isNode(id) ? id : node,\n messageId: 'schemaName',\n data: { name, expected: `${base || '<What>'}Schema` },\n });\n };\n\n const checkType = (node: Rule.Node) => {\n const name = ZodSchemaConventionRule.readString({ node, path: ['id', 'name'] });\n const inference = ZodSchemaConventionRule.inferenceOf({ context, node });\n\n if (inference === undefined || ignored.has(name)) {\n return;\n }\n\n const base = ZodSchemaConventionRule.toPascalCase({\n name: inference.schema.replace(ZodSchemaConventionRule.SUFFIX, ''),\n });\n // A schema with two types names each by the side it describes.\n const side = inference.kind === 'input' ? 'Input' : 'Output';\n const allowed = [`T${base}`, `${base}Type`, `T${base}${side}`, `${base}${side}Type`];\n\n if (base !== '' && !allowed.includes(name)) {\n context.report({\n node,\n messageId: 'typeName',\n data: { name, schema: inference.schema, expected: `T${base}`, other: `${base}Type` },\n });\n }\n };\n\n /** Whether the identifier `node` is zod's `name`, as an import binds it. */\n const isZodImport = (opts: { node: unknown; name?: string }) => {\n const { node, name } = opts;\n\n if (!AstNode.isNode(node) || AstNode.getType({ node }) !== AstNodeTypes.IDENTIFIER) {\n return false;\n }\n\n const definition = ZodSchemaConventionRule.definitionOf({ context, node });\n const imported = ZodSchemaConventionRule.zodImport({ definition });\n\n return name === undefined ? imported !== undefined : imported === name;\n };\n\n /** Whether the file proves `target` a zod schema: a chain or a local const that starts at zod, never a name. */\n const isProvenSchema = (target: unknown) => {\n const proof = { context, seen: new Set<unknown>(), isNameTrusted: false };\n\n if (\n !AstNode.isNode(target) ||\n AstNode.getType({ node: target }) !== AstNodeTypes.IDENTIFIER\n ) {\n return ZodSchemaConventionRule.isSchema({ ...proof, expression: target });\n }\n\n const definition = ZodSchemaConventionRule.definitionOf({ context, node: target });\n\n return ZodSchemaConventionRule.isSchemaConst({ ...proof, definition });\n };\n\n /** `z.coerce.number()`, or `coerce.number()` where `coerce` is imported from zod. */\n const checkCoerce = (opts: { node: Rule.Node; target: unknown }) => {\n const { node, target } = opts;\n const owner = AstNode.readField({ node: target, key: 'object' });\n const member = ZodSchemaConventionRule.readString({\n node: target,\n path: ['property', 'name'],\n });\n\n if (\n isZodImport({ node: target, name: 'coerce' }) ||\n (member === 'coerce' && isZodImport({ node: owner }))\n ) {\n context.report({ node, messageId: 'coerce' });\n }\n };\n\n /** `.strict()` called on `node`, with its fix when the call says no more than `z.strictObject`. */\n const strictCallOf = (opts: { node: Rule.Node; property: unknown }) => {\n const { node, property } = opts;\n const member: unknown = AstNode.readField({ node, key: 'parent' });\n const outer: unknown = AstNode.readField({ node: member, key: 'parent' });\n const args: unknown = AstNode.readField({ node: outer, key: 'arguments' });\n const isCalled =\n ZodSchemaConventionRule.readString({ node: member, path: ['property', 'name'] }) ===\n 'strict' && AstNode.readField({ node: outer, key: 'callee' }) === member;\n\n if (!isCalled) {\n return undefined;\n }\n\n // `z.object(x).strict()` says the same as `z.strictObject(x)`; with an argument it says more.\n if (\n !Array.isArray(args) ||\n args.length > 0 ||\n !AstNode.isNode(property) ||\n !AstNode.isNode(outer)\n ) {\n return { fix: null };\n }\n\n const fix: Rule.ReportFixer = (fixer) => {\n const end = context.sourceCode.getRange(node)[1];\n const tail: [number, number] = [end, context.sourceCode.getRange(outer)[1]];\n const hasComment = context.sourceCode\n .getAllComments()\n .some(\n (comment) =>\n (comment.range?.[0] ?? 0) >= tail[0] && (comment.range?.[1] ?? 0) <= tail[1],\n );\n\n return hasComment\n ? null\n : [fixer.replaceText(property, 'strictObject'), fixer.removeRange(tail)];\n };\n\n return { fix };\n };\n\n const checkCall = (node: Rule.Node) => {\n const callee = AstNode.readField({ node, key: 'callee' });\n const isMember = AstNode.getType({ node: callee }) === AstNodeTypes.MEMBER_EXPRESSION;\n const root = isMember ? AstNode.readField({ node: callee, key: 'object' }) : callee;\n const property = AstNode.readField({ node: callee, key: 'property' });\n const method = ZodSchemaConventionRule.readString({ node: property, path: ['name'] });\n\n if (isPassthroughChecked && isMember && method === 'passthrough') {\n if (isProvenSchema(root)) {\n context.report({ node, messageId: 'passthrough' });\n }\n }\n\n if (isNoCoerce && isMember) {\n checkCoerce({ node, target: root });\n }\n\n if (!AstNode.isNode(root) || AstNode.getType({ node: root }) !== AstNodeTypes.IDENTIFIER) {\n return;\n }\n\n const definition = ZodSchemaConventionRule.definitionOf({ context, node: root });\n const imported = ZodSchemaConventionRule.zodImport({ definition });\n\n if (imported === undefined) {\n return;\n }\n\n const called = isMember ? method : imported;\n\n if (isNoAny && called === 'any') {\n context.report({ node, messageId: 'any' });\n }\n\n if (called !== 'object') {\n return;\n }\n\n const strictCall = strictCallOf({ node, property: isMember ? property : undefined });\n\n if (isStrict) {\n context.report({ node, messageId: 'strict', fix: strictCall?.fix ?? null });\n\n return;\n }\n\n if (isStrictCallChecked && strictCall) {\n context.report({ node, messageId: 'strictCall', fix: strictCall.fix });\n }\n };\n\n return {\n ...(read('schemaName') !== false && {\n [AstNodeTypes.VARIABLE_DECLARATOR]: checkName,\n }),\n ...(read('typeName') !== false && { [AstNodeTypes.TYPE_ALIAS_DECLARATION]: checkType }),\n ...((isStrict || isNoAny || isNoCoerce || isStrictCallChecked || isPassthroughChecked) && {\n [AstNodeTypes.CALL_EXPRESSION]: checkCall,\n }),\n };\n },\n };\n\n static build(\n opts: IZodSchemaConventionOptions & { severity?: TRuleSeverity } = {},\n ): Linter.RuleEntry {\n const {\n severity = 'error',\n schemaName = true,\n typeName = true,\n strictPaths = [],\n noAnyPaths = [],\n strictCall = true,\n noPassthrough = true,\n noCoercePaths = [],\n ignoreTests = true,\n ignore = [],\n } = opts;\n\n return [\n severity,\n {\n schemaName,\n typeName,\n strictPaths: [...strictPaths],\n noAnyPaths: [...noAnyPaths],\n strictCall,\n noPassthrough,\n noCoercePaths: [...noCoercePaths],\n ignoreTests,\n ignore: [...ignore],\n },\n ];\n }\n}\n"]}
@@ -121,7 +121,12 @@ exports.oxlintConfigs = {
121
121
  'typescript/triple-slash-reference': 'error',
122
122
  'typescript/adjacent-overload-signatures': 'error',
123
123
  'typescript/prefer-for-of': 'error',
124
- 'typescript/unified-signatures': 'error',
124
+ // An overload with TSDoc of its own is one on purpose.
125
+ 'typescript/unified-signatures': ['error', { ignoreOverloadsWithDifferentJSDoc: true }],
126
+ // The base code rules: arrows over `function`, a logger over `console`, a `default` in every `switch`.
127
+ 'func-style': ['error', 'expression'],
128
+ 'no-console': 'error',
129
+ 'default-case': 'error',
125
130
  // typescript-eslint, type-aware
126
131
  'typescript/await-thenable': 'error',
127
132
  'typescript/no-floating-promises': 'error',
@@ -133,6 +138,11 @@ exports.oxlintConfigs = {
133
138
  'typescript/return-await': 'error',
134
139
  },
135
140
  overrides: [
141
+ {
142
+ // A test writes what it needs to prove its subject.
143
+ files: ['**/__tests__/**', '**/*.test.{ts,tsx,mts,cts}', '**/*.spec.{ts,tsx,mts,cts}'],
144
+ rules: { 'func-style': 'off', 'no-console': 'off', 'default-case': 'off' },
145
+ },
136
146
  {
137
147
  // TypeScript itself reports these.
138
148
  files: TS_FILES,
@@ -1 +1 @@
1
- {"version":3,"file":"oxlint.js","sourceRoot":"","sources":["../../src/linters/oxlint.ts"],"names":[],"mappings":";;;AACA,qCAAsC;AACtC,mCAMiB;AAEjB,0CAA0C;AAC1C,MAAM,QAAQ,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;AACjE,MAAM,WAAW,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,QAAQ,CAAC,CAAC;AAEjF;;;;;;;;;;;;;;;;;;;GAmBG;AACU,QAAA,aAAa,GAAiB;IACzC,OAAO,EAAE,CAAC,YAAY,EAAE,SAAS,CAAC;IAClC,UAAU,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE;IAClC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE;IAC5B,GAAG,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;IACtB,cAAc,EAAE,CAAC,kBAAkB,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,CAAC;IACzF,KAAK,EAAE;QACL,qBAAqB;QACrB,mBAAmB,EAAE,OAAO;QAC5B,eAAe,EAAE,OAAO;QACxB,eAAe,EAAE,OAAO;QACxB,2BAA2B,EAAE,OAAO;QACpC,sBAAsB,EAAE,OAAO;QAC/B,iBAAiB,EAAE,OAAO;QAC1B,qBAAqB,EAAE,OAAO;QAC9B,gBAAgB,EAAE,OAAO;QACzB,iBAAiB,EAAE,OA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AiB,IAAI,CAAC,eAAe;YAC/C,CAAC,CAAC;gBACE,GAAG,qBAAa;gBAChB,KAAK,EAAE;oBACL,GAAG,qBAAa,CAAC,KAAK;oBACtB,CAAC,mCAA2B,CAAC,IAAI,CAAC,EAAE,mCAA2B,CAAC,KAAK,CAAC;wBACpE,gBAAgB,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;qBACjD,CAAC;iBACH;aACF;YACH,CAAC,CAAC,qBAAa,CAAC;QAElB,OAAO,mBAAU,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC,CAAC;IACpE,CAAC;CACF;AAhBD,sCAgBC","sourcesContent":["import type { OxlintConfig } from 'oxlint';\nimport { LintIgnore } from './ignore';\nimport {\n EqeqeqRule,\n NoRestrictedImportsRule,\n NoUnusedVarsRule,\n PreferNullishCoalescingRule,\n SwitchCaseBracesRule,\n} from './rules';\n\n/** File globs the rules are scoped to. */\nconst TS_FILES = ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts'];\nconst JS_TS_FILES = ['**/*.js', '**/*.cjs', '**/*.mjs', '**/*.jsx', ...TS_FILES];\n\n/**\n * The oxlint port of `eslintConfigs`, generated with `@oxlint/migrate` and kept rule for rule.\n * Type-aware rules (`no-floating-promises`, `return-await`, ...) need `oxlint-tsgolint` installed.\n *\n * Not ported: `@typescript-eslint/naming-convention` (oxlint has no equivalent yet - keep it in\n * ESLint), `@typescript-eslint/prefer-optional-chain` (oxlint nursery), `no-invalid-this` (covered\n * by `noImplicitThis` in `tsconfig.base.json`). `n/prefer-node-protocol` maps to the unicorn rule.\n *\n * ```ts\n * // .configs/lints/oxlint.config.mts\n * import { defineConfig } from 'oxlint';\n * import { oxlintConfigs } from '@venizia/dev-configs/linters/oxlint';\n *\n * export default defineConfig(oxlintConfigs);\n * ```\n *\n * `prefer-nullish-coalescing` allows `||` on a string (`name?.trim() || 'guest'`) and reports it on\n * every other nullable type. `OxlintConfigs.create({ lenientFallback: true })` is the same preset\n * with `||` allowed on number operands too.\n */\nexport const oxlintConfigs: OxlintConfig = {\n plugins: ['typescript', 'unicorn'],\n categories: { correctness: 'off' },\n options: { typeAware: true },\n env: { builtin: true },\n ignorePatterns: ['**/node_modules/', '**/*.d.ts', '**/build/', '**/dist/', '**/release/'],\n rules: {\n // eslint:recommended\n 'constructor-super': 'error',\n 'for-direction': 'error',\n 'getter-return': 'error',\n 'no-async-promise-executor': 'error',\n 'no-case-declarations': 'error',\n 'no-class-assign': 'error',\n 'no-compare-neg-zero': 'error',\n 'no-cond-assign': 'error',\n 'no-const-assign': 'error',\n 'no-constant-binary-expression': 'error',\n 'no-constant-condition': 'error',\n 'no-control-regex': 'error',\n 'no-debugger': 'error',\n 'no-delete-var': 'error',\n 'no-dupe-else-if': 'error',\n 'no-dupe-keys': 'error',\n 'no-duplicate-case': 'error',\n 'no-empty': 'error',\n 'no-empty-character-class': 'error',\n 'no-empty-pattern': 'error',\n 'no-empty-static-block': 'error',\n 'no-ex-assign': 'error',\n 'no-extra-boolean-cast': 'error',\n 'no-fallthrough': 'error',\n 'no-func-assign': 'error',\n 'no-global-assign': 'error',\n 'no-import-assign': 'error',\n 'no-invalid-regexp': 'error',\n 'no-irregular-whitespace': 'error',\n 'no-loss-of-precision': 'error',\n 'no-misleading-character-class': 'error',\n 'no-new-native-nonconstructor': 'error',\n 'no-nonoctal-decimal-escape': 'error',\n 'no-obj-calls': 'error',\n 'no-prototype-builtins': 'error',\n 'no-regex-spaces': 'error',\n 'no-self-assign': 'error',\n 'no-setter-return': 'error',\n 'no-shadow-restricted-names': 'error',\n 'no-sparse-arrays': 'error',\n 'no-this-before-super': 'error',\n 'no-unassigned-vars': 'error',\n 'no-unreachable': 'error',\n 'no-unsafe-finally': 'error',\n 'no-unsafe-negation': 'error',\n 'no-unsafe-optional-chaining': 'error',\n 'no-unused-labels': 'error',\n 'no-unused-private-class-members': 'error',\n 'no-useless-backreference': 'error',\n 'no-useless-catch': 'error',\n 'no-with': 'error',\n 'preserve-caught-error': 'error',\n 'require-yield': 'error',\n 'use-isnan': 'error',\n 'valid-typeof': 'error',\n 'no-array-constructor': 'error',\n\n // Strict rules on top\n [NoUnusedVarsRule.NAME]: NoUnusedVarsRule.build(),\n 'no-useless-escape': 'warn',\n 'no-unused-expressions': 'error',\n 'no-new-wrappers': 'error',\n 'no-throw-literal': 'error',\n [EqeqeqRule.NAME]: EqeqeqRule.build(),\n 'no-void': 'error',\n 'no-caller': 'error',\n 'no-shadow': 'error',\n 'no-use-before-define': 'error',\n [SwitchCaseBracesRule.NAME]: SwitchCaseBracesRule.build(),\n 'unicorn/prefer-node-protocol': 'error',\n\n // typescript-eslint\n 'typescript/ban-ts-comment': 'error',\n 'typescript/no-duplicate-enum-values': 'error',\n 'typescript/no-empty-object-type': 'error',\n 'typescript/no-extra-non-null-assertion': 'error',\n 'typescript/no-misused-new': 'error',\n 'typescript/no-namespace': 'error',\n 'typescript/no-non-null-asserted-optional-chain': 'error',\n 'typescript/no-this-alias': 'error',\n 'typescript/no-unnecessary-type-constraint': 'error',\n 'typescript/no-unsafe-declaration-merging': 'error',\n 'typescript/no-unsafe-function-type': 'error',\n 'typescript/no-wrapper-object-types': 'error',\n 'typescript/prefer-as-const': 'error',\n 'typescript/prefer-namespace-keyword': 'error',\n 'typescript/triple-slash-reference': 'error',\n 'typescript/adjacent-overload-signatures': 'error',\n 'typescript/prefer-for-of': 'error',\n 'typescript/unified-signatures': 'error',\n\n // typescript-eslint, type-aware\n 'typescript/await-thenable': 'error',\n 'typescript/no-floating-promises': 'error',\n // `||` on a string is mostly an intentional empty-string fallback (`value?.trim() || fallback`);\n // `??` keeps `''` and changes behaviour. Objects and numbers still report.\n [PreferNullishCoalescingRule.NAME]: PreferNullishCoalescingRule.build({\n ignorePrimitives: { string: true },\n }),\n 'typescript/return-await': 'error',\n },\n overrides: [\n {\n // TypeScript itself reports these.\n files: TS_FILES,\n rules: {\n 'constructor-super': 'off',\n 'getter-return': 'off',\n 'no-class-assign': 'off',\n 'no-const-assign': 'off',\n 'no-dupe-keys': 'off',\n 'no-func-assign': 'off',\n 'no-import-assign': 'off',\n 'no-new-native-nonconstructor': 'off',\n 'no-obj-calls': 'off',\n 'no-setter-return': 'off',\n 'no-this-before-super': 'off',\n 'no-unreachable': 'off',\n 'no-unsafe-negation': 'off',\n 'no-with': 'off',\n 'no-var': 'error',\n 'prefer-const': 'error',\n 'prefer-rest-params': 'error',\n 'prefer-spread': 'error',\n // A value import of a type becomes a runtime import when Bun runs a decorated class's source\n // (emitDecoratorMetadata) and fails with `Export named 'X' not found`. `import('pkg').T` type\n // annotations stay allowed: they are type-only by construction, and type an optional peer.\n 'typescript/consistent-type-imports': [\n 'error',\n {\n prefer: 'type-imports',\n fixStyle: 'inline-type-imports',\n disallowTypeAnnotations: false,\n },\n ],\n },\n },\n {\n files: JS_TS_FILES,\n rules: {\n 'no-constant-condition': 'off',\n 'prefer-const': 'error',\n 'no-var': 'error',\n curly: ['error', 'all'],\n [NoRestrictedImportsRule.NAME]: NoRestrictedImportsRule.build(),\n 'typescript/no-unsafe-function-type': 'off',\n 'typescript/no-this-alias': 'off',\n 'typescript/no-empty-object-type': 'off',\n },\n },\n ],\n};\n\n/** Options of `OxlintConfigs.create`. */\nexport interface IOxlintPresetOptions {\n /**\n * Also allow `||` / `||=` where the left side is a number, so `limit || 20` passes: `0` falls\n * back on purpose. A string is allowed by the base already. Left off, the base catches a real `0`\n * swallowed by `||`.\n *\n * @default false\n */\n lenientFallback?: boolean;\n /**\n * Project paths to skip - generated files, vendored code - as in `--ignore-pattern`: `src/gen/**`.\n * Every rule is turned off for them (oxlint cannot ignore a project path from `.configs/`).\n * Share the list with ESLint through `LintIgnore`.\n *\n * @default []\n */\n ignore?: string[];\n}\n\n/**\n * Builds `oxlintConfigs` with options. Without any it returns the base preset unchanged.\n *\n * ```ts\n * // .configs/lints/oxlint.config.mts\n * import { defineConfig } from 'oxlint';\n * import { OxlintConfigs } from '@venizia/dev-configs/linters/oxlint';\n *\n * export default defineConfig(OxlintConfigs.create({ lenientFallback: true }));\n * ```\n */\nexport class OxlintConfigs {\n static create(opts: IOxlintPresetOptions = {}): OxlintConfig {\n const config: OxlintConfig = opts.lenientFallback\n ? {\n ...oxlintConfigs,\n rules: {\n ...oxlintConfigs.rules,\n [PreferNullishCoalescingRule.NAME]: PreferNullishCoalescingRule.build({\n ignorePrimitives: { string: true, number: true },\n }),\n },\n }\n : oxlintConfigs;\n\n return LintIgnore.oxlint({ config, patterns: opts.ignore ?? [] });\n }\n}\n"]}
1
+ {"version":3,"file":"oxlint.js","sourceRoot":"","sources":["../../src/linters/oxlint.ts"],"names":[],"mappings":";;;AACA,qCAAsC;AACtC,mCAMiB;AAEjB,0CAA0C;AAC1C,MAAM,QAAQ,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;AACjE,MAAM,WAAW,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,QAAQ,CAAC,CAAC;AAEjF;;;;;;;;;;;;;;;;;;;GAmBG;AACU,QAAA,aAAa,GAAiB;IACzC,OAAO,EAAE,CAAC,YAAY,EAAE,SAAS,CAAC;IAClC,UAAU,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE;IAClC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE;IAC5B,GAAG,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;IACtB,cAAc,EAAE,CAAC,kBAAkB,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,CAAC;IACzF,KAAK,EAAE;QACL,qBAAqB;QACrB,mBAAmB,EAAE,OAAO;QAC5B,eAAe,EAAE,OAAO;QACxB,eAAe,EAAE,OAAO;QACxB,2BAA2B,EAAE,OAAO;QACpC,sBAAsB,EAAE,OAAO;QAC/B,iBAAiB,EAAE,OAAO;Q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,WAAW;YAClB,KAAK,EAAE;gBACL,uBAAuB,EAAE,KAAK;gBAC9B,cAAc,EAAE,OAAO;gBACvB,QAAQ,EAAE,OAAO;gBACjB,KAAK,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC;gBACvB,CAAC,+BAAuB,CAAC,IAAI,CAAC,EAAE,+BAAuB,CAAC,KAAK,EAAE;gBAC/D,oCAAoC,EAAE,KAAK;gBAC3C,0BAA0B,EAAE,KAAK;gBACjC,iCAAiC,EAAE,KAAK;aACzC;SACF;KACF;CACF,CAAC;AAsBF;;;;;;;;;;GAUG;AACH,MAAa,aAAa;IACxB,MAAM,CAAC,MAAM,CAAC,OAA6B,EAAE;QAC3C,MAAM,MAAM,GAAiB,IAAI,CAAC,eAAe;YAC/C,CAAC,CAAC;gBACE,GAAG,qBAAa;gBAChB,KAAK,EAAE;oBACL,GAAG,qBAAa,CAAC,KAAK;oBACtB,CAAC,mCAA2B,CAAC,IAAI,CAAC,EAAE,mCAA2B,CAAC,KAAK,CAAC;wBACpE,gBAAgB,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;qBACjD,CAAC;iBACH;aACF;YACH,CAAC,CAAC,qBAAa,CAAC;QAElB,OAAO,mBAAU,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC,CAAC;IACpE,CAAC;CACF;AAhBD,sCAgBC","sourcesContent":["import type { OxlintConfig } from 'oxlint';\nimport { LintIgnore } from './ignore';\nimport {\n EqeqeqRule,\n NoRestrictedImportsRule,\n NoUnusedVarsRule,\n PreferNullishCoalescingRule,\n SwitchCaseBracesRule,\n} from './rules';\n\n/** File globs the rules are scoped to. */\nconst TS_FILES = ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts'];\nconst JS_TS_FILES = ['**/*.js', '**/*.cjs', '**/*.mjs', '**/*.jsx', ...TS_FILES];\n\n/**\n * The oxlint port of `eslintConfigs`, generated with `@oxlint/migrate` and kept rule for rule.\n * Type-aware rules (`no-floating-promises`, `return-await`, ...) need `oxlint-tsgolint` installed.\n *\n * Not ported: `@typescript-eslint/naming-convention` (oxlint has no equivalent yet - keep it in\n * ESLint), `@typescript-eslint/prefer-optional-chain` (oxlint nursery), `no-invalid-this` (covered\n * by `noImplicitThis` in `tsconfig.base.json`). `n/prefer-node-protocol` maps to the unicorn rule.\n *\n * ```ts\n * // .configs/lints/oxlint.config.mts\n * import { defineConfig } from 'oxlint';\n * import { oxlintConfigs } from '@venizia/dev-configs/linters/oxlint';\n *\n * export default defineConfig(oxlintConfigs);\n * ```\n *\n * `prefer-nullish-coalescing` allows `||` on a string (`name?.trim() || 'guest'`) and reports it on\n * every other nullable type. `OxlintConfigs.create({ lenientFallback: true })` is the same preset\n * with `||` allowed on number operands too.\n */\nexport const oxlintConfigs: OxlintConfig = {\n plugins: ['typescript', 'unicorn'],\n categories: { correctness: 'off' },\n options: { typeAware: true },\n env: { builtin: true },\n ignorePatterns: ['**/node_modules/', '**/*.d.ts', '**/build/', '**/dist/', '**/release/'],\n rules: {\n // eslint:recommended\n 'constructor-super': 'error',\n 'for-direction': 'error',\n 'getter-return': 'error',\n 'no-async-promise-executor': 'error',\n 'no-case-declarations': 'error',\n 'no-class-assign': 'error',\n 'no-compare-neg-zero': 'error',\n 'no-cond-assign': 'error',\n 'no-const-assign': 'error',\n 'no-constant-binary-expression': 'error',\n 'no-constant-condition': 'error',\n 'no-control-regex': 'error',\n 'no-debugger': 'error',\n 'no-delete-var': 'error',\n 'no-dupe-else-if': 'error',\n 'no-dupe-keys': 'error',\n 'no-duplicate-case': 'error',\n 'no-empty': 'error',\n 'no-empty-character-class': 'error',\n 'no-empty-pattern': 'error',\n 'no-empty-static-block': 'error',\n 'no-ex-assign': 'error',\n 'no-extra-boolean-cast': 'error',\n 'no-fallthrough': 'error',\n 'no-func-assign': 'error',\n 'no-global-assign': 'error',\n 'no-import-assign': 'error',\n 'no-invalid-regexp': 'error',\n 'no-irregular-whitespace': 'error',\n 'no-loss-of-precision': 'error',\n 'no-misleading-character-class': 'error',\n 'no-new-native-nonconstructor': 'error',\n 'no-nonoctal-decimal-escape': 'error',\n 'no-obj-calls': 'error',\n 'no-prototype-builtins': 'error',\n 'no-regex-spaces': 'error',\n 'no-self-assign': 'error',\n 'no-setter-return': 'error',\n 'no-shadow-restricted-names': 'error',\n 'no-sparse-arrays': 'error',\n 'no-this-before-super': 'error',\n 'no-unassigned-vars': 'error',\n 'no-unreachable': 'error',\n 'no-unsafe-finally': 'error',\n 'no-unsafe-negation': 'error',\n 'no-unsafe-optional-chaining': 'error',\n 'no-unused-labels': 'error',\n 'no-unused-private-class-members': 'error',\n 'no-useless-backreference': 'error',\n 'no-useless-catch': 'error',\n 'no-with': 'error',\n 'preserve-caught-error': 'error',\n 'require-yield': 'error',\n 'use-isnan': 'error',\n 'valid-typeof': 'error',\n 'no-array-constructor': 'error',\n\n // Strict rules on top\n [NoUnusedVarsRule.NAME]: NoUnusedVarsRule.build(),\n 'no-useless-escape': 'warn',\n 'no-unused-expressions': 'error',\n 'no-new-wrappers': 'error',\n 'no-throw-literal': 'error',\n [EqeqeqRule.NAME]: EqeqeqRule.build(),\n 'no-void': 'error',\n 'no-caller': 'error',\n 'no-shadow': 'error',\n 'no-use-before-define': 'error',\n [SwitchCaseBracesRule.NAME]: SwitchCaseBracesRule.build(),\n 'unicorn/prefer-node-protocol': 'error',\n\n // typescript-eslint\n 'typescript/ban-ts-comment': 'error',\n 'typescript/no-duplicate-enum-values': 'error',\n 'typescript/no-empty-object-type': 'error',\n 'typescript/no-extra-non-null-assertion': 'error',\n 'typescript/no-misused-new': 'error',\n 'typescript/no-namespace': 'error',\n 'typescript/no-non-null-asserted-optional-chain': 'error',\n 'typescript/no-this-alias': 'error',\n 'typescript/no-unnecessary-type-constraint': 'error',\n 'typescript/no-unsafe-declaration-merging': 'error',\n 'typescript/no-unsafe-function-type': 'error',\n 'typescript/no-wrapper-object-types': 'error',\n 'typescript/prefer-as-const': 'error',\n 'typescript/prefer-namespace-keyword': 'error',\n 'typescript/triple-slash-reference': 'error',\n 'typescript/adjacent-overload-signatures': 'error',\n 'typescript/prefer-for-of': 'error',\n // An overload with TSDoc of its own is one on purpose.\n 'typescript/unified-signatures': ['error', { ignoreOverloadsWithDifferentJSDoc: true }],\n\n // The base code rules: arrows over `function`, a logger over `console`, a `default` in every `switch`.\n 'func-style': ['error', 'expression'],\n 'no-console': 'error',\n 'default-case': 'error',\n\n // typescript-eslint, type-aware\n 'typescript/await-thenable': 'error',\n 'typescript/no-floating-promises': 'error',\n // `||` on a string is mostly an intentional empty-string fallback (`value?.trim() || fallback`);\n // `??` keeps `''` and changes behaviour. Objects and numbers still report.\n [PreferNullishCoalescingRule.NAME]: PreferNullishCoalescingRule.build({\n ignorePrimitives: { string: true },\n }),\n 'typescript/return-await': 'error',\n },\n overrides: [\n {\n // A test writes what it needs to prove its subject.\n files: ['**/__tests__/**', '**/*.test.{ts,tsx,mts,cts}', '**/*.spec.{ts,tsx,mts,cts}'],\n rules: { 'func-style': 'off', 'no-console': 'off', 'default-case': 'off' },\n },\n {\n // TypeScript itself reports these.\n files: TS_FILES,\n rules: {\n 'constructor-super': 'off',\n 'getter-return': 'off',\n 'no-class-assign': 'off',\n 'no-const-assign': 'off',\n 'no-dupe-keys': 'off',\n 'no-func-assign': 'off',\n 'no-import-assign': 'off',\n 'no-new-native-nonconstructor': 'off',\n 'no-obj-calls': 'off',\n 'no-setter-return': 'off',\n 'no-this-before-super': 'off',\n 'no-unreachable': 'off',\n 'no-unsafe-negation': 'off',\n 'no-with': 'off',\n 'no-var': 'error',\n 'prefer-const': 'error',\n 'prefer-rest-params': 'error',\n 'prefer-spread': 'error',\n // A value import of a type becomes a runtime import when Bun runs a decorated class's source\n // (emitDecoratorMetadata) and fails with `Export named 'X' not found`. `import('pkg').T` type\n // annotations stay allowed: they are type-only by construction, and type an optional peer.\n 'typescript/consistent-type-imports': [\n 'error',\n {\n prefer: 'type-imports',\n fixStyle: 'inline-type-imports',\n disallowTypeAnnotations: false,\n },\n ],\n },\n },\n {\n files: JS_TS_FILES,\n rules: {\n 'no-constant-condition': 'off',\n 'prefer-const': 'error',\n 'no-var': 'error',\n curly: ['error', 'all'],\n [NoRestrictedImportsRule.NAME]: NoRestrictedImportsRule.build(),\n 'typescript/no-unsafe-function-type': 'off',\n 'typescript/no-this-alias': 'off',\n 'typescript/no-empty-object-type': 'off',\n },\n },\n ],\n};\n\n/** Options of `OxlintConfigs.create`. */\nexport interface IOxlintPresetOptions {\n /**\n * Also allow `||` / `||=` where the left side is a number, so `limit || 20` passes: `0` falls\n * back on purpose. A string is allowed by the base already. Left off, the base catches a real `0`\n * swallowed by `||`.\n *\n * @default false\n */\n lenientFallback?: boolean;\n /**\n * Project paths to skip - generated files, vendored code - as in `--ignore-pattern`: `src/gen/**`.\n * Every rule is turned off for them (oxlint cannot ignore a project path from `.configs/`).\n * Share the list with ESLint through `LintIgnore`.\n *\n * @default []\n */\n ignore?: string[];\n}\n\n/**\n * Builds `oxlintConfigs` with options. Without any it returns the base preset unchanged.\n *\n * ```ts\n * // .configs/lints/oxlint.config.mts\n * import { defineConfig } from 'oxlint';\n * import { OxlintConfigs } from '@venizia/dev-configs/linters/oxlint';\n *\n * export default defineConfig(OxlintConfigs.create({ lenientFallback: true }));\n * ```\n */\nexport class OxlintConfigs {\n static create(opts: IOxlintPresetOptions = {}): OxlintConfig {\n const config: OxlintConfig = opts.lenientFallback\n ? {\n ...oxlintConfigs,\n rules: {\n ...oxlintConfigs.rules,\n [PreferNullishCoalescingRule.NAME]: PreferNullishCoalescingRule.build({\n ignorePrimitives: { string: true, number: true },\n }),\n },\n }\n : oxlintConfigs;\n\n return LintIgnore.oxlint({ config, patterns: opts.ignore ?? [] });\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"react-eslint.js","sourceRoot":"","sources":["../../src/linters/react-eslint.ts"],"names":[],"mappings":";;;;;;AACA,0EAAyC;AACzC,qCAAmD;AACnD,2CAAwC;AACxC,mCAA+C;AAE/C,uFAAuF;AACvF,MAAM,2BAA2B,GAAG,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,WAAW,EAAE,YAAY,CAAC,EAAE,CAAC;AAElG;;;GAGG;AACU,QAAA,4BAA4B,GAAoB;IAC3D,GAAG,gCAAuB;IAC1B;QACE,KAAK,EAAE,qBAAS;QAChB,eAAe,EAAE,EAAE,MAAM,EAAE,2BAAQ,CAAC,MAAuB,EAAE;QAC7D,OAAO,EAAE,EAAE,oBAAoB,EAAE,2BAAQ,CAAC,MAAe,EAAE;QAC3D,KAAK,EAAE;YACL,CAAC,4BAAoB,CAAC,IAAI,CAAC,EAAE,4BAAoB,CAAC,KAAK,CAAC;gBACtD,cAAc,EAAE,CAAC,2BAA2B,CAAC;aAC9C,CAAC;SACH;KACF;CACF,CAAC","sourcesContent":["import type { Linter } from 'eslint';\nimport tseslint from 'typescript-eslint';\nimport { namingConventionConfigs } from './eslint';\nimport { JSX_FILES } from './jsx-files';\nimport { NamingConventionRule } from './rules';\n\n/** A component is declared as `function App()`, so functions may be PascalCase too. */\nconst COMPONENT_FUNCTION_SELECTOR = { selector: 'function', format: ['camelCase', 'PascalCase'] };\n\n/**\n * `namingConventionConfigs` for a React project: the base rule plus PascalCase functions in .jsx and\n * .tsx files, where a component is declared as `function App()`.\n */\nexport const reactNamingConventionConfigs: Linter.Config[] = [\n ...namingConventionConfigs,\n {\n files: JSX_FILES,\n languageOptions: { parser: tseslint.parser as Linter.Parser },\n plugins: { '@typescript-eslint': tseslint.plugin as never },\n rules: {\n [NamingConventionRule.NAME]: NamingConventionRule.build({\n extraSelectors: [COMPONENT_FUNCTION_SELECTOR],\n }),\n },\n },\n];\n"]}
1
+ {"version":3,"file":"react-eslint.js","sourceRoot":"","sources":["../../src/linters/react-eslint.ts"],"names":[],"mappings":";;;;;;AACA,0EAAyC;AACzC,qCAAmD;AACnD,2CAAwC;AACxC,mCAA+C;AAE/C,uFAAuF;AACvF,MAAM,2BAA2B,GAAG,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,WAAW,EAAE,YAAY,CAAC,EAAE,CAAC;AAElG;;;GAGG;AACU,QAAA,4BAA4B,GAAoB;IAC3D,GAAG,gCAAuB;IAC1B;QACE,KAAK,EAAE,qBAAS;QAChB,eAAe,EAAE,EAAE,MAAM,EAAE,2BAAQ,CAAC,MAAM,EAAE;QAC5C,OAAO,EAAE,EAAE,oBAAoB,EAAE,2BAAQ,CAAC,MAAM,EAAE;QAClD,KAAK,EAAE;YACL,CAAC,4BAAoB,CAAC,IAAI,CAAC,EAAE,4BAAoB,CAAC,KAAK,CAAC;gBACtD,cAAc,EAAE,CAAC,2BAA2B,CAAC;aAC9C,CAAC;SACH;KACF;CACF,CAAC","sourcesContent":["import type { Linter } from 'eslint';\nimport tseslint from 'typescript-eslint';\nimport { namingConventionConfigs } from './eslint';\nimport { JSX_FILES } from './jsx-files';\nimport { NamingConventionRule } from './rules';\n\n/** A component is declared as `function App()`, so functions may be PascalCase too. */\nconst COMPONENT_FUNCTION_SELECTOR = { selector: 'function', format: ['camelCase', 'PascalCase'] };\n\n/**\n * `namingConventionConfigs` for a React project: the base rule plus PascalCase functions in .jsx and\n * .tsx files, where a component is declared as `function App()`.\n */\nexport const reactNamingConventionConfigs: Linter.Config[] = [\n ...namingConventionConfigs,\n {\n files: JSX_FILES,\n languageOptions: { parser: tseslint.parser },\n plugins: { '@typescript-eslint': tseslint.plugin },\n rules: {\n [NamingConventionRule.NAME]: NamingConventionRule.build({\n extraSelectors: [COMPONENT_FUNCTION_SELECTOR],\n }),\n },\n },\n];\n"]}
@@ -11,7 +11,10 @@ export type TNamingSelector = Record<string, unknown> & {
11
11
  export declare class NamingConventionRule {
12
12
  static readonly NAME = "@typescript-eslint/naming-convention";
13
13
  static readonly SELECTORS: readonly TNamingSelector[];
14
- /** `extraSelectors` go last, so they win over a base selector they overlap. */
14
+ /**
15
+ * `extraSelectors` are appended, but position decides nothing: typescript-eslint orders selectors by how specific
16
+ * they are. To let a name through the base type selectors, give a selector a `filter` and `format: null`.
17
+ */
15
18
  static build(opts?: {
16
19
  severity?: TRuleSeverity;
17
20
  extraSelectors?: TNamingSelector[];
@@ -45,6 +45,32 @@ class NamingConventionRule {
45
45
  leadingUnderscore: 'allow',
46
46
  },
47
47
  { selector: 'typeLike', format: ['PascalCase'] },
48
+ // A type alias starts with `T` or ends with `Type`; an interface starts with `I`.
49
+ {
50
+ selector: 'typeAlias',
51
+ format: ['PascalCase'],
52
+ custom: { regex: '^T[A-Z0-9]|Type$', match: true },
53
+ },
54
+ { selector: 'interface', format: ['PascalCase'], prefix: ['I'] },
55
+ // Names that stay as they are: the framework's value helpers, and a type that shares its name with a class value.
56
+ {
57
+ selector: 'typeAlias',
58
+ filter: {
59
+ regex: '^(ValueOf|ValueOptional|ValueOptionalExcept|ValueOrPromise|PGliteCRUDRepository)$',
60
+ match: true,
61
+ },
62
+ format: null,
63
+ },
64
+ // Interfaces that `declare module` or `declare global` adds to: the name belongs to the library, and the rule
65
+ // cannot see where an interface is declared.
66
+ {
67
+ selector: 'interface',
68
+ filter: {
69
+ regex: '^(ContextRenderer|ContextVariableMap|ImportMeta|ImportMetaEnv|Matchers|ProcessEnv|Register|Window)$',
70
+ match: true,
71
+ },
72
+ format: null,
73
+ },
48
74
  {
49
75
  selector: [
50
76
  'objectLiteralProperty',
@@ -61,7 +87,10 @@ class NamingConventionRule {
61
87
  { selector: 'import', format: ['camelCase', 'PascalCase'] },
62
88
  { selector: 'import', format: null, filter: '^_$' },
63
89
  ]; }
64
- /** `extraSelectors` go last, so they win over a base selector they overlap. */
90
+ /**
91
+ * `extraSelectors` are appended, but position decides nothing: typescript-eslint orders selectors by how specific
92
+ * they are. To let a name through the base type selectors, give a selector a `filter` and `format: null`.
93
+ */
65
94
  static build(opts = {}) {
66
95
  const { severity = 'error', extraSelectors = [] } = opts;
67
96
  return [severity, ...NamingConventionRule.SELECTORS, ...extraSelectors];
@@ -1 +1 @@
1
- {"version":3,"file":"naming-convention.rule.js","sourceRoot":"","sources":["../../../src/linters/rules/naming-convention.rule.ts"],"names":[],"mappings":";;;AAMA;;;GAGG;AACH,MAAa,oBAAoB;aACf,SAAI,GAAG,sCAAsC,CAAC;aAE9C,cAAS,GAA+B;QACtD,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,WAAW,CAAC,EAAE;QAC9C,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,WAAW,EAAE,YAAY,EAAE,YAAY,CAAC,EAAE;QAC3E,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE;QACrD,qGAAqG;QACrG;YACE,QAAQ,EAAE,UAAU;YACpB,MAAM,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE;YACrC,MAAM,EAAE,CAAC,WAAW,EAAE,YAAY,EAAE,YAAY,CAAC;YACjD,iBAAiB,EAAE,OAAO;SAC3B;QACD,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,YAAY,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE;QAClE,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,WAAW,CAAC,EAAE,iBAAiB,EAAE,OAAO,EAAE;QAC5E;YACE,QAAQ,EAAE,YAAY;YACtB,MAAM,EAAE,CAAC,WAAW,EAAE,YAAY,EAAE,YAAY,CAAC;YACjD,iBAAiB,EAAE,OAAO;SAC3B;QACD;YACE,QAAQ,EAAE,UAAU;YACpB,MAAM,EAAE,CAAC,WAAW,EAAE,YAAY,EAAE,YAAY,CAAC;YACjD,iBAAiB,EAAE,OAAO;SAC3B;QACD,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,WAAW,CAAC,EAAE,iBAAiB,EAAE,OAAO,EAAE;QACzE,EAAE,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC,WAAW,EAAE,YAAY,CAAC,EAAE;QACtF;YACE,QAAQ,EAAE,YAAY;YACtB,SAAS,EAAE,CAAC,SAAS,CAAC;YACtB,MAAM,EAAE,CAAC,WAAW,CAAC;YACrB,iBAAiB,EAAE,OAAO;SAC3B;QACD;YACE,QAAQ,EAAE,YAAY;YACtB,SAAS,EAAE,CAAC,WAAW,CAAC;YACxB,MAAM,EAAE,CAAC,WAAW,CAAC;YACrB,iBAAiB,EAAE,OAAO;SAC3B;QACD,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,YAAY,CAAC,EAAE;QAChD;YACE,QAAQ,EAAE;gBACR,uBAAuB;gBACvB,qBAAqB;gBACrB,cAAc;gBACd,YAAY;gBACZ,eAAe;gBACf,aAAa;gBACb,YAAY;aACb;YACD,MAAM,EAAE,IAAI;YACZ,SAAS,EAAE,CAAC,gBAAgB,CAAC;SAC9B;QACD,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,WAAW,EAAE,YAAY,CAAC,EAAE;QAC3D,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE;KACpD,CAAC;IAEF,+EAA+E;IAC/E,MAAM,CAAC,KAAK,CACV,OAAyE,EAAE;QAE3E,MAAM,EAAE,QAAQ,GAAG,OAAO,EAAE,cAAc,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC;QAEzD,OAAO,CAAC,QAAQ,EAAE,GAAG,oBAAoB,CAAC,SAAS,EAAE,GAAG,cAAc,CAAC,CAAC;IAC1E,CAAC;;AAjEH,oDAkEC","sourcesContent":["import type { Linter } from 'eslint';\nimport type { TRuleSeverity } from './common';\n\n/** One selector of `@typescript-eslint/naming-convention`, as its documentation types it. */\nexport type TNamingSelector = Record<string, unknown> & { selector: string | string[] };\n\n/**\n * `@typescript-eslint/naming-convention`, owned here. oxlint has no port of it, so it runs in ESLint.\n * The selectors are the LoopBack 4 set the base preset carried, kept one for one.\n */\nexport class NamingConventionRule {\n static readonly NAME = '@typescript-eslint/naming-convention';\n\n static readonly SELECTORS: readonly TNamingSelector[] = [\n { selector: 'default', format: ['camelCase'] },\n { selector: 'variable', format: ['camelCase', 'UPPER_CASE', 'PascalCase'] },\n { selector: 'variable', format: null, filter: '^_$' },\n // A `_name` variable names an omitted value (`{ page: _page, ...rest }`); its case is still checked.\n {\n selector: 'variable',\n filter: { regex: '^_.', match: true },\n format: ['camelCase', 'UPPER_CASE', 'PascalCase'],\n leadingUnderscore: 'allow',\n },\n { selector: 'function', format: ['PascalCase'], filter: 'Mixin$' },\n { selector: 'parameter', format: ['camelCase'], leadingUnderscore: 'allow' },\n {\n selector: 'enumMember',\n format: ['camelCase', 'UPPER_CASE', 'PascalCase'],\n leadingUnderscore: 'allow',\n },\n {\n selector: 'property',\n format: ['camelCase', 'UPPER_CASE', 'PascalCase'],\n leadingUnderscore: 'allow',\n },\n { selector: 'method', format: ['camelCase'], leadingUnderscore: 'allow' },\n { selector: 'memberLike', modifiers: ['static'], format: ['camelCase', 'UPPER_CASE'] },\n {\n selector: 'memberLike',\n modifiers: ['private'],\n format: ['camelCase'],\n leadingUnderscore: 'allow',\n },\n {\n selector: 'memberLike',\n modifiers: ['protected'],\n format: ['camelCase'],\n leadingUnderscore: 'allow',\n },\n { selector: 'typeLike', format: ['PascalCase'] },\n {\n selector: [\n 'objectLiteralProperty',\n 'objectLiteralMethod',\n 'typeProperty',\n 'typeMethod',\n 'classProperty',\n 'classMethod',\n 'enumMember',\n ],\n format: null,\n modifiers: ['requiresQuotes'],\n },\n { selector: 'import', format: ['camelCase', 'PascalCase'] },\n { selector: 'import', format: null, filter: '^_$' },\n ];\n\n /** `extraSelectors` go last, so they win over a base selector they overlap. */\n static build(\n opts: { severity?: TRuleSeverity; extraSelectors?: TNamingSelector[] } = {},\n ): Linter.RuleEntry {\n const { severity = 'error', extraSelectors = [] } = opts;\n\n return [severity, ...NamingConventionRule.SELECTORS, ...extraSelectors];\n }\n}\n"]}
1
+ {"version":3,"file":"naming-convention.rule.js","sourceRoot":"","sources":["../../../src/linters/rules/naming-convention.rule.ts"],"names":[],"mappings":";;;AAMA;;;GAGG;AACH,MAAa,oBAAoB;aACf,SAAI,GAAG,sCAAsC,CAAC;aAE9C,cAAS,GAA+B;QACtD,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,WAAW,CAAC,EAAE;QAC9C,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,WAAW,EAAE,YAAY,EAAE,YAAY,CAAC,EAAE;QAC3E,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE;QACrD,qGAAqG;QACrG;YACE,QAAQ,EAAE,UAAU;YACpB,MAAM,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE;YACrC,MAAM,EAAE,CAAC,WAAW,EAAE,YAAY,EAAE,YAAY,CAAC;YACjD,iBAAiB,EAAE,OAAO;SAC3B;QACD,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,YAAY,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE;QAClE,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,WAAW,CAAC,EAAE,iBAAiB,EAAE,OAAO,EAAE;QAC5E;YACE,QAAQ,EAAE,YAAY;YACtB,MAAM,EAAE,CAAC,WAAW,EAAE,YAAY,EAAE,YAAY,CAAC;YACjD,iBAAiB,EAAE,OAAO;SAC3B;QACD;YACE,QAAQ,EAAE,UAAU;YACpB,MAAM,EAAE,CAAC,WAAW,EAAE,YAAY,EAAE,YAAY,CAAC;YACjD,iBAAiB,EAAE,OAAO;SAC3B;QACD,EAAE,QAAQ,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gBACb,YAAY;aACb;YACD,MAAM,EAAE,IAAI;YACZ,SAAS,EAAE,CAAC,gBAAgB,CAAC;SAC9B;QACD,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,WAAW,EAAE,YAAY,CAAC,EAAE;QAC3D,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE;KACpD,CAAC;IAEF;;;OAGG;IACH,MAAM,CAAC,KAAK,CACV,OAAyE,EAAE;QAE3E,MAAM,EAAE,QAAQ,GAAG,OAAO,EAAE,cAAc,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC;QAEzD,OAAO,CAAC,QAAQ,EAAE,GAAG,oBAAoB,CAAC,SAAS,EAAE,GAAG,cAAc,CAAC,CAAC;IAC1E,CAAC;;AA/FH,oDAgGC","sourcesContent":["import type { Linter } from 'eslint';\nimport type { TRuleSeverity } from './common';\n\n/** One selector of `@typescript-eslint/naming-convention`, as its documentation types it. */\nexport type TNamingSelector = Record<string, unknown> & { selector: string | string[] };\n\n/**\n * `@typescript-eslint/naming-convention`, owned here. oxlint has no port of it, so it runs in ESLint.\n * The selectors are the LoopBack 4 set the base preset carried, kept one for one.\n */\nexport class NamingConventionRule {\n static readonly NAME = '@typescript-eslint/naming-convention';\n\n static readonly SELECTORS: readonly TNamingSelector[] = [\n { selector: 'default', format: ['camelCase'] },\n { selector: 'variable', format: ['camelCase', 'UPPER_CASE', 'PascalCase'] },\n { selector: 'variable', format: null, filter: '^_$' },\n // A `_name` variable names an omitted value (`{ page: _page, ...rest }`); its case is still checked.\n {\n selector: 'variable',\n filter: { regex: '^_.', match: true },\n format: ['camelCase', 'UPPER_CASE', 'PascalCase'],\n leadingUnderscore: 'allow',\n },\n { selector: 'function', format: ['PascalCase'], filter: 'Mixin$' },\n { selector: 'parameter', format: ['camelCase'], leadingUnderscore: 'allow' },\n {\n selector: 'enumMember',\n format: ['camelCase', 'UPPER_CASE', 'PascalCase'],\n leadingUnderscore: 'allow',\n },\n {\n selector: 'property',\n format: ['camelCase', 'UPPER_CASE', 'PascalCase'],\n leadingUnderscore: 'allow',\n },\n { selector: 'method', format: ['camelCase'], leadingUnderscore: 'allow' },\n { selector: 'memberLike', modifiers: ['static'], format: ['camelCase', 'UPPER_CASE'] },\n {\n selector: 'memberLike',\n modifiers: ['private'],\n format: ['camelCase'],\n leadingUnderscore: 'allow',\n },\n {\n selector: 'memberLike',\n modifiers: ['protected'],\n format: ['camelCase'],\n leadingUnderscore: 'allow',\n },\n { selector: 'typeLike', format: ['PascalCase'] },\n // A type alias starts with `T` or ends with `Type`; an interface starts with `I`.\n {\n selector: 'typeAlias',\n format: ['PascalCase'],\n custom: { regex: '^T[A-Z0-9]|Type$', match: true },\n },\n { selector: 'interface', format: ['PascalCase'], prefix: ['I'] },\n // Names that stay as they are: the framework's value helpers, and a type that shares its name with a class value.\n {\n selector: 'typeAlias',\n filter: {\n regex: '^(ValueOf|ValueOptional|ValueOptionalExcept|ValueOrPromise|PGliteCRUDRepository)$',\n match: true,\n },\n format: null,\n },\n // Interfaces that `declare module` or `declare global` adds to: the name belongs to the library, and the rule\n // cannot see where an interface is declared.\n {\n selector: 'interface',\n filter: {\n regex:\n '^(ContextRenderer|ContextVariableMap|ImportMeta|ImportMetaEnv|Matchers|ProcessEnv|Register|Window)$',\n match: true,\n },\n format: null,\n },\n {\n selector: [\n 'objectLiteralProperty',\n 'objectLiteralMethod',\n 'typeProperty',\n 'typeMethod',\n 'classProperty',\n 'classMethod',\n 'enumMember',\n ],\n format: null,\n modifiers: ['requiresQuotes'],\n },\n { selector: 'import', format: ['camelCase', 'PascalCase'] },\n { selector: 'import', format: null, filter: '^_$' },\n ];\n\n /**\n * `extraSelectors` are appended, but position decides nothing: typescript-eslint orders selectors by how specific\n * they are. To let a name through the base type selectors, give a selector a `filter` and `format: null`.\n */\n static build(\n opts: { severity?: TRuleSeverity; extraSelectors?: TNamingSelector[] } = {},\n ): Linter.RuleEntry {\n const { severity = 'error', extraSelectors = [] } = opts;\n\n return [severity, ...NamingConventionRule.SELECTORS, ...extraSelectors];\n }\n}\n"]}
@@ -12,7 +12,7 @@ class NoRestrictedPropertiesRule {
12
12
  static { this.SECURE_CONTEXT = [
13
13
  {
14
14
  property: 'randomUUID',
15
- message: 'crypto.randomUUID exists only in a secure context (https, localhost) - on a plain-http origin it is undefined. Use UuidV4Generator.generate() from @venizia/ignis-helpers/uuid.',
15
+ message: "crypto.randomUUID exists only in a secure context (https, localhost) - on a plain-http origin it is undefined. Use `UuidV4Generator.generate()`: `import { UuidV4Generator } from '@venizia/ignis-helpers/uuid';`",
16
16
  },
17
17
  ]; }
18
18
  static build(opts = {}) {
@@ -1 +1 @@
1
- {"version":3,"file":"no-restricted-properties.rule.js","sourceRoot":"","sources":["../../../src/linters/rules/no-restricted-properties.rule.ts"],"names":[],"mappings":";;;AASA;;;;;GAKG;AACH,MAAa,0BAA0B;aACrB,SAAI,GAAG,0BAA0B,CAAC;aAElC,mBAAc,GAAmC;QAC/D;YACE,QAAQ,EAAE,YAAY;YACtB,OAAO,EACL,iLAAiL;SACpL;KACF,CAAC;IAEF,MAAM,CAAC,KAAK,CACV,OAA8E,EAAE;QAEhF,MAAM,EAAE,QAAQ,GAAG,OAAO,EAAE,eAAe,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC;QAE1D,OAAO,CAAC,QAAQ,EAAE,GAAG,0BAA0B,CAAC,cAAc,EAAE,GAAG,eAAe,CAAC,CAAC;IACtF,CAAC;;AAjBH,gEAkBC","sourcesContent":["import type { TOxlintRuleEntry, TRuleSeverity } from './common';\n\n/** One forbidden property access, with the message the author sees. */\nexport interface IRestrictedProperty {\n property: string;\n object?: string;\n message: string;\n}\n\n/**\n * `no-restricted-properties`. The default bans what exists only in a secure context (https,\n * localhost): on a plain-http LAN origin or in a WebView, `crypto.randomUUID` is `undefined` and the\n * first call throws. Catches the call, `globalThis.crypto.randomUUID`, the bracket form and\n * destructuring; leaves `getRandomValues` alone.\n */\nexport class NoRestrictedPropertiesRule {\n static readonly NAME = 'no-restricted-properties';\n\n static readonly SECURE_CONTEXT: readonly IRestrictedProperty[] = [\n {\n property: 'randomUUID',\n message:\n 'crypto.randomUUID exists only in a secure context (https, localhost) - on a plain-http origin it is undefined. Use UuidV4Generator.generate() from @venizia/ignis-helpers/uuid.',\n },\n ];\n\n static build(\n opts: { severity?: TRuleSeverity; extraProperties?: IRestrictedProperty[] } = {},\n ): TOxlintRuleEntry<'no-restricted-properties'> {\n const { severity = 'error', extraProperties = [] } = opts;\n\n return [severity, ...NoRestrictedPropertiesRule.SECURE_CONTEXT, ...extraProperties];\n }\n}\n"]}
1
+ {"version":3,"file":"no-restricted-properties.rule.js","sourceRoot":"","sources":["../../../src/linters/rules/no-restricted-properties.rule.ts"],"names":[],"mappings":";;;AASA;;;;;GAKG;AACH,MAAa,0BAA0B;aACrB,SAAI,GAAG,0BAA0B,CAAC;aAElC,mBAAc,GAAmC;QAC/D;YACE,QAAQ,EAAE,YAAY;YACtB,OAAO,EACL,mNAAmN;SACtN;KACF,CAAC;IAEF,MAAM,CAAC,KAAK,CACV,OAA8E,EAAE;QAEhF,MAAM,EAAE,QAAQ,GAAG,OAAO,EAAE,eAAe,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC;QAE1D,OAAO,CAAC,QAAQ,EAAE,GAAG,0BAA0B,CAAC,cAAc,EAAE,GAAG,eAAe,CAAC,CAAC;IACtF,CAAC;;AAjBH,gEAkBC","sourcesContent":["import type { TOxlintRuleEntry, TRuleSeverity } from './common';\n\n/** One forbidden property access, with the message the author sees. */\nexport interface IRestrictedProperty {\n property: string;\n object?: string;\n message: string;\n}\n\n/**\n * `no-restricted-properties`. The default bans what exists only in a secure context (https,\n * localhost): on a plain-http LAN origin or in a WebView, `crypto.randomUUID` is `undefined` and the\n * first call throws. Catches the call, `globalThis.crypto.randomUUID`, the bracket form and\n * destructuring; leaves `getRandomValues` alone.\n */\nexport class NoRestrictedPropertiesRule {\n static readonly NAME = 'no-restricted-properties';\n\n static readonly SECURE_CONTEXT: readonly IRestrictedProperty[] = [\n {\n property: 'randomUUID',\n message:\n \"crypto.randomUUID exists only in a secure context (https, localhost) - on a plain-http origin it is undefined. Use `UuidV4Generator.generate()`: `import { UuidV4Generator } from '@venizia/ignis-helpers/uuid';`\",\n },\n ];\n\n static build(\n opts: { severity?: TRuleSeverity; extraProperties?: IRestrictedProperty[] } = {},\n ): TOxlintRuleEntry<'no-restricted-properties'> {\n const { severity = 'error', extraProperties = [] } = opts;\n\n return [severity, ...NoRestrictedPropertiesRule.SECURE_CONTEXT, ...extraProperties];\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- export * from './rejection.helper';
1
+ export * from './rejection.utility';
2
2
  export * from './repo-tmp';
3
- export * from './spawn.helper';
3
+ export * from './spawn.utility';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./rejection.helper"), exports);
17
+ __exportStar(require("./rejection.utility"), exports);
18
18
  __exportStar(require("./repo-tmp"), exports);
19
- __exportStar(require("./spawn.helper"), exports);
19
+ __exportStar(require("./spawn.utility"), exports);
20
20
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,6CAA2B;AAC3B,iDAA+B","sourcesContent":["export * from './rejection.helper';\nexport * from './repo-tmp';\nexport * from './spawn.helper';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC;AACpC,6CAA2B;AAC3B,kDAAgC","sourcesContent":["export * from './rejection.utility';\nexport * from './repo-tmp';\nexport * from './spawn.utility';\n"]}
@@ -1,13 +1,13 @@
1
1
  /** Test helpers for asserting that a promise rejects, without the typing and un-awaited-assertion pitfalls of `expect(task).rejects`. */
2
- export declare class RejectionHelper {
2
+ export declare class RejectionUtility {
3
3
  /**
4
4
  * Awaits a task that must reject and returns what it rejected with; throws when the task resolves.
5
5
  *
6
6
  * bun types the async matchers (`expect(task).rejects` / `.resolves`) as `void`, so
7
7
  * `await expect(task).rejects.toThrow()` is refused by `await-thenable` - and left un-awaited the
8
8
  * assertion never runs. Awaiting the task itself needs no matcher and no cast:
9
- * `RejectionHelper.expectRejection({ task, message })` or
10
- * `expect(await RejectionHelper.rejectionOf({ task })).toBeInstanceOf(Error)`,
9
+ * `RejectionUtility.expectRejection({ task, message })` or
10
+ * `expect(await RejectionUtility.rejectionOf({ task })).toBeInstanceOf(Error)`,
11
11
  * and for a resolution `expect(await task).toMatchObject(...)`.
12
12
  */
13
13
  static rejectionOf(opts: {
@@ -24,4 +24,4 @@ export declare class RejectionHelper {
24
24
  message: string | RegExp;
25
25
  }): Promise<void>;
26
26
  }
27
- //# sourceMappingURL=rejection.helper.d.ts.map
27
+ //# sourceMappingURL=rejection.utility.d.ts.map
@@ -1,17 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RejectionHelper = void 0;
3
+ exports.RejectionUtility = void 0;
4
4
  const bun_test_1 = require("bun:test");
5
5
  /** Test helpers for asserting that a promise rejects, without the typing and un-awaited-assertion pitfalls of `expect(task).rejects`. */
6
- class RejectionHelper {
6
+ class RejectionUtility {
7
7
  /**
8
8
  * Awaits a task that must reject and returns what it rejected with; throws when the task resolves.
9
9
  *
10
10
  * bun types the async matchers (`expect(task).rejects` / `.resolves`) as `void`, so
11
11
  * `await expect(task).rejects.toThrow()` is refused by `await-thenable` - and left un-awaited the
12
12
  * assertion never runs. Awaiting the task itself needs no matcher and no cast:
13
- * `RejectionHelper.expectRejection({ task, message })` or
14
- * `expect(await RejectionHelper.rejectionOf({ task })).toBeInstanceOf(Error)`,
13
+ * `RejectionUtility.expectRejection({ task, message })` or
14
+ * `expect(await RejectionUtility.rejectionOf({ task })).toBeInstanceOf(Error)`,
15
15
  * and for a resolution `expect(await task).toMatchObject(...)`.
16
16
  */
17
17
  static async rejectionOf(opts) {
@@ -31,10 +31,10 @@ class RejectionHelper {
31
31
  */
32
32
  static async expectRejection(opts) {
33
33
  const { task, message } = opts;
34
- const reason = await RejectionHelper.rejectionOf({ task });
34
+ const reason = await RejectionUtility.rejectionOf({ task });
35
35
  (0, bun_test_1.expect)(reason).toBeInstanceOf(Error);
36
36
  (0, bun_test_1.expect)(reason instanceof Error ? reason.message : String(reason)).toMatch(message);
37
37
  }
38
38
  }
39
- exports.RejectionHelper = RejectionHelper;
40
- //# sourceMappingURL=rejection.helper.js.map
39
+ exports.RejectionUtility = RejectionUtility;
40
+ //# sourceMappingURL=rejection.utility.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rejection.utility.js","sourceRoot":"","sources":["../../src/testing/rejection.utility.ts"],"names":[],"mappings":";;;AAAA,uCAAkC;AAElC,yIAAyI;AACzI,MAAa,gBAAgB;IAC3B;;;;;;;;;OASG;IACH,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,IAAgC;QACvD,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,IAAI,CAAC;QAClB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,KAAK,CAAC;QACf,CAAC;QAED,OAAO,iBAAM,CAAC,WAAW,CAAC,8CAA8C,CAAC,CAAC;IAC5E,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,IAG5B;QACC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;QAC/B,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;QAE5D,IAAA,iBAAM,EAAC,MAAM,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QACrC,IAAA,iBAAM,EAAC,MAAM,YAAY,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACrF,CAAC;CACF;AArCD,4CAqCC","sourcesContent":["import { expect } from 'bun:test';\n\n/** Test helpers for asserting that a promise rejects, without the typing and un-awaited-assertion pitfalls of `expect(task).rejects`. */\nexport class RejectionUtility {\n /**\n * Awaits a task that must reject and returns what it rejected with; throws when the task resolves.\n *\n * bun types the async matchers (`expect(task).rejects` / `.resolves`) as `void`, so\n * `await expect(task).rejects.toThrow()` is refused by `await-thenable` - and left un-awaited the\n * assertion never runs. Awaiting the task itself needs no matcher and no cast:\n * `RejectionUtility.expectRejection({ task, message })` or\n * `expect(await RejectionUtility.rejectionOf({ task })).toBeInstanceOf(Error)`,\n * and for a resolution `expect(await task).toMatchObject(...)`.\n */\n static async rejectionOf(opts: { task: Promise<unknown> }): Promise<unknown> {\n try {\n await opts.task;\n } catch (error) {\n return error;\n }\n\n return expect.unreachable('Expected the task to reject, but it resolved');\n }\n\n /**\n * The task rejects with an Error whose message contains `message` (a string) or matches it (a\n * RegExp). The message is compared as a string on purpose: bun 1.4.2 `toMatchObject` with an\n * asymmetric matcher overwrites the matched property on the object it checks, so a later read of\n * `error.message` gets the matcher back.\n */\n static async expectRejection(opts: {\n task: Promise<unknown>;\n message: string | RegExp;\n }): Promise<void> {\n const { task, message } = opts;\n const reason = await RejectionUtility.rejectionOf({ task });\n\n expect(reason).toBeInstanceOf(Error);\n expect(reason instanceof Error ? reason.message : String(reason)).toMatch(message);\n }\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  /** Long enough for a cold `bun build` under a loaded parallel run; it bounds a stall, not a slow run. */
2
2
  export declare const SPAWN_TIMEOUT_MS = 120000;
3
3
  /** Bounded wrappers around `Bun.spawn*` for tests, so a stuck child cannot stall a suite. */
4
- export declare class SpawnHelper {
4
+ export declare class SpawnUtility {
5
5
  /**
6
6
  * `Bun.spawnSync`, bounded. A sync spawn blocks the worker thread, so bun's own test timeout cannot
7
7
  * fire while it waits: the `timeout` option is the only bound. Its default signal, SIGTERM, can be
@@ -13,4 +13,4 @@ export declare class SpawnHelper {
13
13
  onExit?: undefined;
14
14
  }): Bun.SyncSubprocess<Out, Err>;
15
15
  }
16
- //# sourceMappingURL=spawn.helper.d.ts.map
16
+ //# sourceMappingURL=spawn.utility.d.ts.map
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SpawnHelper = exports.SPAWN_TIMEOUT_MS = void 0;
3
+ exports.SpawnUtility = exports.SPAWN_TIMEOUT_MS = void 0;
4
4
  /** Long enough for a cold `bun build` under a loaded parallel run; it bounds a stall, not a slow run. */
5
5
  exports.SPAWN_TIMEOUT_MS = 120_000;
6
6
  /** Bounded wrappers around `Bun.spawn*` for tests, so a stuck child cannot stall a suite. */
7
- class SpawnHelper {
7
+ class SpawnUtility {
8
8
  /**
9
9
  * `Bun.spawnSync`, bounded. A sync spawn blocks the worker thread, so bun's own test timeout cannot
10
10
  * fire while it waits: the `timeout` option is the only bound. Its default signal, SIGTERM, can be
@@ -19,11 +19,11 @@ class SpawnHelper {
19
19
  killSignal: 'SIGKILL',
20
20
  });
21
21
  if (result.exitedDueToTimeout) {
22
- // eslint-disable-next-line venizia/no-new-error -- getError would be a dev-configs -> inversion cycle
23
- throw new Error(`[SpawnHelper.spawnSyncBounded] did not exit within ${timeout} ms, killed | cmd: ${opts.cmd.join(' ').slice(0, 200)}`);
22
+ // eslint-disable-next-line @venizia/no-new-error -- getError would be a dev-configs -> inversion cycle
23
+ throw new Error(`[SpawnUtility.spawnSyncBounded] did not exit within ${timeout} ms, killed | cmd: ${opts.cmd.join(' ').slice(0, 200)}`);
24
24
  }
25
25
  return result;
26
26
  }
27
27
  }
28
- exports.SpawnHelper = SpawnHelper;
29
- //# sourceMappingURL=spawn.helper.js.map
28
+ exports.SpawnUtility = SpawnUtility;
29
+ //# sourceMappingURL=spawn.utility.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spawn.utility.js","sourceRoot":"","sources":["../../src/testing/spawn.utility.ts"],"names":[],"mappings":";;;AAAA,yGAAyG;AAC5F,QAAA,gBAAgB,GAAG,OAAO,CAAC;AAExC,6FAA6F;AAC7F,MAAa,YAAY;IACvB;;;;;OAKG;IACH,MAAM,CAAC,gBAAgB,CAIrB,IAA6F;QAC7F,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,wBAAgB,CAAC;QACjD,MAAM,MAAM,GAAG,GAAG,CAAC,SAAS,CAAe;YACzC,GAAG,IAAI;YACP,OAAO;YACP,UAAU,EAAE,SAAkB;SAC/B,CAAC,CAAC;QAEH,IAAI,MAAM,CAAC,kBAAkB,EAAE,CAAC;YAC9B,uGAAuG;YACvG,MAAM,IAAI,KAAK,CACb,uDAAuD,OAAO,sBAAsB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CACvH,CAAC;QACJ,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AA5BD,oCA4BC","sourcesContent":["/** Long enough for a cold `bun build` under a loaded parallel run; it bounds a stall, not a slow run. */\nexport const SPAWN_TIMEOUT_MS = 120_000;\n\n/** Bounded wrappers around `Bun.spawn*` for tests, so a stuck child cannot stall a suite. */\nexport class SpawnUtility {\n /**\n * `Bun.spawnSync`, bounded. A sync spawn blocks the worker thread, so bun's own test timeout cannot\n * fire while it waits: the `timeout` option is the only bound. Its default signal, SIGTERM, can be\n * outlived by a stuck child - one such child once stalled a whole suite for 770s - so this kills with\n * SIGKILL, and throws naming the command instead of returning a half-finished result.\n */\n static spawnSyncBounded<\n const In extends Bun.SpawnOptions.Writable = 'ignore',\n const Out extends Bun.SpawnOptions.Readable = 'pipe',\n const Err extends Bun.SpawnOptions.Readable = 'pipe',\n >(opts: Bun.SpawnOptions.SpawnSyncOptions<In, Out, Err> & { cmd: string[]; onExit?: undefined }) {\n const timeout = opts.timeout ?? SPAWN_TIMEOUT_MS;\n const result = Bun.spawnSync<In, Out, Err>({\n ...opts,\n timeout,\n killSignal: 'SIGKILL' as const,\n });\n\n if (result.exitedDueToTimeout) {\n // eslint-disable-next-line @venizia/no-new-error -- getError would be a dev-configs -> inversion cycle\n throw new Error(\n `[SpawnUtility.spawnSyncBounded] did not exit within ${timeout} ms, killed | cmd: ${opts.cmd.join(' ').slice(0, 200)}`,\n );\n }\n\n return result;\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@venizia/dev-configs",
3
- "version": "0.5.0-1",
3
+ "version": "0.5.0-10",
4
4
  "description": "Shareable development configurations for TypeScript projects: oxlint presets with per-rule builders, the ESLint naming-convention rule, the legacy ESLint flat config, and TypeScript compiler options with critical decorator support (experimentalDecorators, emitDecoratorMetadata, useDefineForClassFields). Single source of truth for consistent code style, type checking, and build settings across monorepo packages.",
5
5
  "keywords": [
6
6
  "build-tools",
@@ -109,13 +109,13 @@
109
109
  "dependencies": {
110
110
  "@eslint/js": "^10.0.1",
111
111
  "@stylistic/eslint-plugin": "^5.10.0",
112
- "typescript-eslint": "^8.72.0"
112
+ "typescript-eslint": "^8.74.0"
113
113
  },
114
114
  "devDependencies": {
115
- "@types/bun": "^1.4.3",
116
- "eslint": "^10.13.0",
117
- "oxlint": "1.89.0",
118
- "oxlint-tsgolint": "7.0.2004",
115
+ "@types/bun": "^1.4.5",
116
+ "eslint": "^10.15.0",
117
+ "oxlint": "1.95.0",
118
+ "oxlint-tsgolint": "7.0.2009",
119
119
  "typescript": "^6.0.3"
120
120
  },
121
121
  "peerDependencies": {
@@ -139,6 +139,6 @@
139
139
  }
140
140
  },
141
141
  "engines": {
142
- "bun": ">=1.4.4"
142
+ "bun": ">=1.4"
143
143
  }
144
144
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"rejection.helper.js","sourceRoot":"","sources":["../../src/testing/rejection.helper.ts"],"names":[],"mappings":";;;AAAA,uCAAkC;AAElC,yIAAyI;AACzI,MAAa,eAAe;IAC1B;;;;;;;;;OASG;IACH,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,IAAgC;QACvD,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,IAAI,CAAC;QAClB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,KAAK,CAAC;QACf,CAAC;QAED,OAAO,iBAAM,CAAC,WAAW,CAAC,8CAA8C,CAAC,CAAC;IAC5E,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,IAG5B;QACC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;QAC/B,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;QAE3D,IAAA,iBAAM,EAAC,MAAM,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QACrC,IAAA,iBAAM,EAAC,MAAM,YAAY,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACrF,CAAC;CACF;AArCD,0CAqCC","sourcesContent":["import { expect } from 'bun:test';\n\n/** Test helpers for asserting that a promise rejects, without the typing and un-awaited-assertion pitfalls of `expect(task).rejects`. */\nexport class RejectionHelper {\n /**\n * Awaits a task that must reject and returns what it rejected with; throws when the task resolves.\n *\n * bun types the async matchers (`expect(task).rejects` / `.resolves`) as `void`, so\n * `await expect(task).rejects.toThrow()` is refused by `await-thenable` - and left un-awaited the\n * assertion never runs. Awaiting the task itself needs no matcher and no cast:\n * `RejectionHelper.expectRejection({ task, message })` or\n * `expect(await RejectionHelper.rejectionOf({ task })).toBeInstanceOf(Error)`,\n * and for a resolution `expect(await task).toMatchObject(...)`.\n */\n static async rejectionOf(opts: { task: Promise<unknown> }): Promise<unknown> {\n try {\n await opts.task;\n } catch (error) {\n return error;\n }\n\n return expect.unreachable('Expected the task to reject, but it resolved');\n }\n\n /**\n * The task rejects with an Error whose message contains `message` (a string) or matches it (a\n * RegExp). The message is compared as a string on purpose: bun 1.4.2 `toMatchObject` with an\n * asymmetric matcher overwrites the matched property on the object it checks, so a later read of\n * `error.message` gets the matcher back.\n */\n static async expectRejection(opts: {\n task: Promise<unknown>;\n message: string | RegExp;\n }): Promise<void> {\n const { task, message } = opts;\n const reason = await RejectionHelper.rejectionOf({ task });\n\n expect(reason).toBeInstanceOf(Error);\n expect(reason instanceof Error ? reason.message : String(reason)).toMatch(message);\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"spawn.helper.js","sourceRoot":"","sources":["../../src/testing/spawn.helper.ts"],"names":[],"mappings":";;;AAAA,yGAAyG;AAC5F,QAAA,gBAAgB,GAAG,OAAO,CAAC;AAExC,6FAA6F;AAC7F,MAAa,WAAW;IACtB;;;;;OAKG;IACH,MAAM,CAAC,gBAAgB,CAIrB,IAA6F;QAC7F,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,wBAAgB,CAAC;QACjD,MAAM,MAAM,GAAG,GAAG,CAAC,SAAS,CAAe;YACzC,GAAG,IAAI;YACP,OAAO;YACP,UAAU,EAAE,SAAkB;SAC/B,CAAC,CAAC;QAEH,IAAI,MAAM,CAAC,kBAAkB,EAAE,CAAC;YAC9B,sGAAsG;YACtG,MAAM,IAAI,KAAK,CACb,sDAAsD,OAAO,sBAAsB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CACtH,CAAC;QACJ,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AA5BD,kCA4BC","sourcesContent":["/** Long enough for a cold `bun build` under a loaded parallel run; it bounds a stall, not a slow run. */\nexport const SPAWN_TIMEOUT_MS = 120_000;\n\n/** Bounded wrappers around `Bun.spawn*` for tests, so a stuck child cannot stall a suite. */\nexport class SpawnHelper {\n /**\n * `Bun.spawnSync`, bounded. A sync spawn blocks the worker thread, so bun's own test timeout cannot\n * fire while it waits: the `timeout` option is the only bound. Its default signal, SIGTERM, can be\n * outlived by a stuck child - one such child once stalled a whole suite for 770s - so this kills with\n * SIGKILL, and throws naming the command instead of returning a half-finished result.\n */\n static spawnSyncBounded<\n const In extends Bun.SpawnOptions.Writable = 'ignore',\n const Out extends Bun.SpawnOptions.Readable = 'pipe',\n const Err extends Bun.SpawnOptions.Readable = 'pipe',\n >(opts: Bun.SpawnOptions.SpawnSyncOptions<In, Out, Err> & { cmd: string[]; onExit?: undefined }) {\n const timeout = opts.timeout ?? SPAWN_TIMEOUT_MS;\n const result = Bun.spawnSync<In, Out, Err>({\n ...opts,\n timeout,\n killSignal: 'SIGKILL' as const,\n });\n\n if (result.exitedDueToTimeout) {\n // eslint-disable-next-line venizia/no-new-error -- getError would be a dev-configs -> inversion cycle\n throw new Error(\n `[SpawnHelper.spawnSyncBounded] did not exit within ${timeout} ms, killed | cmd: ${opts.cmd.join(' ').slice(0, 200)}`,\n );\n }\n\n return result;\n }\n}\n"]}