@zgeoff/oxlint-config 0.6.1 → 0.6.2

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
@@ -173,8 +173,17 @@ first statement, so put the comment above it:
173
173
  // oxlint-disable zgeoff/test-beside-module -- tests base.json and react.json together
174
174
  ```
175
175
 
176
- A second test file for a module (`<name>.host.test.ts`) needs its own `<name>.host.<ext>`, so the
177
- rule reports it beside only `<name>.ts`.
176
+ A lane suite, such as `<name>.browser.test.ts`, tests the same module as `<name>.test.ts` and needs
177
+ only `<name>.<ext>`; the suffix lets the repo's test script run the suite in its own lane. The rule
178
+ treats `browser` as a lane with no configuration. A repo adds its own lanes with the `lanes` option,
179
+ and `browser` stays a lane beside them:
180
+
181
+ ```json
182
+ { "rules": { "zgeoff/test-beside-module": ["error", { "lanes": ["sdk"] }] } }
183
+ ```
184
+
185
+ Any other suffix is part of the name. A second test file for a module (`<name>.host.test.ts`) needs
186
+ its own `<name>.host.<ext>`, so the rule reports it beside only `<name>.ts`.
178
187
 
179
188
  ## `zgeoff/setup-test-only`
180
189
 
@@ -334,7 +343,7 @@ that refuses an import of `to` from `from`, both paths relative to the repo root
334
343
  resolution, so `to` is the path that the rule would resolve the specifier to. The rule judges each
335
344
  edge through the same function.
336
345
 
337
- ## Notes
346
+ ## Plugins and type-aware rules
338
347
 
339
348
  - The config enables the `typescript`, `unicorn`, `oxc`, `import`, and `promise` plugins and loads
340
349
  `@stylistic/eslint-plugin` through `jsPlugins`. oxlint resolves `jsPlugins` specifiers from the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgeoff/oxlint-config",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "Shareable oxlint config: strict categories, house-style rules, and a custom JS plugin",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -60,13 +60,14 @@
60
60
  "access": "public"
61
61
  },
62
62
  "scripts": {
63
- "typecheck": "tsc"
63
+ "typecheck": "tsrs"
64
64
  },
65
65
  "dependencies": {
66
66
  "@stylistic/eslint-plugin": "5.10.0"
67
67
  },
68
68
  "devDependencies": {
69
69
  "@types/bun": "1.4.2",
70
+ "tsrs": "0.18.0-ts7.1.0-dev.20260929",
70
71
  "typescript": "7.0.2"
71
72
  },
72
73
  "peerDependencies": {
@@ -2,9 +2,7 @@ import { readdirSync, statSync } from 'node:fs';
2
2
  import { basename, dirname, join, relative, sep } from 'node:path';
3
3
  import resolveRepoRoot from './resolve-repo-root.js';
4
4
 
5
- // a browser suite (`<name>.browser.test.ts`) tests the same module as
6
- // `<name>.test.ts`, and the suffix lets a runner put it in its own lane
7
- const testFilePattern = /^(?<base>.+?)(?:\.browser)?\.test\.tsx?$/u;
5
+ const testFilePattern = /^(?<base>.+)\.test\.tsx?$/u;
8
6
 
9
7
  const testBesideModule = {
10
8
  meta: {
@@ -13,9 +11,19 @@ const testBesideModule = {
13
11
  missing:
14
12
  'Move this test beside the module it tests: no `{{name}}.<ext>` sits in this directory. Whole-program suites belong in a root `e2e/` or `evals/` directory.',
15
13
  },
16
- schema: [],
14
+ schema: [
15
+ {
16
+ type: 'object',
17
+ properties: {
18
+ lanes: { type: 'array', items: { type: 'string' } },
19
+ },
20
+ additionalProperties: false,
21
+ },
22
+ ],
17
23
  },
18
24
  create(context) {
25
+ const lanes = new Set(['browser', ...(context.options[0]?.lanes ?? [])]);
26
+
19
27
  return {
20
28
  Program() {
21
29
  const filename = context.physicalFilename;
@@ -25,7 +33,7 @@ const testBesideModule = {
25
33
  return;
26
34
  }
27
35
 
28
- const name = match.groups.base;
36
+ const name = toModuleName(match.groups.base, lanes);
29
37
 
30
38
  if (probeModuleSibling(dirname(filename), name)) {
31
39
  return;
@@ -58,6 +66,14 @@ function isUnderExemptRoot(cwd, filename) {
58
66
  return exemptRootDirs.has(first);
59
67
  }
60
68
 
69
+ // a lane suite (`<name>.browser.test.ts`) tests the same module as
70
+ // `<name>.test.ts`, and the suffix lets a runner put it in its own lane
71
+ function toModuleName(base, lanes) {
72
+ const dot = base.lastIndexOf('.');
73
+
74
+ return dot > 0 && lanes.has(base.slice(dot + 1)) ? base.slice(0, dot) : base;
75
+ }
76
+
61
77
  // a module is `<name>.<ext>` with a single-segment extension, so a
62
78
  // declaration file never stands in for one, and neither does another test
63
79
  // (`foo.test.ts` beside `foo.test.test.ts`)