@kitql/eslint-config 0.8.2 → 0.8.4

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 (2) hide show
  1. package/cmd.js +43 -23
  2. package/package.json +13 -14
package/cmd.js CHANGED
@@ -2,9 +2,9 @@
2
2
  import { spawn } from 'node:child_process'
3
3
  import fs from 'node:fs'
4
4
  import path from 'node:path'
5
- import { Option, program } from 'commander'
6
5
 
7
6
  import { gray, green, Log } from '@kitql/helpers'
7
+ import { parseCli } from '@kitql/helpers/server'
8
8
 
9
9
  import { findFileOrUp } from './helper/findFileOrUp.js'
10
10
 
@@ -12,25 +12,43 @@ import { findFileOrUp } from './helper/findFileOrUp.js'
12
12
  const TOOLS_ALL = ['eslint', 'prettier', 'oxlint', 'tsgolint']
13
13
  const TOOLS_DEFAULT = TOOLS_ALL.slice(0, 2)
14
14
 
15
- program.addOption(new Option('-f, --format', 'format'))
16
- program.addOption(new Option('-g, --glob <type>', 'file/dir/glob').default('.'))
17
- program.addOption(
18
- new Option('-t, --tools <type>', 'tools to use (eslint, prettier, oxlint, tsgolint)').default(
19
- TOOLS_DEFAULT.join(','),
20
- ),
21
- )
22
- program.addOption(new Option('-v, --verbose', 'add more logs').default(false))
23
- program.addOption(
24
- new Option('-d, --diff-only', 'only check files changed against base branch').default(false),
25
- )
26
- program.addOption(
27
- new Option('-b, --base-branch <type>', 'base branch to compare against').default('main'),
28
- )
29
- program.addOption(
30
- new Option('-p, --prefix <type>', 'prefix by with "pnpm" or "npm" or "none"').default('none'),
31
- )
32
- program.parse(process.argv)
33
- const options_cli = program.opts()
15
+ const { values: options_cli, help } = parseCli({
16
+ name: 'kitql-lint',
17
+ options: {
18
+ format: { type: 'boolean', short: 'f', description: 'format' },
19
+ glob: { type: 'string', short: 'g', default: '.', description: 'file/dir/glob' },
20
+ tools: {
21
+ type: 'string',
22
+ short: 't',
23
+ default: TOOLS_DEFAULT.join(','),
24
+ description: 'tools to use (eslint, prettier, oxlint, tsgolint)',
25
+ },
26
+ verbose: { type: 'boolean', short: 'v', default: false, description: 'add more logs' },
27
+ 'diff-only': {
28
+ type: 'boolean',
29
+ short: 'd',
30
+ default: false,
31
+ description: 'only check files changed against base branch',
32
+ },
33
+ 'base-branch': {
34
+ type: 'string',
35
+ short: 'b',
36
+ default: 'main',
37
+ description: 'base branch to compare against',
38
+ },
39
+ prefix: {
40
+ type: 'string',
41
+ short: 'p',
42
+ default: 'none',
43
+ description: 'prefix by with "pnpm" or "npm" or "none"',
44
+ },
45
+ },
46
+ })
47
+
48
+ if (options_cli.help) {
49
+ console.info(help)
50
+ process.exit(0)
51
+ }
34
52
 
35
53
  const pathPrettierIgnore = findFileOrUp('.prettierignore')
36
54
  const pathPrettier_js = findFileOrUp('.prettierrc.js')
@@ -39,9 +57,11 @@ const format = /** @type {boolean} */ (options_cli.format ?? false)
39
57
  let glob = /** @type {string} */ (options_cli.glob ?? '.')
40
58
  const verbose = /** @type {boolean} */ (options_cli.verbose ?? false)
41
59
  const pre = /** @type {string} */ (options_cli.prefix ?? 'none')
42
- const tools = /** @type {typeof TOOLS_ALL} */ (options_cli.tools.split(',') ?? TOOLS_DEFAULT)
43
- const diffOnly = /** @type {boolean} */ (options_cli.diffOnly ?? false)
44
- const baseBranch = /** @type {string} */ (options_cli.baseBranch ?? 'main')
60
+ const tools = /** @type {typeof TOOLS_ALL} */ (
61
+ String(options_cli.tools ?? TOOLS_DEFAULT.join(',')).split(',')
62
+ )
63
+ const diffOnly = /** @type {boolean} */ (options_cli['diff-only'] ?? false)
64
+ const baseBranch = /** @type {string} */ (options_cli['base-branch'] ?? 'main')
45
65
 
46
66
  const log = new Log('kitql-lint')
47
67
  // const spinner = new Spinner({ symbolFormatter: (msg) => bgBlueBright(` kitql-lint `) + ' ' + msg })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitql/eslint-config",
3
- "version": "0.8.2",
3
+ "version": "0.8.4",
4
4
  "type": "module",
5
5
  "description": "opinionated linting and formatting for projects",
6
6
  "repository": {
@@ -34,10 +34,10 @@
34
34
  "format"
35
35
  ],
36
36
  "peerDependencies": {
37
- "eslint": "10.3.0",
38
- "oxlint": "1.62.0",
39
- "oxlint-tsgolint": "0.22.1",
40
- "prettier": "^3.6.1"
37
+ "eslint": "10.4.0",
38
+ "oxlint": "1.66.0",
39
+ "oxlint-tsgolint": "0.23.0",
40
+ "prettier": "^3.8.3"
41
41
  },
42
42
  "peerDependenciesMeta": {
43
43
  "eslint": {
@@ -54,25 +54,24 @@
54
54
  }
55
55
  },
56
56
  "dependencies": {
57
- "@e18e/eslint-plugin": "^0.4.0",
58
- "@eslint/compat": "2.0.3",
57
+ "@e18e/eslint-plugin": "^0.5.0",
58
+ "@eslint/compat": "2.1.0",
59
59
  "@eslint/js": "10.0.1",
60
60
  "@ianvs/prettier-plugin-sort-imports": "^4.7.0",
61
61
  "@types/eslint": "9.6.1",
62
- "@typescript-eslint/parser": "8.58.1",
63
- "commander": "14.0.0",
62
+ "@typescript-eslint/parser": "8.59.3",
64
63
  "eslint-config-prettier": "10.1.5",
65
- "eslint-plugin-oxlint": "1.62.0",
64
+ "eslint-plugin-oxlint": "1.66.0",
66
65
  "eslint-plugin-pnpm": "1.6.0",
67
66
  "eslint-plugin-svelte": "3.17.1",
68
67
  "globals": "17.6.0",
69
68
  "jsonc-eslint-parser": "3.1.0",
70
69
  "prettier-plugin-sh": "^0.18.0",
71
- "prettier-plugin-svelte": "^3.4.0",
72
- "prettier-plugin-tailwindcss": "^0.7.2",
73
- "typescript-eslint": "8.58.1",
70
+ "prettier-plugin-svelte": "^4.0.0",
71
+ "prettier-plugin-tailwindcss": "^0.8.0",
72
+ "typescript-eslint": "8.59.3",
74
73
  "yaml-eslint-parser": "2.0.0",
75
- "@kitql/helpers": "0.8.13"
74
+ "@kitql/helpers": "0.8.15"
76
75
  },
77
76
  "publishConfig": {
78
77
  "access": "public"