@travetto/lint 8.0.0-alpha.28 → 8.0.0-alpha.29

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/lint",
3
- "version": "8.0.0-alpha.28",
3
+ "version": "8.0.0-alpha.29",
4
4
  "type": "module",
5
5
  "description": "Linting and Formatting integration for Travetto",
6
6
  "keywords": [
@@ -1,7 +1,7 @@
1
- import fs from "node:fs/promises";
1
+ import fs from 'node:fs/promises';
2
2
 
3
- import { CliCommand, type CliCommandShape } from "@travetto/cli";
4
- import { Runtime, RuntimeIndex } from "@travetto/runtime";
3
+ import { CliCommand, type CliCommandShape } from '@travetto/cli';
4
+ import { Runtime, RuntimeIndex } from '@travetto/runtime';
5
5
 
6
6
  /**
7
7
  * Generate the workspace oxlint, oxfmt, and cspell configuration entry files.
@@ -11,48 +11,50 @@ import { Runtime, RuntimeIndex } from "@travetto/runtime";
11
11
  @CliCommand({})
12
12
  export class LintRegisterCommand implements CliCommandShape {
13
13
  async main(): Promise<void> {
14
- const PREAMBLE = `process.env.TRV_MANIFEST= '${Runtime.stripWorkspacePath(Runtime.workspaceRelative(RuntimeIndex.outputRoot, "node_modules", Runtime.workspace.name))}';`;
15
-
16
14
  // Bootstrap oxlint configuration
17
- const oxlintOutput = Runtime.workspaceRelative("oxlint.config.js");
15
+ const oxlintOutput = Runtime.workspaceRelative('oxlint.config.ts');
18
16
  if (!(await fs.stat(oxlintOutput, { throwIfNoEntry: false }))) {
19
- const entry = RuntimeIndex.getFromImport("@travetto/lint/support/oxlint");
20
- const content = `${PREAMBLE}
21
- const { oxlintConfig } = await import('${Runtime.stripWorkspacePath(entry!.outputFile)}');
22
- export default oxlintConfig();
17
+ const entry = RuntimeIndex.getFromImport('@travetto/lint/support/oxlint');
18
+ const content = `
19
+ const { oxlintConfig } = await import('./${Runtime.stripWorkspacePath(entry!.outputFile)}');
20
+ export default oxlintConfig({
21
+ // Override here
22
+ });
23
23
  `;
24
- await fs.writeFile(oxlintOutput, content);
24
+ await fs.writeFile(oxlintOutput, content.trimStart());
25
25
  console.log(`Wrote lint config to ${oxlintOutput}`);
26
26
  } else {
27
27
  console.log(`Lint config already present ${oxlintOutput}`);
28
28
  }
29
29
 
30
30
  // Bootstrap oxfmt configuration
31
- const oxfmtOutput = Runtime.workspaceRelative("oxfmt.config.js");
31
+ const oxfmtOutput = Runtime.workspaceRelative('oxfmt.config.ts');
32
32
  if (!(await fs.stat(oxfmtOutput, { throwIfNoEntry: false }))) {
33
- const entry = RuntimeIndex.getFromImport("@travetto/lint/support/oxfmt");
34
- const content = `${PREAMBLE}
35
- const { oxfmtConfig } = await import('${Runtime.stripWorkspacePath(entry!.outputFile)}');
36
- export default oxfmtConfig();
33
+ const entry = RuntimeIndex.getFromImport('@travetto/lint/support/oxfmt');
34
+ const content = `
35
+ const { oxfmtConfig } = await import('./${Runtime.stripWorkspacePath(entry!.outputFile)}');
36
+ export default oxfmtConfig({
37
+ // Override here
38
+ });
37
39
  `;
38
40
 
39
- await fs.writeFile(oxfmtOutput, content);
41
+ await fs.writeFile(oxfmtOutput, content.trimStart());
40
42
  console.log(`Wrote format config to ${oxfmtOutput}`);
41
43
  } else {
42
44
  console.log(`Format config already present ${oxfmtOutput}`);
43
45
  }
44
46
 
45
47
  // Bootstrap cspell configuration
46
- const cspellOutput = Runtime.workspaceRelative("cspell.json");
48
+ const cspellOutput = Runtime.workspaceRelative('cspell.json');
47
49
  if (!(await fs.stat(cspellOutput, { throwIfNoEntry: false }))) {
48
50
  const cspellContent =
49
51
  JSON.stringify(
50
52
  {
51
- import: ["@travetto/lint/resources/cspell.json"],
53
+ import: ['@travetto/lint/resources/cspell.json']
52
54
  },
53
55
  null,
54
- 2,
55
- ) + "\n";
56
+ 2
57
+ ) + '\n';
56
58
  await fs.writeFile(cspellOutput, cspellContent);
57
59
  console.log(`Wrote cspell config to ${cspellOutput}`);
58
60
  } else {