lint-suite 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -457,7 +457,7 @@ per file.
457
457
 
458
458
  | Rule | Reports | Options |
459
459
  |---|---|---|
460
- | `local/type-placement` | An exported `type` outside a `common/*.type.ts` or `test/common/*.type.ts` file; a value exported from a `*.type.ts` file; a non-`const` export from a `*.const.ts` file; an `import type` from a relative or internal path that is neither a `*.type.ts` file nor a `common` barrel (`../common`, `./common/index.ts`, `@shared/common`). `.spec.ts`, `.stub.ts`, `.d.ts`, `state.type.ts` (any prefix), and fixtures are exempt; a `.spec.util.ts` file is not, so an exported type in one is reported. Never resolves imports. | `internalPatterns`: regex sources for alias prefixes that must resolve to a `*.type.ts` file. Default empty: a workspace alias (`@shared/common`) resolves to a library entry point, and module boundaries forbid deep imports, so alias type imports pass. |
460
+ | `local/type-placement` | An exported `type` outside a `common/*.type.ts` or `test/common/*.type.ts` file; a value exported from a `*.type.ts` file; a non-`const` export from a `*.const.ts` file; an `import type` from a relative or internal path that is neither a `*.type.ts` / `*.schema.ts` file nor a `common` barrel (`../common`, `./common/index.ts`, `@shared/common`). `.spec.ts`, `.stub.ts`, `.schema.ts` (an inferred type lives beside its schema), `.d.ts`, `state.type.ts` (any prefix), and fixtures are exempt; a `.spec.util.ts` file is not, so an exported type in one is reported. Never resolves imports. | `internalPatterns`: regex sources for alias prefixes that must resolve to a `*.type.ts` file. Default empty: a workspace alias (`@shared/common`) resolves to a library entry point, and module boundaries forbid deep imports, so alias type imports pass. |
461
461
  | `local/util-purity` | Inside `utils/*.util.ts` (excluding paths under `test/` or `testing/`): imports of `node:fs`, `child_process`, `os`, `process`, `http`, `net`, `worker_threads`; a module-level `let`; a module-level `new Map/Set/WeakMap/WeakSet`; `process.*`, `globalThis`, `window`, `document`, `localStorage`, `console`; `Date.now`, `Math.random`, `performance.now`, `crypto.randomUUID`; `setTimeout`, `setInterval`, `fetch`, `inject`, `require`. | `bannedModules` |
462
462
  | `local/test-file-shape` | A file named `*.spec-support.ts`, `*.spec-helper.ts`, `*.test-utils.ts`, `*-fixture.ts`, or under `__mocks__/` / `helpers/` / `common/stubs/`; a `.stub.ts` outside `test/stubs/`, a `.mock.ts` outside `test/mocks/`, a `.spec.util.ts` outside `test/utils/`, or any `fixtures/` directory outside `test/fixtures/` (a dedicated `testing/` library is exempt from all of these); a `test/stubs/*.stub.ts` export not named `UPPER_SNAKE_STUB` or without a type annotation; a `test/mocks/*.mock.ts` export that is not a camelCase `...Mock` function with an explicit return type. | none |
463
463
 
package/eslint.cjs CHANGED
@@ -6811,13 +6811,13 @@ var import_utils35 = require("@typescript-eslint/utils");
6811
6811
  // packages/lint-suite/src/lib/rules/type-placement/common/type-placement.const.ts
6812
6812
  var DEFAULT_INTERNAL_PATTERNS = [];
6813
6813
  var docs19 = {
6814
- description: "Require types to live in common/*.type.ts files, *.const.ts files to export only consts, and type-only imports to come from *.type.ts files or a common barrel"
6814
+ description: "Require types to live in common/*.type.ts files, *.const.ts files to export only consts, and type-only imports to come from *.type.ts or *.schema.ts files or a common barrel"
6815
6815
  };
6816
6816
  var messages19 = {
6817
6817
  typeOutsideTypeFile: "Exported type '{{ name }}' belongs in a common/*.type.ts or test/common/*.type.ts file, not here.",
6818
6818
  valueInTypeFile: "A *.type.ts file may only export type aliases and interfaces.",
6819
6819
  nonConstInConstFile: "A *.const.ts file may only export const variable declarations.",
6820
- typeImportNotFromTypeFile: "Type-only import from '{{ source }}' must come from a *.type.ts file or a common barrel."
6820
+ typeImportNotFromTypeFile: "Type-only import from '{{ source }}' must come from a *.type.ts or *.schema.ts file, or a common barrel."
6821
6821
  };
6822
6822
  var stringItems2 = { type: "string" };
6823
6823
  var internalPatternsSchema = {
@@ -6848,10 +6848,10 @@ var defaultOptions10 = [
6848
6848
  var TYPE_FILE_SUFFIX = ".type.ts";
6849
6849
  var CONST_FILE_SUFFIX = ".const.ts";
6850
6850
  var COMMON_SEGMENT = "/common/";
6851
- var EXEMPT_FILE = /\.(spec|stub|d)\.ts$/;
6851
+ var EXEMPT_FILE = /\.(spec|stub|schema|d)\.ts$/;
6852
6852
  var STATE_TYPE_FILE = /(^|[./])state\.type\.ts$/;
6853
6853
  var FIXTURES_SEGMENT2 = "/fixtures/";
6854
- var TYPE_FILE_SEGMENT = /\.type(\.ts)?$/;
6854
+ var TYPE_SOURCE_SEGMENT = /\.(type|schema)(\.ts)?$/;
6855
6855
  var COMMON_BARREL = /(^|\/)common(\/index(\.ts)?)?$/;
6856
6856
  var createRule19 = import_utils35.ESLintUtils.RuleCreator(
6857
6857
  () => "https://github.com/F0rty-Tw0/lint-suite#type-placement"
@@ -6870,7 +6870,7 @@ var lastSegment = (source) => {
6870
6870
  var isTypeOnlySource = (source) => {
6871
6871
  const isCommonBarrel = COMMON_BARREL.test(source);
6872
6872
  if (isCommonBarrel) return true;
6873
- return TYPE_FILE_SEGMENT.test(lastSegment(source));
6873
+ return TYPE_SOURCE_SEGMENT.test(lastSegment(source));
6874
6874
  };
6875
6875
  var isInternalSource = (source, patterns) => {
6876
6876
  const isRelative = source.startsWith(".");