@xylabs/ts-scripts-yarn3 2.16.5 → 2.17.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.
Files changed (37) hide show
  1. package/dist/.tsconfig.build.cjs.tsbuildinfo +1 -1
  2. package/dist/.tsconfig.build.esm.tsbuildinfo +1 -1
  3. package/dist/cjs/actions/lint-clean.js +2 -1
  4. package/dist/cjs/actions/lint-clean.js.map +1 -1
  5. package/dist/cjs/actions/lint-profile.js +1 -1
  6. package/dist/cjs/actions/lint-profile.js.map +1 -1
  7. package/dist/cjs/actions/lint.js +20 -7
  8. package/dist/cjs/actions/lint.js.map +1 -1
  9. package/dist/cjs/lib/xy/xyLintCommands.js +4 -3
  10. package/dist/cjs/lib/xy/xyLintCommands.js.map +1 -1
  11. package/dist/esm/actions/lint-clean.js +3 -2
  12. package/dist/esm/actions/lint-clean.js.map +1 -1
  13. package/dist/esm/actions/lint-profile.js +1 -1
  14. package/dist/esm/actions/lint-profile.js.map +1 -1
  15. package/dist/esm/actions/lint.js +16 -4
  16. package/dist/esm/actions/lint.js.map +1 -1
  17. package/dist/esm/lib/xy/xyLintCommands.js +2 -2
  18. package/dist/esm/lib/xy/xyLintCommands.js.map +1 -1
  19. package/dist/tsconfig.build.cjs.tsbuildinfo +1 -1
  20. package/dist/tsconfig.build.esm.tsbuildinfo +1 -1
  21. package/dist/types/actions/gitlint.d.ts +1 -1
  22. package/dist/types/actions/lint-clean.d.ts +1 -1
  23. package/dist/types/actions/lint-clean.d.ts.map +1 -1
  24. package/dist/types/actions/lint.d.ts +3 -2
  25. package/dist/types/actions/lint.d.ts.map +1 -1
  26. package/dist/types/actions/package/copy-assets.d.ts +1 -1
  27. package/dist/types/lib/dependencies/DuplicateDetector.d.ts +1 -1
  28. package/dist/types/lib/withErrnoException.d.ts +0 -1
  29. package/dist/types/lib/withErrnoException.d.ts.map +1 -1
  30. package/package.json +13 -12
  31. package/src/actions/lint-clean.ts +3 -2
  32. package/src/actions/lint-profile.ts +1 -1
  33. package/src/actions/lint.ts +26 -4
  34. package/src/lib/xy/xyLintCommands.ts +2 -2
  35. package/tsconfig.build.cjs.json +7 -7
  36. package/tsconfig.build.esm.json +7 -7
  37. package/.tsconfig.build.test.json +0 -6
@@ -1,4 +1,5 @@
1
1
  import chalk from 'chalk'
2
+ import { ESLint } from 'eslint'
2
3
 
3
4
  import { runSteps, yarnWorkspaces } from '../lib'
4
5
 
@@ -12,15 +13,36 @@ export interface LintPackageParams {
12
13
  verbose?: boolean
13
14
  }
14
15
 
15
- export const lintPackage = ({ pkg }: LintParams) => {
16
+ export const lintPackage = async ({ pkg }: LintParams) => {
16
17
  const workspace = yarnWorkspaces().find((workspace) => workspace.name === pkg)
17
18
  if (!workspace) {
18
19
  console.error(chalk.red(`Unable to locate package [${chalk.magenta(pkg)}]`))
19
20
  process.exit(1)
20
21
  }
21
- return runSteps(`Lint-Caching [${pkg}]`, [['yarn', ['eslint', workspace.location, '--cache']]])
22
+
23
+ const engine = new ESLint({ cache: true })
24
+
25
+ const lintResults = await engine.lintFiles(workspace.location)
26
+
27
+ console.log(lintResults)
28
+
29
+ const errorCount = lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0)
30
+
31
+ return errorCount
32
+ }
33
+
34
+ export const lintAll = async () => {
35
+ const engine = new ESLint({ cache: true })
36
+
37
+ const lintResults = await engine.lintFiles('./**/*.*')
38
+
39
+ console.log(lintResults)
40
+
41
+ const errorCount = lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0)
42
+
43
+ return errorCount
22
44
  }
23
45
 
24
- export const lint = ({ pkg }: LintParams) => {
25
- return pkg ? lintPackage({ pkg }) : runSteps('Lint-Caching [All]', [['yarn', ['eslint', '.', '--cache']]])
46
+ export const lint = async ({ pkg }: LintParams = {}) => {
47
+ return pkg ? await lintPackage({ pkg }) : runSteps('Lint-Caching [All]', [['yarn', ['eslint', '.', '--cache']]])
26
48
  }
@@ -25,9 +25,9 @@ export const xyLintCommands = (args: yargs.Argv) => {
25
25
  describe: 'Specific package to check',
26
26
  })
27
27
  },
28
- (argv) => {
28
+ async (argv) => {
29
29
  if (argv.verbose) console.log('Lint')
30
- process.exitCode = argv.fix ? fix() : argv.profile ? lintProfile() : lint({ pkg: argv.package as string })
30
+ process.exitCode = argv.fix ? fix() : argv.profile ? lintProfile() : await lint({ pkg: argv.package as string })
31
31
  },
32
32
  )
33
33
  .command(
@@ -1,17 +1,16 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "rootDir": "src",
4
- "rootDirs": [
5
- "package.json"
6
- ],
7
3
  "composite": true,
8
4
  "declarationDir": "./dist/types",
9
- "typeRoots": [],
10
5
  "module": "CommonJS",
11
6
  "outDir": "./dist/cjs",
12
- "target": "ES6"
7
+ "rootDir": "src",
8
+ "rootDirs": [
9
+ "package.json"
10
+ ],
11
+ "target": "ES6",
12
+ "typeRoots": []
13
13
  },
14
- "extends": "@xylabs/tsconfig",
15
14
  "exclude": [
16
15
  "**/build",
17
16
  "**/dist",
@@ -23,6 +22,7 @@
23
22
  "**/spec/*",
24
23
  "**/stories/*"
25
24
  ],
25
+ "extends": "@xylabs/tsconfig",
26
26
  "include": [
27
27
  "src"
28
28
  ]
@@ -1,17 +1,16 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "rootDir": "src",
4
- "rootDirs": [
5
- "package.json"
6
- ],
7
3
  "composite": true,
8
4
  "declarationDir": "./dist/types",
9
- "typeRoots": [],
10
5
  "module": "ESNext",
11
6
  "outDir": "./dist/esm",
12
- "target": "ESNext"
7
+ "rootDir": "src",
8
+ "rootDirs": [
9
+ "package.json"
10
+ ],
11
+ "target": "ESNext",
12
+ "typeRoots": []
13
13
  },
14
- "extends": "@xylabs/tsconfig",
15
14
  "exclude": [
16
15
  "**/build",
17
16
  "**/dist",
@@ -23,6 +22,7 @@
23
22
  "**/spec/*",
24
23
  "**/stories/*"
25
24
  ],
25
+ "extends": "@xylabs/tsconfig",
26
26
  "include": [
27
27
  "src"
28
28
  ]
@@ -1,6 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "include": [
4
- "src/**/*.spec.ts"
5
- ]
6
- }