@travetto/eslint 3.0.3 → 3.1.0-rc.0

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/eslint",
3
- "version": "3.0.3",
3
+ "version": "3.1.0-rc.0",
4
4
  "description": "ES Linting Rules",
5
5
  "keywords": [
6
6
  "eslint",
@@ -23,7 +23,7 @@
23
23
  "directory": "module/eslint"
24
24
  },
25
25
  "dependencies": {
26
- "@travetto/manifest": "^3.0.3",
26
+ "@travetto/manifest": "^3.1.0-rc.0",
27
27
  "@types/eslint": "^8.21.1",
28
28
  "@typescript-eslint/eslint-plugin": "^5.52.0",
29
29
  "@typescript-eslint/parser": "^5.52.0",
@@ -31,7 +31,7 @@
31
31
  "eslint-plugin-unused-imports": "^2.0.0"
32
32
  },
33
33
  "peerDependencies": {
34
- "@travetto/cli": "^3.0.3"
34
+ "@travetto/cli": "^3.1.0-rc.0"
35
35
  },
36
36
  "peerDependenciesMeta": {
37
37
  "@travetto/cli": {
@@ -1,29 +1,22 @@
1
1
  import { RootIndex } from '@travetto/manifest';
2
2
  import { ExecUtil, GlobalEnvConfig } from '@travetto/base';
3
- import { CliCommand, CliModuleUtil, OptionConfig } from '@travetto/cli';
4
-
5
- type Options = {
6
- changed: OptionConfig<boolean>;
7
- };
3
+ import { CliCommandShape, CliCommand, CliModuleUtil } from '@travetto/cli';
8
4
 
9
5
  /**
10
6
  * Command line support for linting
11
7
  */
12
- export class LintCommand extends CliCommand<Options> {
13
- name = 'lint';
8
+ @CliCommand()
9
+ export class LintCommand implements CliCommandShape {
14
10
 
15
- getOptions(): Options {
16
- return {
17
- changed: this.boolOption({ desc: 'Only check changed modules', def: false }),
18
- };
19
- }
11
+ /** Only check changed modules */
12
+ changed = false;
20
13
 
21
14
  envInit(): GlobalEnvConfig {
22
15
  return { debug: false };
23
16
  }
24
17
 
25
- async action(): Promise<void> {
26
- const mods = await CliModuleUtil.findModules(this.cmd.changed ? 'changed' : 'all');
18
+ async main(): Promise<void> {
19
+ const mods = await CliModuleUtil.findModules(this.changed ? 'changed' : 'all');
27
20
 
28
21
  const res = await ExecUtil.spawn('npx', ['eslint', ...mods.filter(x => x.local).map(x => x.sourcePath)], {
29
22
  cwd: RootIndex.manifest.workspacePath,
@@ -31,6 +24,6 @@ export class LintCommand extends CliCommand<Options> {
31
24
  catchAsResult: true
32
25
  }).result;
33
26
 
34
- return this.exit(res.code);
27
+ process.exitCode = res.code;
35
28
  }
36
29
  }
@@ -1,14 +1,17 @@
1
1
  import fs from 'fs/promises';
2
2
 
3
- import { CliCommand } from '@travetto/cli';
3
+ import { CliCommandShape, CliCommand } from '@travetto/cli';
4
4
  import { path, RootIndex } from '@travetto/manifest';
5
5
 
6
6
  import { buildEslintConfig } from './bin/eslint-config-file';
7
7
 
8
- export class LintConfigureCommand extends CliCommand {
9
- name = 'lint:register';
8
+ /**
9
+ * Writes the lint configuration file
10
+ */
11
+ @CliCommand()
12
+ export class LintConfigureCommand implements CliCommandShape {
10
13
 
11
- async action(): Promise<void> {
14
+ async main(): Promise<void> {
12
15
  const content = buildEslintConfig();
13
16
  const output = path.resolve(RootIndex.manifest.workspacePath, 'eslint.config.js');
14
17
  await fs.writeFile(output, content.replaceAll(RootIndex.manifest.workspacePath, '.').trim());