@kitql/eslint-config 0.8.0-next.4 → 0.8.0-next.5

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 (3) hide show
  1. package/cmd.js +25 -24
  2. package/eslint.config.js +10 -2
  3. package/package.json +14 -13
package/cmd.js CHANGED
@@ -3,7 +3,7 @@ import { spawn } from 'node:child_process'
3
3
  import fs from 'node:fs'
4
4
  import path from 'node:path'
5
5
  import { Option, program } from 'commander'
6
- import ora from 'ora'
6
+ import { Spinner } from 'picospinner'
7
7
 
8
8
  import { bgBlueBright, bgGreen, bgRedBright, gray, green, red } from '@kitql/helpers'
9
9
 
@@ -44,15 +44,9 @@ const tools = /** @type {typeof TOOLS_ALL} */ (options_cli.tools.split(',') ?? T
44
44
  const diffOnly = /** @type {boolean} */ (options_cli.diffOnly ?? false)
45
45
  const baseBranch = /** @type {string} */ (options_cli.baseBranch ?? 'main')
46
46
 
47
- const spinner = ora({
48
- prefixText: bgBlueBright(` kitql-lint `),
49
- })
50
-
51
- function updateSpinnerText(/** @type {string} */ msg) {
52
- spinner.text = msg
53
- spinner.start()
54
- }
55
- updateSpinnerText('Action: ' + green(format ? 'formatting' : 'linting'))
47
+ const spinner = new Spinner({ symbolFormatter: (msg) => bgBlueBright(` kitql-lint `) + ' ' + msg })
48
+ spinner.start()
49
+ spinner.setText('Action: ' + green(format ? 'formatting' : 'linting'))
56
50
 
57
51
  let preToUse = ''
58
52
  if (pre === 'npm') {
@@ -95,7 +89,7 @@ async function customSpawn(/** @type {string} */ cmd) {
95
89
 
96
90
  let filesLength = -1
97
91
  async function getDiffFiles() {
98
- updateSpinnerText(
92
+ spinner.setText(
99
93
  verbose ? 'git diff ' + gray(`(getting changed files against ${baseBranch})`) : 'git diff',
100
94
  )
101
95
 
@@ -282,7 +276,7 @@ async function runOxc(/** @type {string} */ name) {
282
276
  `${format ? ' --fix' : ''}` +
283
277
  ` ${glob}`
284
278
 
285
- updateSpinnerText(gray(`${verbose ? cmdLint : name} `))
279
+ spinner.setText(gray(`${verbose ? cmdLint : name} `))
286
280
 
287
281
  const result_lint = await customSpawn(cmdLint)
288
282
 
@@ -298,7 +292,7 @@ async function runEslint() {
298
292
  // exec
299
293
  ` ${glob}`
300
294
 
301
- updateSpinnerText(gray(`${verbose ? cmd : 'eslint'} `))
295
+ spinner.setText(gray(`${verbose ? cmd : 'eslint'} `))
302
296
 
303
297
  const result_lint = await customSpawn(cmd)
304
298
 
@@ -319,7 +313,7 @@ async function runPrettier() {
319
313
  // exec
320
314
  ` ${glob}`
321
315
 
322
- updateSpinnerText(gray(`${verbose ? cmdFormat : 'prettier'} `))
316
+ spinner.setText(gray(`${verbose ? cmdFormat : 'prettier'} `))
323
317
 
324
318
  const result_format = await customSpawn(cmdFormat)
325
319
 
@@ -360,8 +354,10 @@ if ((tools.includes('oxlint') || tools.includes('tsgolint')) && glob) {
360
354
  const stepTook = performance.now() - start
361
355
  took.push(display(name, stepTook))
362
356
  if (typeof code === 'object' && 'status' in code && code.status) {
363
- spinner.prefixText = bgRedBright(` kitql-lint `)
364
- spinner.fail(red(`lint failed, check logs above. ${displayTook()}`))
357
+ spinner.fail({
358
+ symbolFormatter: (msg) => bgRedBright(` kitql-lint `) + ' ' + msg,
359
+ text: red(`lint failed, check logs above. ${displayTook()}`),
360
+ })
365
361
  process.exit(code.status)
366
362
  }
367
363
  }
@@ -372,8 +368,10 @@ if (tools.includes('eslint') && glob) {
372
368
  const stepTook = performance.now() - start
373
369
  took.push(display('eslint', stepTook))
374
370
  if (typeof code === 'object' && 'status' in code && code.status) {
375
- spinner.prefixText = bgRedBright(` kitql-lint `)
376
- spinner.fail(red(`lint failed, check logs above. ${displayTook()}`))
371
+ spinner.fail({
372
+ symbolFormatter: (msg) => bgRedBright(` kitql-lint `) + ' ' + msg,
373
+ text: red(`lint failed, check logs above. ${displayTook()}`),
374
+ })
377
375
  process.exit(code.status)
378
376
  }
379
377
  }
@@ -384,15 +382,18 @@ if (tools.includes('prettier') && glob) {
384
382
  const stepTook = performance.now() - start
385
383
  took.push(display('prettier', stepTook))
386
384
  if (typeof code === 'object' && 'status' in code && code.status) {
387
- spinner.prefixText = bgRedBright(` kitql-lint `)
388
- spinner.fail(red(`format failed, check logs above. ${displayTook()}`))
385
+ spinner.fail({
386
+ symbolFormatter: (msg) => bgRedBright(` kitql-lint `) + ' ' + msg,
387
+ text: red(`format failed, check logs above. ${displayTook()}`),
388
+ })
389
389
  process.exit(code.status)
390
390
  }
391
391
  }
392
392
 
393
- spinner.prefixText = bgGreen(` kitql-lint `)
394
- spinner.succeed(
395
- `All good, ` +
393
+ spinner.succeed({
394
+ symbolFormatter: (msg) => bgGreen(` kitql-lint `) + ' ' + msg,
395
+ text:
396
+ `All good, ` +
396
397
  `${
397
398
  glob === ''
398
399
  ? 'nothing to do!'
@@ -401,6 +402,6 @@ spinner.succeed(
401
402
  : 'your files looks great!'
402
403
  } ` +
403
404
  displayTook(),
404
- )
405
+ })
405
406
  spinner.stop()
406
407
  process.exit(0)
package/eslint.config.js CHANGED
@@ -1,3 +1,4 @@
1
+ import e18e from '@e18e/eslint-plugin'
1
2
  import { includeIgnoreFile } from '@eslint/compat'
2
3
  import js from '@eslint/js'
3
4
  import prettier from 'eslint-config-prettier'
@@ -82,7 +83,10 @@ const rulePnpmCatalogs = (options = {}) => {
82
83
  ]
83
84
  }
84
85
 
85
- const othersRules = () => {
86
+ /**
87
+ * @param {{svelteConfig?: import('@sveltejs/kit').Config}} options
88
+ */
89
+ const othersRules = ({ svelteConfig } = {}) => {
86
90
  return [
87
91
  {
88
92
  name: 'eslint/defaults/recommended',
@@ -92,6 +96,7 @@ const othersRules = () => {
92
96
  ...svelte.configs.recommended,
93
97
  { name: 'eslint/prettier', ...prettier },
94
98
  ...svelte.configs.prettier,
99
+ e18e?.configs?.recommended,
95
100
  {
96
101
  name: '@kitql:languages',
97
102
  languageOptions: {
@@ -109,6 +114,7 @@ const othersRules = () => {
109
114
  projectService: true,
110
115
  extraFileExtensions: ['.svelte'],
111
116
  parser: ts.parser,
117
+ svelteConfig,
112
118
  },
113
119
  },
114
120
  },
@@ -182,6 +188,7 @@ const othersRules = () => {
182
188
  * @typedef {Object} KitqlOptions
183
189
  * @property {PnpmCatalogsConfig} [pnpmCatalogs] - Configuration object for pnpm catalogs
184
190
  * @property {OxlintConfig} [oxlint] - Configuration object for oxlint
191
+ * @property {import('@sveltejs/kit').Config} [svelteConfig] - Configuration object for svelte
185
192
  */
186
193
 
187
194
  /**
@@ -189,13 +196,14 @@ const othersRules = () => {
189
196
  * @returns {import('eslint').Linter.Config[]}
190
197
  */
191
198
  export const kitql = (options = {}) => {
199
+ const svelteConfig = options?.svelteConfig ?? {}
192
200
  const pnpmCatalogsConfig = options?.pnpmCatalogs ?? { enable: false }
193
201
  const pnpmCatalogsEnabled = pnpmCatalogsConfig.enable !== false
194
202
 
195
203
  const arr = [
196
204
  // default rules
197
205
  rulePrettierIgnore({ pnpmCatalogsEnabled }),
198
- ...othersRules(),
206
+ ...othersRules({ svelteConfig }),
199
207
  ]
200
208
 
201
209
  if (pnpmCatalogsEnabled) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitql/eslint-config",
3
- "version": "0.8.0-next.4",
3
+ "version": "0.8.0-next.5",
4
4
  "type": "module",
5
5
  "description": "opinionated linting and formatting for projects",
6
6
  "repository": {
@@ -32,9 +32,9 @@
32
32
  "format"
33
33
  ],
34
34
  "peerDependencies": {
35
- "eslint": "9.37.0",
36
- "oxlint": "1.23.0",
37
- "oxlint-tsgolint": "0.2.0",
35
+ "eslint": "9.39.1",
36
+ "oxlint": "1.34.0",
37
+ "oxlint-tsgolint": "0.10.0",
38
38
  "prettier": "^3.6.1"
39
39
  },
40
40
  "peerDependenciesMeta": {
@@ -52,24 +52,25 @@
52
52
  }
53
53
  },
54
54
  "dependencies": {
55
+ "@e18e/eslint-plugin": "^0.1.1",
55
56
  "@eslint/compat": "1.4.0",
56
- "@eslint/js": "9.37.0",
57
+ "@eslint/js": "9.39.1",
57
58
  "@ianvs/prettier-plugin-sort-imports": "^4.7.0",
58
59
  "@types/eslint": "9.6.1",
59
- "@typescript-eslint/parser": "8.46.1",
60
+ "@typescript-eslint/parser": "8.50.0",
60
61
  "commander": "14.0.0",
61
62
  "eslint-config-prettier": "10.1.5",
62
- "eslint-plugin-oxlint": "1.23.0",
63
- "eslint-plugin-pnpm": "1.2.0",
64
- "eslint-plugin-svelte": "3.12.4",
65
- "eslint-plugin-unused-imports": "4.2.0",
66
- "globals": "16.4.0",
63
+ "eslint-plugin-oxlint": "1.34.0",
64
+ "eslint-plugin-pnpm": "1.4.3",
65
+ "eslint-plugin-svelte": "3.13.0",
66
+ "eslint-plugin-unused-imports": "4.3.0",
67
+ "globals": "16.5.0",
67
68
  "jsonc-eslint-parser": "2.4.0",
68
- "ora": "9.0.0",
69
+ "picospinner": "3.0.0",
69
70
  "prettier-plugin-sh": "^0.18.0",
70
71
  "prettier-plugin-svelte": "^3.4.0",
71
72
  "prettier-plugin-tailwindcss": "^0.7.0",
72
- "typescript-eslint": "8.46.1",
73
+ "typescript-eslint": "8.50.0",
73
74
  "yaml-eslint-parser": "1.3.0",
74
75
  "@kitql/helpers": "0.8.13"
75
76
  },