@nitra/cursor 1.8.170 → 1.8.173

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.
@@ -22,6 +22,7 @@ import {
22
22
  findUnsafeMssqlInListMissingEmptyGuardInText,
23
23
  isMssqlScanSourceFile
24
24
  } from './utils/mssql-pool-scan.mjs'
25
+ import { loadCursorIgnorePaths } from './utils/load-cursor-config.mjs'
25
26
  import { walkDir } from './utils/walkDir.mjs'
26
27
 
27
28
  const VERSION_PREFIX_RE = /^[\^~>=<]+\s*/u
@@ -35,14 +36,18 @@ const MIN_MSSQL_VERSION = { major: 12, minor: 5, patch: 0 }
35
36
  * @param {string} repoRoot абсолютний шлях до кореня репозиторію
36
37
  * @returns {Promise<string[]>} абсолютні шляхи, відсортовані за відносним шляхом
37
38
  */
38
- async function findAllPackageJsonPaths(repoRoot) {
39
+ async function findAllPackageJsonPaths(repoRoot, ignorePaths) {
39
40
  /** @type {string[]} */
40
41
  const paths = []
41
- await walkDir(repoRoot, absPath => {
42
- if (absPath.endsWith(`${sep}package.json`)) {
43
- paths.push(absPath)
44
- }
45
- })
42
+ await walkDir(
43
+ repoRoot,
44
+ absPath => {
45
+ if (absPath.endsWith(`${sep}package.json`)) {
46
+ paths.push(absPath)
47
+ }
48
+ },
49
+ ignorePaths
50
+ )
46
51
  paths.sort((a, b) => relative(repoRoot, a).localeCompare(relative(repoRoot, b)))
47
52
  return paths
48
53
  }
@@ -52,15 +57,19 @@ async function findAllPackageJsonPaths(repoRoot) {
52
57
  * @param {string} repoRoot абсолютний шлях до кореня репозиторію
53
58
  * @returns {Promise<string[]>} абсолютні шляхи, відсортовані за відносним шляхом
54
59
  */
55
- async function findAllSourcePathsForMssqlScan(repoRoot) {
60
+ async function findAllSourcePathsForMssqlScan(repoRoot, ignorePaths) {
56
61
  /** @type {string[]} */
57
62
  const paths = []
58
- await walkDir(repoRoot, absPath => {
59
- const rel = relative(repoRoot, absPath).split('\\').join('/')
60
- if (isMssqlScanSourceFile(rel)) {
61
- paths.push(absPath)
62
- }
63
- })
63
+ await walkDir(
64
+ repoRoot,
65
+ absPath => {
66
+ const rel = relative(repoRoot, absPath).split('\\').join('/')
67
+ if (isMssqlScanSourceFile(rel)) {
68
+ paths.push(absPath)
69
+ }
70
+ },
71
+ ignorePaths
72
+ )
64
73
  paths.sort((a, b) => relative(repoRoot, a).localeCompare(relative(repoRoot, b)))
65
74
  return paths
66
75
  }
@@ -253,8 +262,8 @@ function reportZeroMssqlSourceViolations(counters, pass) {
253
262
  * @param {(msg: string) => void} fail fail callback
254
263
  * @returns {Promise<void>}
255
264
  */
256
- async function auditMssqlSources(repoRoot, pass, fail) {
257
- const sourcePaths = await findAllSourcePathsForMssqlScan(repoRoot)
265
+ async function auditMssqlSources(repoRoot, ignorePaths, pass, fail) {
266
+ const sourcePaths = await findAllSourcePathsForMssqlScan(repoRoot, ignorePaths)
258
267
  if (sourcePaths.length === 0) {
259
268
  pass('js-mssql: немає JS/TS файлів для скану singleton ConnectionPool')
260
269
  return
@@ -291,7 +300,8 @@ export async function check() {
291
300
  return reporter.getExitCode()
292
301
  }
293
302
 
294
- const pkgJsonPaths = await findAllPackageJsonPaths(repoRoot)
303
+ const ignorePaths = await loadCursorIgnorePaths(repoRoot)
304
+ const pkgJsonPaths = await findAllPackageJsonPaths(repoRoot, ignorePaths)
295
305
  if (pkgJsonPaths.length === 0) {
296
306
  pass('js-mssql: package.json не знайдено — перевірку пропущено')
297
307
  return reporter.getExitCode()
@@ -307,7 +317,7 @@ export async function check() {
307
317
  pass(`js-mssql: всі знайдені dependencies.mssql відповідають мінімальній версії 12.5.0 (${found})`)
308
318
  }
309
319
 
310
- await auditMssqlSources(repoRoot, pass, fail)
320
+ await auditMssqlSources(repoRoot, ignorePaths, pass, fail)
311
321
 
312
322
  return reporter.getExitCode()
313
323
  }
@@ -36,6 +36,7 @@ import {
36
36
  isInsideConnDir,
37
37
  resolveConnDirFromPackageJson
38
38
  } from './utils/conn-imports-scan.mjs'
39
+ import { loadCursorIgnorePaths } from './utils/load-cursor-config.mjs'
39
40
  import { walkDir } from './utils/walkDir.mjs'
40
41
  import { getMonorepoPackageRootDirs } from './utils/workspaces.mjs'
41
42
 
@@ -56,15 +57,19 @@ function relPosix(absPackageRoot, absPath) {
56
57
  * @param {(msg: string) => void} fail callback при помилці
57
58
  * @returns {Promise<number>} кількість знайдених порушень
58
59
  */
59
- async function checkBunyanImports(absPackageRoot, label, fail) {
60
+ async function checkBunyanImports(absPackageRoot, ignorePaths, label, fail) {
60
61
  /** @type {string[]} */
61
62
  const sourcePaths = []
62
- await walkDir(absPackageRoot, absPath => {
63
- const rel = relPosix(absPackageRoot, absPath)
64
- if (!shouldSkipFileForBunyanScan(rel) && isBunyanScanSourceFile(rel)) {
65
- sourcePaths.push(absPath)
66
- }
67
- })
63
+ await walkDir(
64
+ absPackageRoot,
65
+ absPath => {
66
+ const rel = relPosix(absPackageRoot, absPath)
67
+ if (!shouldSkipFileForBunyanScan(rel) && isBunyanScanSourceFile(rel)) {
68
+ sourcePaths.push(absPath)
69
+ }
70
+ },
71
+ ignorePaths
72
+ )
68
73
 
69
74
  let violations = 0
70
75
  for (const absPath of sourcePaths) {
@@ -83,13 +88,17 @@ async function checkBunyanImports(absPackageRoot, label, fail) {
83
88
  * @param {string} absPackageRoot абсолютний шлях до кореня пакета
84
89
  * @returns {Promise<string[]>} абсолютні шляхи до файлів
85
90
  */
86
- async function collectSourceFiles(absPackageRoot) {
91
+ async function collectSourceFiles(absPackageRoot, ignorePaths) {
87
92
  /** @type {string[]} */
88
93
  const out = []
89
- await walkDir(absPackageRoot, absPath => {
90
- const rel = relPosix(absPackageRoot, absPath)
91
- if (isCheckEnvScanSourceFile(rel)) out.push(absPath)
92
- })
94
+ await walkDir(
95
+ absPackageRoot,
96
+ absPath => {
97
+ const rel = relPosix(absPackageRoot, absPath)
98
+ if (isCheckEnvScanSourceFile(rel)) out.push(absPath)
99
+ },
100
+ ignorePaths
101
+ )
93
102
  return out
94
103
  }
95
104
 
@@ -153,17 +162,17 @@ async function checkProcessEnvUsage(absPackageRoot, sourcePaths, label, fail) {
153
162
  * @param {(msg: string) => void} passFn успішне повідомлення (як у check-reporter)
154
163
  * @returns {Promise<void>} завершується після перевірок цього пакета
155
164
  */
156
- async function checkWorkspacePackage(rootDir, fail, passFn) {
165
+ async function checkWorkspacePackage(rootDir, ignorePaths, fail, passFn) {
157
166
  const label = `[${rootDir}] `
158
167
  const absPackageRoot = join(process.cwd(), rootDir)
159
168
  const pkgJson = await loadPackageJsonAndCheckBunyanDeps(rootDir, label, fail)
160
169
 
161
- const importViolations = await checkBunyanImports(absPackageRoot, label, fail)
170
+ const importViolations = await checkBunyanImports(absPackageRoot, ignorePaths, label, fail)
162
171
  if (importViolations === 0) {
163
172
  passFn(`${label}немає імпортів '@nitra/bunyan' / 'bunyan' у джерелах`)
164
173
  }
165
174
 
166
- const sourcePaths = await collectSourceFiles(absPackageRoot)
175
+ const sourcePaths = await collectSourceFiles(absPackageRoot, ignorePaths)
167
176
 
168
177
  const connViolations = await checkConnImports(absPackageRoot, sourcePaths, pkgJson, label, fail)
169
178
  if (connViolations === 0) {
@@ -245,8 +254,9 @@ export async function check() {
245
254
  return reporter.getExitCode()
246
255
  }
247
256
 
257
+ const ignorePaths = await loadCursorIgnorePaths(process.cwd())
248
258
  for (const r of workspaceRoots) {
249
- await checkWorkspacePackage(r, fail, pass)
259
+ await checkWorkspacePackage(r, ignorePaths, fail, pass)
250
260
  }
251
261
 
252
262
  return reporter.getExitCode()
@@ -109,6 +109,7 @@ import { basename, dirname, join, relative, resolve } from 'node:path'
109
109
  import { isSeq, parseAllDocuments, parseDocument } from 'yaml'
110
110
 
111
111
  import { createCheckReporter } from './utils/check-reporter.mjs'
112
+ import { loadCursorIgnorePaths } from './utils/load-cursor-config.mjs'
112
113
  import { walkDir } from './utils/walkDir.mjs'
113
114
 
114
115
  /** Версія набору схем yannh — узгоджено з k8s.mdc */
@@ -1581,16 +1582,21 @@ export function baseKustomizationNamespaceViolation(obj) {
1581
1582
  /**
1582
1583
  * Збирає всі `*.yaml` та `*.yml` під деревом від кореня cwd, якщо шлях містить сегмент `k8s` (для `.yml` далі — помилка перейменування).
1583
1584
  * @param {string} root корінь репозиторію (cwd)
1585
+ * @param {string[]} [ignorePaths=[]] шляхи каталогів, повністю виключених з обходу
1584
1586
  * @returns {Promise<string[]>} відсортовані абсолютні шляхи до файлів
1585
1587
  */
1586
- async function findK8sYamlFiles(root) {
1588
+ async function findK8sYamlFiles(root, ignorePaths = []) {
1587
1589
  /** @type {string[]} */
1588
1590
  const out = []
1589
- await walkDir(root, p => {
1590
- if (!pathHasK8sSegment(p)) return
1591
- if (!YAML_EXTENSION_RE.test(p)) return
1592
- out.push(p)
1593
- })
1591
+ await walkDir(
1592
+ root,
1593
+ p => {
1594
+ if (!pathHasK8sSegment(p)) return
1595
+ if (!YAML_EXTENSION_RE.test(p)) return
1596
+ out.push(p)
1597
+ },
1598
+ ignorePaths
1599
+ )
1594
1600
 
1595
1601
  return out.toSorted((a, b) => a.localeCompare(b))
1596
1602
  }
@@ -1659,12 +1665,13 @@ export function classifyBackendConfigManifestPresence(body) {
1659
1665
  /**
1660
1666
  * Видаляє під **`k8s`** YAML-файли, що містять **лише** ресурси **BackendConfig**; змішані файли — `fail`.
1661
1667
  * @param {string} root корінь репозиторію
1668
+ * @param {string[]} ignorePaths шляхи каталогів, повністю виключених з обходу
1662
1669
  * @param {(msg: string) => void} fail реєстрація порушення
1663
1670
  * @param {(msg: string) => void} pass реєстрація успіху
1664
1671
  * @returns {Promise<void>}
1665
1672
  */
1666
- async function removeBackendConfigOnlyK8sYamlFiles(root, fail, pass) {
1667
- const yamlFiles = await findK8sYamlFiles(root)
1673
+ async function removeBackendConfigOnlyK8sYamlFiles(root, ignorePaths, fail, pass) {
1674
+ const yamlFiles = await findK8sYamlFiles(root, ignorePaths)
1668
1675
  for (const abs of yamlFiles) {
1669
1676
  const rel = (relative(root, abs) || abs).replaceAll('\\', '/')
1670
1677
  try {
@@ -1736,12 +1743,13 @@ export function replaceBatchV1beta1ApiVersionInYamlText(raw) {
1736
1743
  /**
1737
1744
  * Проходить усі `*.yaml` / `*.yml` під сегментом `k8s` і на диску застосовує **`replaceBatchV1beta1ApiVersionInYamlText`**.
1738
1745
  * @param {string} root корінь репозиторію
1746
+ * @param {string[]} ignorePaths шляхи каталогів, повністю виключених з обходу
1739
1747
  * @param {(msg: string) => void} fail колбек повідомлення про помилку
1740
1748
  * @param {(msg: string) => void} pass колбек успішного повідомлення
1741
1749
  * @returns {Promise<void>}
1742
1750
  */
1743
- async function rewriteBatchV1beta1ApiVersionInK8sYamlFiles(root, fail, pass) {
1744
- const yamlFiles = await findK8sYamlFiles(root)
1751
+ async function rewriteBatchV1beta1ApiVersionInK8sYamlFiles(root, ignorePaths, fail, pass) {
1752
+ const yamlFiles = await findK8sYamlFiles(root, ignorePaths)
1745
1753
  for (const abs of yamlFiles) {
1746
1754
  const rel = (relative(root, abs) || abs).replaceAll('\\', '/')
1747
1755
  try {
@@ -5762,12 +5770,13 @@ export async function check() {
5762
5770
  const { pass, fail } = reporter
5763
5771
 
5764
5772
  const root = process.cwd()
5773
+ const ignorePaths = await loadCursorIgnorePaths(root)
5765
5774
 
5766
- await rewriteBatchV1beta1ApiVersionInK8sYamlFiles(root, fail, pass)
5775
+ await rewriteBatchV1beta1ApiVersionInK8sYamlFiles(root, ignorePaths, fail, pass)
5767
5776
 
5768
- await removeBackendConfigOnlyK8sYamlFiles(root, fail, pass)
5777
+ await removeBackendConfigOnlyK8sYamlFiles(root, ignorePaths, fail, pass)
5769
5778
 
5770
- const yamlFiles = await findK8sYamlFiles(root)
5779
+ const yamlFiles = await findK8sYamlFiles(root, ignorePaths)
5771
5780
 
5772
5781
  if (yamlFiles.length === 0) {
5773
5782
  pass('Немає *.yaml під k8s — перевірку $schema пропущено')
@@ -19,6 +19,7 @@ import { basename, dirname, join, relative } from 'node:path'
19
19
 
20
20
  import { findDockerfilePaths } from './check-docker.mjs'
21
21
  import { createCheckReporter } from './utils/check-reporter.mjs'
22
+ import { loadCursorIgnorePaths } from './utils/load-cursor-config.mjs'
22
23
  import { walkDir } from './utils/walkDir.mjs'
23
24
 
24
25
  const LINE_SPLIT_RE = /\r?\n/u
@@ -36,15 +37,19 @@ const GZIP_EXTENSION_RE = /\*\.(?:js|css)/u
36
37
  * @param {string} root корінь cwd
37
38
  * @returns {Promise<string[]>} відсортовані абсолютні шляхи до шаблонів
38
39
  */
39
- export async function findDefaultConfTemplatePaths(root) {
40
+ export async function findDefaultConfTemplatePaths(root, ignorePaths = []) {
40
41
  /** @type {string[]} */
41
42
  const out = []
42
- await walkDir(root, p => {
43
- if (basename(p) !== 'default.conf.template') return
44
- const rel = relative(root, p).replaceAll('\\', '/')
45
- if (rel.includes('tests/fixtures/')) return
46
- out.push(p)
47
- })
43
+ await walkDir(
44
+ root,
45
+ p => {
46
+ if (basename(p) !== 'default.conf.template') return
47
+ const rel = relative(root, p).replaceAll('\\', '/')
48
+ if (rel.includes('tests/fixtures/')) return
49
+ out.push(p)
50
+ },
51
+ ignorePaths
52
+ )
48
53
  return out.toSorted((a, b) => a.localeCompare(b))
49
54
  }
50
55
 
@@ -54,12 +59,16 @@ export async function findDefaultConfTemplatePaths(root) {
54
59
  * @param {string} root корінь обходу (зазвичай cwd репозиторію)
55
60
  * @returns {Promise<{ renamed: string[], overwritten: string[] }>} відносні шляхи до обробленого **default.tpl.conf** (для звіту)
56
61
  */
57
- export async function migrateDefaultTplConfFiles(root) {
62
+ export async function migrateDefaultTplConfFiles(root, ignorePaths = []) {
58
63
  /** @type {string[]} */
59
64
  const oldPaths = []
60
- await walkDir(root, p => {
61
- if (basename(p) === 'default.tpl.conf') oldPaths.push(p)
62
- })
65
+ await walkDir(
66
+ root,
67
+ p => {
68
+ if (basename(p) === 'default.tpl.conf') oldPaths.push(p)
69
+ },
70
+ ignorePaths
71
+ )
63
72
  oldPaths.sort((a, b) => a.localeCompare(b))
64
73
 
65
74
  /** @type {string[]} */
@@ -316,8 +325,8 @@ async function checkTemplateFile(abs, root, passFn, failFn) {
316
325
  * @param {(msg: string) => void} passFn callback при успішній перевірці
317
326
  * @param {(msg: string) => void} failFn callback при помилці
318
327
  */
319
- async function checkDockerfiles(root, passFn, failFn) {
320
- const dockerPaths = await findDockerfilePaths(root)
328
+ async function checkDockerfiles(root, ignorePaths, passFn, failFn) {
329
+ const dockerPaths = await findDockerfilePaths(root, ignorePaths)
321
330
  if (dockerPaths.length === 0) {
322
331
  failFn(
323
332
  'Є default.conf.template, але немає Dockerfile / Containerfile — додай gzip для статики та envsubst (див. nginx-default-tpl.mdc)'
@@ -380,8 +389,9 @@ export async function check() {
380
389
  const { pass, fail } = reporter
381
390
 
382
391
  const root = process.cwd()
392
+ const ignorePaths = await loadCursorIgnorePaths(root)
383
393
 
384
- const { renamed: tplRenamed, overwritten: tplOverwritten } = await migrateDefaultTplConfFiles(root)
394
+ const { renamed: tplRenamed, overwritten: tplOverwritten } = await migrateDefaultTplConfFiles(root, ignorePaths)
385
395
  for (const rel of tplRenamed) {
386
396
  pass(`Перейменовано default.tpl.conf → default.conf.template: ${rel}`)
387
397
  }
@@ -389,7 +399,7 @@ export async function check() {
389
399
  pass(`Перезаписано default.conf.template змістом default.tpl.conf: ${rel}`)
390
400
  }
391
401
 
392
- const templates = await findDefaultConfTemplatePaths(root)
402
+ const templates = await findDefaultConfTemplatePaths(root, ignorePaths)
393
403
 
394
404
  if (templates.length === 0) {
395
405
  pass('Немає default.conf.template — перевірку nginx-default-tpl пропущено')
@@ -402,7 +412,7 @@ export async function check() {
402
412
  await checkTemplateFile(abs, root, pass, fail)
403
413
  }
404
414
 
405
- await checkDockerfiles(root, pass, fail)
415
+ await checkDockerfiles(root, ignorePaths, pass, fail)
406
416
  await checkVscodeNginx(pass, fail)
407
417
 
408
418
  return reporter.getExitCode()
@@ -26,6 +26,7 @@ import {
26
26
  pushHasMainBranch,
27
27
  pushPathsIncludeNpmGlob
28
28
  } from './utils/gha-workflow.mjs'
29
+ import { loadCursorIgnorePaths } from './utils/load-cursor-config.mjs'
29
30
  import { walkDir } from './utils/walkDir.mjs'
30
31
 
31
32
  const TYPES_FILE_RE = /^\.\/types\/.+\.d\.(ts|mts)$/
@@ -43,17 +44,21 @@ const CHANGELOG_PATH = 'npm/CHANGELOG.md'
43
44
  * Чи є під `npm/src` хоча б один `.js` (рекурсивно).
44
45
  * @returns {Promise<boolean>} `true`, якщо знайдено хоча б один `.js`
45
46
  */
46
- async function npmSrcTreeHasJsFile() {
47
+ async function npmSrcTreeHasJsFile(ignorePaths = []) {
47
48
  const root = 'npm/src'
48
49
  if (!existsSync(root)) {
49
50
  return false
50
51
  }
51
52
  let found = false
52
- await walkDir(root, p => {
53
- if (p.endsWith('.js')) {
54
- found = true
55
- }
56
- })
53
+ await walkDir(
54
+ root,
55
+ p => {
56
+ if (p.endsWith('.js')) {
57
+ found = true
58
+ }
59
+ },
60
+ ignorePaths
61
+ )
57
62
  return found
58
63
  }
59
64
 
@@ -387,7 +392,8 @@ export async function check() {
387
392
 
388
393
  await checkNpmModuleBasicStructure(pass, fail)
389
394
 
390
- const useSrcJsLayout = await npmSrcTreeHasJsFile()
395
+ const ignorePaths = await loadCursorIgnorePaths(process.cwd())
396
+ const useSrcJsLayout = await npmSrcTreeHasJsFile(ignorePaths)
391
397
 
392
398
  await checkNpmPackageJson(useSrcJsLayout, pass, fail)
393
399
 
@@ -20,6 +20,7 @@ import {
20
20
  isVueImportScanSourceFile,
21
21
  shouldSkipFileForVueImportScan
22
22
  } from './utils/vue-forbidden-imports.mjs'
23
+ import { loadCursorIgnorePaths } from './utils/load-cursor-config.mjs'
23
24
  import { walkDir } from './utils/walkDir.mjs'
24
25
  import { getMonorepoPackageRootDirs } from './utils/workspaces.mjs'
25
26
 
@@ -113,14 +114,18 @@ async function collectEsbuildMatchesInFiles(absPackageRoot, files, maxMatches) {
113
114
  * @param {(msg: string) => void} passFn callback при успішній перевірці
114
115
  * @param {(msg: string) => void} fail callback при помилці
115
116
  */
116
- async function checkEsbuildMentions(rootDir, absPackageRoot, prefix, passFn, fail) {
117
+ async function checkEsbuildMentions(rootDir, absPackageRoot, ignorePaths, prefix, passFn, fail) {
117
118
  /** @type {{ rel: string }[]} */
118
119
  const candidates = []
119
- await walkDir(absPackageRoot, absPath => {
120
- const rel = relative(absPackageRoot, absPath).split('\\').join('/')
121
- if (!isEsbuildScanFile(rel)) return
122
- candidates.push({ rel })
123
- })
120
+ await walkDir(
121
+ absPackageRoot,
122
+ absPath => {
123
+ const rel = relative(absPackageRoot, absPath).split('\\').join('/')
124
+ if (!isEsbuildScanFile(rel)) return
125
+ candidates.push({ rel })
126
+ },
127
+ ignorePaths
128
+ )
124
129
 
125
130
  const maxMatches = 30
126
131
  const matches = await collectEsbuildMatchesInFiles(absPackageRoot, candidates, maxMatches)
@@ -308,7 +313,7 @@ async function checkViteConfig(rootDir, prefix, passFn, fail) {
308
313
  * @param {(msg: string) => void} passFn callback при успішній перевірці
309
314
  * @param {(msg: string) => void} fail callback при помилці
310
315
  */
311
- async function checkVueImportViolations(rootDir, absPackageRoot, hasVueAutoImport, prefix, passFn, fail) {
316
+ async function checkVueImportViolations(rootDir, absPackageRoot, ignorePaths, hasVueAutoImport, prefix, passFn, fail) {
312
317
  if (!hasVueAutoImport) {
313
318
  passFn(
314
319
  `${prefix}value-імпорти з 'vue' не заборонені — спершу додай 'vue' до AutoImport.imports у vite.config`
@@ -317,12 +322,16 @@ async function checkVueImportViolations(rootDir, absPackageRoot, hasVueAutoImpor
317
322
  }
318
323
  /** @type {string[]} */
319
324
  const sourcePaths = []
320
- await walkDir(absPackageRoot, absPath => {
321
- const rel = relative(absPackageRoot, absPath).split('\\').join('/')
322
- if (!shouldSkipFileForVueImportScan(rel) && isVueImportScanSourceFile(rel)) {
323
- sourcePaths.push(absPath)
324
- }
325
- })
325
+ await walkDir(
326
+ absPackageRoot,
327
+ absPath => {
328
+ const rel = relative(absPackageRoot, absPath).split('\\').join('/')
329
+ if (!shouldSkipFileForVueImportScan(rel) && isVueImportScanSourceFile(rel)) {
330
+ sourcePaths.push(absPath)
331
+ }
332
+ },
333
+ ignorePaths
334
+ )
326
335
 
327
336
  let importViolations = 0
328
337
  for (const absPath of sourcePaths) {
@@ -347,7 +356,7 @@ async function checkVueImportViolations(rootDir, absPackageRoot, hasVueAutoImpor
347
356
  * @param {(msg: string) => void} passFn успішне повідомлення (як у check-reporter)
348
357
  * @returns {Promise<void>} завершується після перевірок залежностей, `vite.config` і сканування джерел на імпорти з `vue`
349
358
  */
350
- async function checkVuePackage(rootDir, fail, passFn) {
359
+ async function checkVuePackage(rootDir, ignorePaths, fail, passFn) {
351
360
  const prefix = `[${packageLabel(rootDir)}] `
352
361
  const pkg = JSON.parse(await readFile(join(rootDir, 'package.json'), 'utf8'))
353
362
  const deps = pkg.dependencies || {}
@@ -387,8 +396,8 @@ async function checkVuePackage(rootDir, fail, passFn) {
387
396
  )
388
397
 
389
398
  const { hasVueAutoImport } = await checkViteConfig(rootDir, prefix, passFn, fail)
390
- await checkVueImportViolations(rootDir, join(process.cwd(), rootDir), hasVueAutoImport, prefix, passFn, fail)
391
- await checkEsbuildMentions(rootDir, join(process.cwd(), rootDir), prefix, passFn, fail)
399
+ await checkVueImportViolations(rootDir, join(process.cwd(), rootDir), ignorePaths, hasVueAutoImport, prefix, passFn, fail)
400
+ await checkEsbuildMentions(rootDir, join(process.cwd(), rootDir), ignorePaths, prefix, passFn, fail)
392
401
  }
393
402
 
394
403
  /**
@@ -446,8 +455,9 @@ export async function check() {
446
455
 
447
456
  await checkVueVolarRecommendation(pass, fail)
448
457
 
458
+ const ignorePaths = await loadCursorIgnorePaths(process.cwd())
449
459
  for (const r of vueRoots) {
450
- await checkVuePackage(r, fail, pass)
460
+ await checkVuePackage(r, ignorePaths, fail, pass)
451
461
  }
452
462
 
453
463
  return reporter.getExitCode()
@@ -14,6 +14,7 @@ import { rename } from 'node:fs/promises'
14
14
  import { cwd } from 'node:process'
15
15
  import { relative, resolve } from 'node:path'
16
16
 
17
+ import { loadCursorIgnorePaths } from './utils/load-cursor-config.mjs'
17
18
  import { walkDir } from './utils/walkDir.mjs'
18
19
 
19
20
  const K8S_YML_RE = /\.yml$/iu
@@ -69,37 +70,41 @@ export function replaceExtension(relPosix, newExt) {
69
70
  * @param {string} rootAbs абсолютний корінь репозиторію
70
71
  * @returns {Promise<Array<{ kind: 'k8s' | 'github', fromAbs: string, toAbs: string, relFrom: string, relTo: string }>>} відсортовані операції перейменування без запису на диск
71
72
  */
72
- async function collectRenameOps(rootAbs) {
73
+ async function collectRenameOps(rootAbs, ignorePaths) {
73
74
  /** @type {Array<{ kind: 'k8s' | 'github', fromAbs: string, toAbs: string, relFrom: string, relTo: string }>} */
74
75
  const ops = []
75
76
 
76
- await walkDir(rootAbs, fileAbs => {
77
- const rel = posixRelFromRoot(rootAbs, fileAbs)
78
- if (rel === null) return
79
- if (pathMatchesK8sYml(rel)) {
80
- const relTo = replaceExtension(rel, '.yaml')
81
- if (relTo === rel) return
82
- ops.push({
83
- kind: 'k8s',
84
- fromAbs: resolve(rootAbs, rel),
85
- toAbs: resolve(rootAbs, relTo),
86
- relFrom: rel,
87
- relTo
88
- })
89
- return
90
- }
91
- if (pathMatchesGithubYaml(rel)) {
92
- const relTo = replaceExtension(rel, '.yml')
93
- if (relTo === rel) return
94
- ops.push({
95
- kind: 'github',
96
- fromAbs: resolve(rootAbs, rel),
97
- toAbs: resolve(rootAbs, relTo),
98
- relFrom: rel,
99
- relTo
100
- })
101
- }
102
- })
77
+ await walkDir(
78
+ rootAbs,
79
+ fileAbs => {
80
+ const rel = posixRelFromRoot(rootAbs, fileAbs)
81
+ if (rel === null) return
82
+ if (pathMatchesK8sYml(rel)) {
83
+ const relTo = replaceExtension(rel, '.yaml')
84
+ if (relTo === rel) return
85
+ ops.push({
86
+ kind: 'k8s',
87
+ fromAbs: resolve(rootAbs, rel),
88
+ toAbs: resolve(rootAbs, relTo),
89
+ relFrom: rel,
90
+ relTo
91
+ })
92
+ return
93
+ }
94
+ if (pathMatchesGithubYaml(rel)) {
95
+ const relTo = replaceExtension(rel, '.yml')
96
+ if (relTo === rel) return
97
+ ops.push({
98
+ kind: 'github',
99
+ fromAbs: resolve(rootAbs, rel),
100
+ toAbs: resolve(rootAbs, relTo),
101
+ relFrom: rel,
102
+ relTo
103
+ })
104
+ }
105
+ },
106
+ ignorePaths
107
+ )
103
108
 
104
109
  ops.sort((a, b) => {
105
110
  const ko = (a.kind === 'k8s' ? 0 : 1) - (b.kind === 'k8s' ? 0 : 1)
@@ -119,7 +124,8 @@ async function collectRenameOps(rootAbs) {
119
124
  export async function renameYamlExtensions(root, options = {}) {
120
125
  const dryRun = options.dryRun === true
121
126
  const rootAbs = resolve(root)
122
- const ops = await collectRenameOps(rootAbs)
127
+ const ignorePaths = await loadCursorIgnorePaths(rootAbs)
128
+ const ops = await collectRenameOps(rootAbs, ignorePaths)
123
129
 
124
130
  /** @type { { relFrom: string, relTo: string }[]} */
125
131
  const renamed = []
@@ -12,6 +12,7 @@ import { basename } from 'node:path'
12
12
  import { isRunAsCli } from './cli-entry.mjs'
13
13
  import { lintDockerfileWithHadolint, posixRel } from './utils/docker-hadolint.mjs'
14
14
  import { createCheckReporter } from './utils/check-reporter.mjs'
15
+ import { loadCursorIgnorePaths } from './utils/load-cursor-config.mjs'
15
16
  import { walkDir } from './utils/walkDir.mjs'
16
17
 
17
18
  /**
@@ -30,12 +31,16 @@ export function isLintDockerfileName(name) {
30
31
  * @param {string} root корінь репозиторію
31
32
  * @returns {Promise<string[]>} відсортовані абсолютні шляхи
32
33
  */
33
- export async function findLintDockerfilePaths(root) {
34
+ export async function findLintDockerfilePaths(root, ignorePaths = []) {
34
35
  /** @type {string[]} */
35
36
  const out = []
36
- await walkDir(root, p => {
37
- if (isLintDockerfileName(basename(p))) out.push(p)
38
- })
37
+ await walkDir(
38
+ root,
39
+ p => {
40
+ if (isLintDockerfileName(basename(p))) out.push(p)
41
+ },
42
+ ignorePaths
43
+ )
39
44
  return out.toSorted((a, b) => a.localeCompare(b))
40
45
  }
41
46
 
@@ -48,7 +53,8 @@ async function main() {
48
53
  const { pass, fail } = reporter
49
54
 
50
55
  const root = process.cwd()
51
- const files = await findLintDockerfilePaths(root)
56
+ const ignorePaths = await loadCursorIgnorePaths(root)
57
+ const files = await findLintDockerfilePaths(root, ignorePaths)
52
58
 
53
59
  if (files.length === 0) {
54
60
  pass('lint-docker: немає Dockerfile / *.Dockerfile — hadolint пропущено')