@nitra/cursor 1.10.0 → 1.11.1
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/CHANGELOG.md +42 -1
- package/bin/n-cursor.js +31 -31
- package/package.json +2 -4
- package/rules/abie/js/applies/check.mjs +24 -0
- package/rules/abie/js/env_dns/check.mjs +53 -0
- package/rules/abie/js/firebase_hosting/check.mjs +49 -0
- package/rules/abie/js/hc_pairing/check.mjs +58 -0
- package/rules/abie/js/ua_http_route/check.mjs +86 -0
- package/rules/abie/js/ua_node_selector/check.mjs +65 -0
- package/rules/abie/policy/base_deployment_preem/target.json +10 -0
- package/rules/abie/policy/clean_merged_ignore_branches/target.json +4 -0
- package/rules/abie/policy/health_check_policy/target.json +4 -0
- package/rules/abie/policy/http_route_base/target.json +4 -0
- package/rules/abie/utils/enabled.mjs +35 -0
- package/rules/abie/utils/env-dns.mjs +81 -0
- package/rules/abie/utils/hc-yaml.mjs +27 -0
- package/rules/abie/utils/http-route.mjs +93 -0
- package/rules/abie/utils/k8s-tree.mjs +102 -0
- package/rules/abie/utils/kustomization-patches.mjs +224 -0
- package/rules/abie/utils/overlay-paths.mjs +97 -0
- package/rules/abie/utils/yaml.mjs +72 -0
- package/rules/adr/js/{check.mjs → hooks/check.mjs} +2 -2
- package/rules/adr/policy/settings_json/target.json +4 -0
- package/rules/adr/policy/settings_local_json/target.json +4 -0
- package/rules/bun/js/{check.mjs → layout/check.mjs} +1 -1
- package/rules/bun/policy/bunfig/target.json +4 -0
- package/rules/bun/policy/package_json/target.json +4 -0
- package/rules/capacitor/js/{check.mjs → platforms/check.mjs} +1 -1
- package/rules/capacitor/policy/package_json/target.json +4 -0
- package/rules/changelog/js/{check.mjs → consistency/check.mjs} +2 -2
- package/rules/docker/js/{check.mjs → lint/check.mjs} +5 -5
- package/rules/docker/policy/lint_docker_yml/target.json +4 -0
- package/rules/docker/policy/package_json/target.json +4 -0
- package/rules/ga/js/lint.mjs +1 -1
- package/rules/ga/js/{check.mjs → workflows/check.mjs} +4 -4
- package/rules/graphql/js/{check.mjs → tooling/check.mjs} +5 -5
- package/rules/hasura/js/{check.mjs → internal_urls/check.mjs} +4 -4
- package/rules/hasura/policy/svc_hl/target.json +4 -0
- package/rules/image-avif/js/{check.mjs → avif_generation/check.mjs} +5 -5
- package/rules/image-avif/policy/package_json/target.json +4 -0
- package/rules/image-compress/js/{check.mjs → package_setup/check.mjs} +1 -1
- package/rules/image-compress/policy/package_json/target.json +4 -0
- package/rules/js-bun-db/js/{check.mjs → safety/check.mjs} +5 -5
- package/rules/js-bun-db/policy/package_json/target.json +4 -0
- package/rules/js-bun-redis/js/{check.mjs → imports/check.mjs} +4 -4
- package/rules/js-bun-redis/policy/package_json/target.json +4 -0
- package/rules/js-lint/js/{check.mjs → tooling/check.mjs} +16 -2
- package/rules/js-lint/policy/lint_js_yml/target.json +4 -0
- package/rules/js-lint/policy/package_json/target.json +4 -0
- package/rules/js-mssql/js/{check.mjs → deps/check.mjs} +5 -5
- package/rules/js-mssql/policy/package_json/target.json +4 -0
- package/rules/js-run/js/{check.mjs → runtime/check.mjs} +10 -10
- package/rules/js-run/policy/configmap/target.json +4 -0
- package/rules/js-run/policy/package_json/target.json +4 -0
- package/rules/k8s/js/{check.mjs → manifests/check.mjs} +4 -4
- package/rules/k8s/policy/base_kustomization/target.json +4 -0
- package/rules/k8s/policy/base_manifest/target.json +10 -0
- package/rules/k8s/policy/gateway/target.json +4 -0
- package/rules/k8s/policy/hpa_pdb/target.json +4 -0
- package/rules/k8s/policy/kustomization/target.json +4 -0
- package/rules/k8s/policy/manifest/target.json +4 -0
- package/rules/k8s/policy/svc_hl_yaml/target.json +4 -0
- package/rules/k8s/policy/svc_yaml/target.json +4 -0
- package/rules/nginx-default-tpl/js/{check.mjs → template/check.mjs} +5 -5
- package/rules/npm-module/js/{check.mjs → package_structure/check.mjs} +4 -4
- package/rules/npm-module/policy/emit_types_config/target.json +4 -0
- package/rules/npm-module/policy/npm_package_json/target.json +4 -0
- package/rules/npm-module/policy/npm_publish_yml/target.json +4 -0
- package/rules/npm-module/policy/root_package_json/target.json +4 -0
- package/rules/php/js/{check.mjs → tooling/check.mjs} +1 -1
- package/rules/php/policy/lint_php_yml/target.json +4 -0
- package/rules/php/policy/package_json/target.json +4 -0
- package/rules/rego/js/applies/check.mjs +54 -0
- package/rules/rego/policy/package_json/target.json +5 -0
- package/rules/rego/policy/vscode_extensions/target.json +5 -0
- package/rules/rego/policy/vscode_settings/target.json +5 -0
- package/rules/style-lint/js/{check.mjs → tooling/check.mjs} +1 -1
- package/rules/style-lint/policy/lint_style_yml/target.json +4 -0
- package/rules/style-lint/policy/package_json/target.json +4 -0
- package/rules/style-lint/policy/vscode_extensions/target.json +4 -0
- package/rules/style-lint/policy/vscode_settings/target.json +4 -0
- package/rules/tauri/js/{check.mjs → tooling/check.mjs} +2 -2
- package/rules/text/js/{check.mjs → formatting/check.mjs} +2 -2
- package/rules/text/policy/cspell/target.json +4 -0
- package/rules/text/policy/markdownlint/target.json +4 -0
- package/rules/text/policy/oxfmtrc/target.json +4 -0
- package/rules/text/policy/package_json/target.json +4 -0
- package/rules/text/policy/vscode_extensions/target.json +4 -0
- package/rules/text/policy/vscode_settings/target.json +4 -0
- package/rules/vue/js/{check.mjs → packages/check.mjs} +5 -5
- package/rules/vue/policy/package_json/target.json +4 -0
- package/schemas/target.json +58 -0
- package/scripts/lint-conftest.mjs +65 -414
- package/scripts/utils/discover-checkable-rules.mjs +106 -0
- package/scripts/utils/resolve-target-files.mjs +109 -0
- package/scripts/utils/run-rule.mjs +127 -0
- package/rules/abie/js/check.mjs +0 -1152
- package/rules/rego/js/check.mjs +0 -106
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Спільні YAML-хелпери для abie-перевірок: парсинг документів з опційним modeline,
|
|
3
|
+
* BOM-strip, regex для `# yaml-language-server: $schema=` і поділу на рядки.
|
|
4
|
+
*/
|
|
5
|
+
import { readFile } from 'node:fs/promises'
|
|
6
|
+
|
|
7
|
+
import { parseAllDocuments } from 'yaml'
|
|
8
|
+
|
|
9
|
+
export const MODELINE_RE = /^#\s*yaml-language-server:\s*\$schema=(\S+)\s*$/
|
|
10
|
+
export const LINE_SPLIT_RE = /\r?\n/u
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Прибирає BOM на початку файлу.
|
|
14
|
+
* @param {string} s вміст
|
|
15
|
+
* @returns {string}
|
|
16
|
+
*/
|
|
17
|
+
export function stripBom(s) {
|
|
18
|
+
return s.startsWith('') ? s.slice(1) : s
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Чи YAML-документ — це `kind: Deployment`.
|
|
23
|
+
* @param {unknown} obj корінь YAML-документа
|
|
24
|
+
* @returns {boolean}
|
|
25
|
+
*/
|
|
26
|
+
export function isDeploymentDoc(obj) {
|
|
27
|
+
return (
|
|
28
|
+
obj !== null &&
|
|
29
|
+
typeof obj === 'object' &&
|
|
30
|
+
!Array.isArray(obj) &&
|
|
31
|
+
/** @type {Record<string, unknown>} */ (obj).kind === 'Deployment'
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* No-op fail-handler для функцій, що мовчки повертають null/[] при помилці парсингу.
|
|
37
|
+
* @param {string} _msg ігнорується
|
|
38
|
+
*/
|
|
39
|
+
export const silentFail = _msg => {
|
|
40
|
+
/* silent — пошкоджені файли ловить check-k8s */
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Зчитує і парсить YAML-документи з файлу. BOM і modeline (перший рядок `$schema`)
|
|
45
|
+
* автоматично прибираються перед `parseAllDocuments`. При помилці читання/парсингу
|
|
46
|
+
* викликає `failFn` і повертає `null`.
|
|
47
|
+
* @param {string} abs абсолютний шлях
|
|
48
|
+
* @param {string} rel відносний (для повідомлень)
|
|
49
|
+
* @param {(msg: string) => void} failFn
|
|
50
|
+
* @returns {Promise<import('yaml').Document[] | null>}
|
|
51
|
+
*/
|
|
52
|
+
export async function readAndParseYamlDocs(abs, rel, failFn) {
|
|
53
|
+
let raw
|
|
54
|
+
try {
|
|
55
|
+
raw = await readFile(abs, 'utf8')
|
|
56
|
+
} catch (error) {
|
|
57
|
+
const msg = error instanceof Error ? error.message : String(error)
|
|
58
|
+
failFn(`${rel}: не вдалося прочитати (${msg})`)
|
|
59
|
+
return null
|
|
60
|
+
}
|
|
61
|
+
const body = stripBom(raw)
|
|
62
|
+
const lines = body.split(LINE_SPLIT_RE)
|
|
63
|
+
const first = lines[0] ?? ''
|
|
64
|
+
const rest = MODELINE_RE.test(first.trim()) ? lines.slice(1).join('\n') : body
|
|
65
|
+
try {
|
|
66
|
+
return parseAllDocuments(rest)
|
|
67
|
+
} catch (error) {
|
|
68
|
+
const msg = error instanceof Error ? error.message : String(error)
|
|
69
|
+
failFn(`${rel}: YAML (${msg})`)
|
|
70
|
+
return null
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -22,7 +22,7 @@ import { delimiter, dirname, join } from 'node:path'
|
|
|
22
22
|
import { env } from 'node:process'
|
|
23
23
|
import { fileURLToPath } from 'node:url'
|
|
24
24
|
|
|
25
|
-
import { createCheckReporter } from '
|
|
25
|
+
import { createCheckReporter } from '../../../../scripts/utils/check-reporter.mjs'
|
|
26
26
|
|
|
27
27
|
/** Один hook-артефакт: bash-скрипт + його лог-файл, які перевіряємо однотипно. */
|
|
28
28
|
const HOOK_ARTIFACTS = /** @type {const} */ ([
|
|
@@ -34,7 +34,7 @@ const PROJECT_SETTINGS_PATH = '.claude/settings.json'
|
|
|
34
34
|
const EOL_RE = /\r?\n/u
|
|
35
35
|
|
|
36
36
|
const here = dirname(fileURLToPath(import.meta.url))
|
|
37
|
-
const BUNDLED_HOOKS_DIR = join(here, '..', '..', '..', '.claude-template', 'hooks')
|
|
37
|
+
const BUNDLED_HOOKS_DIR = join(here, '..', '..', '..', '..', '.claude-template', 'hooks')
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
40
|
* Відносний шлях до managed hook-скрипта у проєкті.
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
import { existsSync } from 'node:fs'
|
|
19
19
|
import { readFile } from 'node:fs/promises'
|
|
20
20
|
|
|
21
|
-
import { createCheckReporter } from '
|
|
21
|
+
import { createCheckReporter } from '../../../../scripts/utils/check-reporter.mjs'
|
|
22
22
|
|
|
23
23
|
// Перевірка `devDependencies` кореневого `package.json` (дозволено лише `@nitra/*`)
|
|
24
24
|
// — у rego (`npm/policy/bun/package_json/`). JS-копії `isAllowedRootDevDependency`
|
|
@@ -25,7 +25,7 @@ import { existsSync } from 'node:fs'
|
|
|
25
25
|
import { readdir, readFile } from 'node:fs/promises'
|
|
26
26
|
import { join, relative } from 'node:path'
|
|
27
27
|
|
|
28
|
-
import { createCheckReporter } from '
|
|
28
|
+
import { createCheckReporter } from '../../../../scripts/utils/check-reporter.mjs'
|
|
29
29
|
|
|
30
30
|
/** Мінімальна допустима мажорна версія Capacitor (capacitor.mdc) */
|
|
31
31
|
const MIN_CAPACITOR_MAJOR = 8
|
|
@@ -27,8 +27,8 @@ import { readFile } from 'node:fs/promises'
|
|
|
27
27
|
import { join } from 'node:path'
|
|
28
28
|
import { promisify } from 'node:util'
|
|
29
29
|
|
|
30
|
-
import { createCheckReporter } from '
|
|
31
|
-
import { getMonorepoPackageRootDirs } from '
|
|
30
|
+
import { createCheckReporter } from '../../../../scripts/utils/check-reporter.mjs'
|
|
31
|
+
import { getMonorepoPackageRootDirs } from '../../../../scripts/utils/workspaces.mjs'
|
|
32
32
|
|
|
33
33
|
const execFileAsync = promisify(execFile)
|
|
34
34
|
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
import { readFile } from 'node:fs/promises'
|
|
31
31
|
import { basename } from 'node:path'
|
|
32
32
|
|
|
33
|
-
import { getMirrorGcrHint, getFromImageToken } from '
|
|
34
|
-
import { lintDockerfileWithHadolint, posixRel } from '
|
|
35
|
-
import { createCheckReporter } from '
|
|
36
|
-
import { loadCursorIgnorePaths } from '
|
|
37
|
-
import { walkDir } from '
|
|
33
|
+
import { getMirrorGcrHint, getFromImageToken } from '../../../../scripts/utils/docker-mirror.mjs'
|
|
34
|
+
import { lintDockerfileWithHadolint, posixRel } from '../../../../scripts/utils/docker-hadolint.mjs'
|
|
35
|
+
import { createCheckReporter } from '../../../../scripts/utils/check-reporter.mjs'
|
|
36
|
+
import { loadCursorIgnorePaths } from '../../../../scripts/utils/load-cursor-config.mjs'
|
|
37
|
+
import { walkDir } from '../../../../scripts/utils/walkDir.mjs'
|
|
38
38
|
|
|
39
39
|
const NEWLINE_RE = /\r?\n/
|
|
40
40
|
const BUN_INSTALL_RE = /\bbun\s+(?:install|i)\b/iu
|
package/rules/ga/js/lint.mjs
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
import { spawnSync } from 'node:child_process'
|
|
23
23
|
import { platform } from 'node:process'
|
|
24
24
|
|
|
25
|
-
import { check as checkGa } from './check.mjs'
|
|
25
|
+
import { check as checkGa } from './workflows/check.mjs'
|
|
26
26
|
import { resolveCmd } from '../../../scripts/utils/resolve-cmd.mjs'
|
|
27
27
|
|
|
28
28
|
/**
|
|
@@ -19,10 +19,10 @@ import { readdir, readFile } from 'node:fs/promises'
|
|
|
19
19
|
import { execFileSync } from 'node:child_process'
|
|
20
20
|
import { join } from 'node:path'
|
|
21
21
|
|
|
22
|
-
import { createCheckReporter } from '
|
|
23
|
-
import { eventPathsIncludeExact, parseWorkflowYaml } from '
|
|
24
|
-
import { resolveCmd } from '
|
|
25
|
-
import { runConftestBatch } from '
|
|
22
|
+
import { createCheckReporter } from '../../../../scripts/utils/check-reporter.mjs'
|
|
23
|
+
import { eventPathsIncludeExact, parseWorkflowYaml } from '../../../../scripts/utils/gha-workflow.mjs'
|
|
24
|
+
import { resolveCmd } from '../../../../scripts/utils/resolve-cmd.mjs'
|
|
25
|
+
import { runConftestBatch } from '../../../../scripts/utils/run-conftest-batch.mjs'
|
|
26
26
|
|
|
27
27
|
/** Шаблони наявності MegaLinter у вмісті workflow */
|
|
28
28
|
const MEGALINTER_USE_PATTERNS = [/oxsecurity\/megalinter-action/i, /megalinter\/megalinter/i]
|
|
@@ -10,15 +10,15 @@ import { existsSync } from 'node:fs'
|
|
|
10
10
|
import { readFile } from 'node:fs/promises'
|
|
11
11
|
import { relative } from 'node:path'
|
|
12
12
|
|
|
13
|
-
import { createCheckReporter } from '
|
|
13
|
+
import { createCheckReporter } from '../../../../scripts/utils/check-reporter.mjs'
|
|
14
14
|
import {
|
|
15
15
|
isGqlScanSourceFile,
|
|
16
16
|
shouldSkipFileForGqlScan,
|
|
17
17
|
sourceFileHasGqlTaggedTemplate
|
|
18
|
-
} from '
|
|
19
|
-
import { loadCursorIgnorePaths } from '
|
|
20
|
-
import { runConftestBatch } from '
|
|
21
|
-
import { walkDir } from '
|
|
18
|
+
} from '../../../../scripts/utils/graphql-gql-scan.mjs'
|
|
19
|
+
import { loadCursorIgnorePaths } from '../../../../scripts/utils/load-cursor-config.mjs'
|
|
20
|
+
import { runConftestBatch } from '../../../../scripts/utils/run-conftest-batch.mjs'
|
|
21
|
+
import { walkDir } from '../../../../scripts/utils/walkDir.mjs'
|
|
22
22
|
|
|
23
23
|
/** Очікуваний файл GraphQL Config у корені (graphql.mdc). */
|
|
24
24
|
export const GRAPHQL_RC_FILENAME = '.graphqlrc.yml'
|
|
@@ -27,10 +27,10 @@ import { basename, join, relative } from 'node:path'
|
|
|
27
27
|
|
|
28
28
|
import { parseAllDocuments } from 'yaml'
|
|
29
29
|
|
|
30
|
-
import { getRepositoryUrl } from '
|
|
31
|
-
import { createCheckReporter } from '
|
|
32
|
-
import { loadCursorIgnorePaths } from '
|
|
33
|
-
import { walkDir } from '
|
|
30
|
+
import { getRepositoryUrl } from '../../../../scripts/auto-rules.mjs'
|
|
31
|
+
import { createCheckReporter } from '../../../../scripts/utils/check-reporter.mjs'
|
|
32
|
+
import { loadCursorIgnorePaths } from '../../../../scripts/utils/load-cursor-config.mjs'
|
|
33
|
+
import { walkDir } from '../../../../scripts/utils/walkDir.mjs'
|
|
34
34
|
|
|
35
35
|
const NITRA_REPOSITORY_URL_MARKER = 'https://github.com/nitra/'
|
|
36
36
|
const ABIE_REPOSITORY_URL_MARKER = 'https://github.com/abinbevefes/'
|
|
@@ -25,11 +25,11 @@ import { join, relative } from 'node:path'
|
|
|
25
25
|
import { spawnSync } from 'node:child_process'
|
|
26
26
|
import { env } from 'node:process'
|
|
27
27
|
|
|
28
|
-
import { createCheckReporter } from '
|
|
29
|
-
import { loadCursorIgnorePaths } from '
|
|
30
|
-
import { resolveCmd } from '
|
|
31
|
-
import { walkDir } from '
|
|
32
|
-
import { getMonorepoPackageRootDirs } from '
|
|
28
|
+
import { createCheckReporter } from '../../../../scripts/utils/check-reporter.mjs'
|
|
29
|
+
import { loadCursorIgnorePaths } from '../../../../scripts/utils/load-cursor-config.mjs'
|
|
30
|
+
import { resolveCmd } from '../../../../scripts/utils/resolve-cmd.mjs'
|
|
31
|
+
import { walkDir } from '../../../../scripts/utils/walkDir.mjs'
|
|
32
|
+
import { getMonorepoPackageRootDirs } from '../../../../scripts/utils/workspaces.mjs'
|
|
33
33
|
|
|
34
34
|
/** Імʼя CLI-пакета, який генерує AVIF. */
|
|
35
35
|
const MINIFY_PACKAGE_NAME = '@nitra/minify-image'
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
import { existsSync } from 'node:fs'
|
|
20
20
|
import { readFile } from 'node:fs/promises'
|
|
21
21
|
|
|
22
|
-
import { createCheckReporter } from '
|
|
22
|
+
import { createCheckReporter } from '../../../../scripts/utils/check-reporter.mjs'
|
|
23
23
|
|
|
24
24
|
/** Імʼя committed-кешу (sha1 + originalSize + size) у `@nitra/minify-image` ≥ 3.2.0. */
|
|
25
25
|
const HASH_CACHE_FILENAME = '.n-minify-image.tsv'
|
|
@@ -25,7 +25,7 @@ import { existsSync } from 'node:fs'
|
|
|
25
25
|
import { readFile } from 'node:fs/promises'
|
|
26
26
|
import { join, relative } from 'node:path'
|
|
27
27
|
|
|
28
|
-
import { createCheckReporter } from '
|
|
28
|
+
import { createCheckReporter } from '../../../../scripts/utils/check-reporter.mjs'
|
|
29
29
|
import {
|
|
30
30
|
findBunSqlPerRequestConnectionInText,
|
|
31
31
|
findBunSqlPgLeftoverCallInText,
|
|
@@ -36,10 +36,10 @@ import {
|
|
|
36
36
|
findUnsafeBunSqlInListMissingEmptyGuardInText,
|
|
37
37
|
isBunSqlScanSourceFile,
|
|
38
38
|
textHasBunSqlImport
|
|
39
|
-
} from '
|
|
40
|
-
import { findAllPackageJsonPaths } from '
|
|
41
|
-
import { loadCursorIgnorePaths } from '
|
|
42
|
-
import { walkDir } from '
|
|
39
|
+
} from '../../../../scripts/utils/bun-sql-scan.mjs'
|
|
40
|
+
import { findAllPackageJsonPaths } from '../../../../scripts/utils/find-package-json-paths.mjs'
|
|
41
|
+
import { loadCursorIgnorePaths } from '../../../../scripts/utils/load-cursor-config.mjs'
|
|
42
|
+
import { walkDir } from '../../../../scripts/utils/walkDir.mjs'
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
45
|
* Збирає абсолютні шляхи JS/TS джерел у репозиторії для скану Bun SQL патернів.
|
|
@@ -14,10 +14,10 @@ import { existsSync } from 'node:fs'
|
|
|
14
14
|
import { readFile } from 'node:fs/promises'
|
|
15
15
|
import { join, relative } from 'node:path'
|
|
16
16
|
|
|
17
|
-
import { createCheckReporter } from '
|
|
18
|
-
import { loadCursorIgnorePaths } from '
|
|
19
|
-
import { findRedisImportsInText, isRedisScanSourceFile, shouldSkipFileForRedisScan } from '
|
|
20
|
-
import { walkDir } from '
|
|
17
|
+
import { createCheckReporter } from '../../../../scripts/utils/check-reporter.mjs'
|
|
18
|
+
import { loadCursorIgnorePaths } from '../../../../scripts/utils/load-cursor-config.mjs'
|
|
19
|
+
import { findRedisImportsInText, isRedisScanSourceFile, shouldSkipFileForRedisScan } from '../../../../scripts/utils/redis-imports.mjs'
|
|
20
|
+
import { walkDir } from '../../../../scripts/utils/walkDir.mjs'
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Збирає абсолютні шляхи JS/TS джерел у репозиторії для скану заборонених redis-імпортів.
|
|
@@ -16,17 +16,31 @@ import { copyFile, readFile } from 'node:fs/promises'
|
|
|
16
16
|
import { dirname, join } from 'node:path'
|
|
17
17
|
import { fileURLToPath } from 'node:url'
|
|
18
18
|
|
|
19
|
-
import { createCheckReporter } from '
|
|
19
|
+
import { createCheckReporter } from '../../../../scripts/utils/check-reporter.mjs'
|
|
20
20
|
|
|
21
21
|
/** Шлях до канонічного oxlint JSON у цьому пакеті (для перевірки та тестів). */
|
|
22
22
|
export const OXLINT_CANONICAL_JSON_PATH = join(
|
|
23
23
|
dirname(fileURLToPath(import.meta.url)),
|
|
24
|
+
'..',
|
|
25
|
+
'..',
|
|
26
|
+
'..',
|
|
27
|
+
'..',
|
|
28
|
+
'scripts',
|
|
24
29
|
'utils',
|
|
25
30
|
'oxlint-canonical.json'
|
|
26
31
|
)
|
|
27
32
|
|
|
28
33
|
/** Шлях до канонічного knip JSON у цьому пакеті — копіюється у корінь проєкту-споживача, якщо відсутній. */
|
|
29
|
-
export const KNIP_CANONICAL_JSON_PATH = join(
|
|
34
|
+
export const KNIP_CANONICAL_JSON_PATH = join(
|
|
35
|
+
dirname(fileURLToPath(import.meta.url)),
|
|
36
|
+
'..',
|
|
37
|
+
'..',
|
|
38
|
+
'..',
|
|
39
|
+
'..',
|
|
40
|
+
'scripts',
|
|
41
|
+
'utils',
|
|
42
|
+
'knip-canonical.json'
|
|
43
|
+
)
|
|
30
44
|
|
|
31
45
|
/** Мінімальні рекомендації розширень редактора з js-lint.mdc (eslint, oxlint, GA). */
|
|
32
46
|
export const REQUIRED_VSCODE_EXTENSIONS = ['dbaeumer.vscode-eslint', 'github.vscode-github-actions', 'oxc.oxc-vscode']
|
|
@@ -12,8 +12,8 @@ import { existsSync } from 'node:fs'
|
|
|
12
12
|
import { readFile } from 'node:fs/promises'
|
|
13
13
|
import { join, relative } from 'node:path'
|
|
14
14
|
|
|
15
|
-
import { createCheckReporter } from '
|
|
16
|
-
import { findAllPackageJsonPaths } from '
|
|
15
|
+
import { createCheckReporter } from '../../../../scripts/utils/check-reporter.mjs'
|
|
16
|
+
import { findAllPackageJsonPaths } from '../../../../scripts/utils/find-package-json-paths.mjs'
|
|
17
17
|
import {
|
|
18
18
|
findMssqlPerRequestConnectionInText,
|
|
19
19
|
findSharedMssqlRequestInText,
|
|
@@ -22,9 +22,9 @@ import {
|
|
|
22
22
|
findUnsafeMssqlInListUnparsedInText,
|
|
23
23
|
findUnsafeMssqlInListMissingEmptyGuardInText,
|
|
24
24
|
isMssqlScanSourceFile
|
|
25
|
-
} from '
|
|
26
|
-
import { loadCursorIgnorePaths } from '
|
|
27
|
-
import { walkDir } from '
|
|
25
|
+
} from '../../../../scripts/utils/mssql-pool-scan.mjs'
|
|
26
|
+
import { loadCursorIgnorePaths } from '../../../../scripts/utils/load-cursor-config.mjs'
|
|
27
|
+
import { walkDir } from '../../../../scripts/utils/walkDir.mjs'
|
|
28
28
|
|
|
29
29
|
const VERSION_PREFIX_RE = /^[\^~>=<]+\s*/u
|
|
30
30
|
const SEMVER_RE = /^(\d+)\.(\d+)\.(\d+)/u
|
|
@@ -37,21 +37,21 @@ import {
|
|
|
37
37
|
findBunyanImportsInText,
|
|
38
38
|
isBunyanScanSourceFile,
|
|
39
39
|
shouldSkipFileForBunyanScan
|
|
40
|
-
} from '
|
|
41
|
-
import { findUncheckedProcessEnvInText, isCheckEnvScanSourceFile } from '
|
|
42
|
-
import { createCheckReporter } from '
|
|
43
|
-
import { runConftestBatch } from '
|
|
44
|
-
import { findConnFileRuleViolations, isConnFileRulesSourceFile } from '
|
|
40
|
+
} from '../../../../scripts/utils/bunyan-imports.mjs'
|
|
41
|
+
import { findUncheckedProcessEnvInText, isCheckEnvScanSourceFile } from '../../../../scripts/utils/check-env-scan.mjs'
|
|
42
|
+
import { createCheckReporter } from '../../../../scripts/utils/check-reporter.mjs'
|
|
43
|
+
import { runConftestBatch } from '../../../../scripts/utils/run-conftest-batch.mjs'
|
|
44
|
+
import { findConnFileRuleViolations, isConnFileRulesSourceFile } from '../../../../scripts/utils/conn-file-rules.mjs'
|
|
45
45
|
import {
|
|
46
46
|
findConnFactoryImportsInText,
|
|
47
47
|
isConnImportsScanSourceFile,
|
|
48
48
|
isInsideConnDir,
|
|
49
49
|
resolveConnDirFromPackageJson
|
|
50
|
-
} from '
|
|
51
|
-
import { loadCursorIgnorePaths } from '
|
|
52
|
-
import { findPromiseSetTimeoutInText, isPromiseSetTimeoutScanSourceFile } from '
|
|
53
|
-
import { walkDir } from '
|
|
54
|
-
import { getMonorepoPackageRootDirs } from '
|
|
50
|
+
} from '../../../../scripts/utils/conn-imports-scan.mjs'
|
|
51
|
+
import { loadCursorIgnorePaths } from '../../../../scripts/utils/load-cursor-config.mjs'
|
|
52
|
+
import { findPromiseSetTimeoutInText, isPromiseSetTimeoutScanSourceFile } from '../../../../scripts/utils/promise-settimeout-scan.mjs'
|
|
53
|
+
import { walkDir } from '../../../../scripts/utils/walkDir.mjs'
|
|
54
|
+
import { getMonorepoPackageRootDirs } from '../../../../scripts/utils/workspaces.mjs'
|
|
55
55
|
|
|
56
56
|
/**
|
|
57
57
|
* Чи існує непорожній за змістом маркер каталогу `src/` (рекомендована структура js-run).
|
|
@@ -134,10 +134,10 @@ import { basename, dirname, join, relative, resolve } from 'node:path'
|
|
|
134
134
|
|
|
135
135
|
import { isSeq, parseAllDocuments, parseDocument } from 'yaml'
|
|
136
136
|
|
|
137
|
-
import { createCheckReporter } from '
|
|
138
|
-
import { loadCursorIgnorePaths } from '
|
|
139
|
-
import { runConftestBatch } from '
|
|
140
|
-
import { walkDir } from '
|
|
137
|
+
import { createCheckReporter } from '../../../../scripts/utils/check-reporter.mjs'
|
|
138
|
+
import { loadCursorIgnorePaths } from '../../../../scripts/utils/load-cursor-config.mjs'
|
|
139
|
+
import { runConftestBatch } from '../../../../scripts/utils/run-conftest-batch.mjs'
|
|
140
|
+
import { walkDir } from '../../../../scripts/utils/walkDir.mjs'
|
|
141
141
|
|
|
142
142
|
/** Версія набору схем yannh — узгоджено з k8s.mdc */
|
|
143
143
|
const YANNH_PIN = 'v1.33.9-standalone-strict'
|
|
@@ -17,11 +17,11 @@ import { existsSync } from 'node:fs'
|
|
|
17
17
|
import { readdir, readFile, rename, unlink, writeFile } from 'node:fs/promises'
|
|
18
18
|
import { basename, dirname, join, relative } from 'node:path'
|
|
19
19
|
|
|
20
|
-
import { findDockerfilePaths } from '
|
|
21
|
-
import { createCheckReporter } from '
|
|
22
|
-
import { loadCursorIgnorePaths } from '
|
|
23
|
-
import { runConftestBatch } from '
|
|
24
|
-
import { walkDir } from '
|
|
20
|
+
import { findDockerfilePaths } from '../../../docker/js/lint/check.mjs'
|
|
21
|
+
import { createCheckReporter } from '../../../../scripts/utils/check-reporter.mjs'
|
|
22
|
+
import { loadCursorIgnorePaths } from '../../../../scripts/utils/load-cursor-config.mjs'
|
|
23
|
+
import { runConftestBatch } from '../../../../scripts/utils/run-conftest-batch.mjs'
|
|
24
|
+
import { walkDir } from '../../../../scripts/utils/walkDir.mjs'
|
|
25
25
|
|
|
26
26
|
const LINE_SPLIT_RE = /\r?\n/u
|
|
27
27
|
const INI_KEY_RE = /^([A-Za-z_]\w*)\s*=/u
|
|
@@ -32,10 +32,10 @@ import { promisify } from 'node:util'
|
|
|
32
32
|
|
|
33
33
|
import { parseSync } from 'oxc-parser'
|
|
34
34
|
|
|
35
|
-
import { dynamicImportModule, langFromPath, requireCallModule, walkAstWithAncestors } from '
|
|
36
|
-
import { createCheckReporter } from '
|
|
37
|
-
import { loadCursorIgnorePaths } from '
|
|
38
|
-
import { walkDir } from '
|
|
35
|
+
import { dynamicImportModule, langFromPath, requireCallModule, walkAstWithAncestors } from '../../../../scripts/utils/ast-scan-utils.mjs'
|
|
36
|
+
import { createCheckReporter } from '../../../../scripts/utils/check-reporter.mjs'
|
|
37
|
+
import { loadCursorIgnorePaths } from '../../../../scripts/utils/load-cursor-config.mjs'
|
|
38
|
+
import { walkDir } from '../../../../scripts/utils/walkDir.mjs'
|
|
39
39
|
|
|
40
40
|
const execFileAsync = promisify(execFile)
|
|
41
41
|
|