@shibanet0/datamitsu-config 0.1.7 → 0.4.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/README.md +4 -106
- package/bin/tsc.js +4 -2
- package/bin/tsx.js +2 -1
- package/datamitsu.config.base.js +7242 -2095
- package/datamitsu.config.js +7242 -2095
- package/datamitsu.config.oci-dockerhub.js +7243 -2096
- package/datamitsu.config.oci-ghcr.js +7243 -2096
- package/dist/apps/cspell/ignore.d.ts +1 -0
- package/dist/apps/eslint/globs.d.ts +37 -1
- package/dist/apps/eslint/index.d.ts +2 -2
- package/dist/apps/eslint/plugins/eslint-comments.d.ts +13 -0
- package/dist/apps/eslint/plugins/json-schema-validator.d.ts +19 -0
- package/dist/apps/eslint/plugins/jsonc.d.ts +31 -0
- package/dist/apps/eslint/plugins/n.d.ts +24 -0
- package/dist/apps/eslint/plugins/next.d.ts +13 -0
- package/dist/apps/eslint/plugins/oxlint.d.ts +20 -4
- package/dist/apps/eslint/plugins/playwright.d.ts +13 -0
- package/dist/apps/eslint/plugins/pnpm.d.ts +6 -0
- package/dist/apps/eslint/plugins/prettier.d.ts +14 -0
- package/dist/apps/eslint/plugins/svelte.d.ts +2 -0
- package/dist/apps/eslint/plugins/vitest.d.ts +7 -0
- package/dist/apps/eslint/types.d.ts +41 -20
- package/dist/apps/knip/index.d.ts +62 -2
- package/dist/apps/knip/index.js +206 -7
- package/dist/apps/lefthook-proxy/__tests__/env.d.ts +2 -0
- package/dist/apps/lefthook-proxy/__tests__/fixtures/fake-upstream.d.mts +2 -0
- package/dist/apps/lefthook-proxy/env.d.ts +15 -0
- package/dist/apps/lefthook-proxy/exit-codes.d.ts +20 -0
- package/dist/apps/lefthook-proxy/git.d.ts +16 -0
- package/dist/apps/lefthook-proxy/hooks.d.ts +1 -0
- package/dist/apps/lefthook-proxy/index.d.ts +2 -0
- package/dist/apps/lefthook-proxy/isolation-failure-error.d.ts +13 -0
- package/dist/apps/lefthook-proxy/isolation.d.ts +5 -0
- package/dist/apps/lefthook-proxy/messages.d.ts +5 -0
- package/dist/apps/lefthook-proxy/resolve.d.ts +3 -0
- package/dist/apps/lefthook-proxy/signals.d.ts +19 -0
- package/dist/apps/lefthook-sort/index.d.ts +2 -0
- package/dist/apps/lefthook-sort/sort.d.ts +5 -0
- package/dist/apps/markdownlint-cli2/index.d.ts +58 -0
- package/dist/apps/oxfmt/index.d.ts +11 -1
- package/dist/apps/oxlint/__tests__/index.test.d.ts +1 -0
- package/dist/apps/oxlint/index.d.ts +88 -0
- package/dist/apps/oxlint/plugins.generated.d.ts +15 -0
- package/dist/apps/sort-keys/__tests__/sort.test.d.ts +1 -0
- package/dist/apps/sort-keys/index.d.ts +2 -0
- package/dist/apps/sort-keys/properties.d.ts +19 -0
- package/dist/apps/sort-keys/yaml.d.ts +5 -0
- package/dist/apps/stylelint/__tests__/merge.test.d.ts +1 -0
- package/dist/apps/stylelint/index.d.ts +13 -0
- package/dist/apps/stylelint/merge.d.ts +21 -0
- package/dist/apps/test-support/env.d.ts +1 -0
- package/dist/apps/test-support/managed-bun.d.ts +6 -0
- package/dist/datamitsu-config/__tests__/agents-upgrade.test.d.ts +1 -0
- package/dist/datamitsu-config/__tests__/tool-config-paths.test.d.ts +1 -0
- package/dist/datamitsu-config/agents.md.d.ts +10 -5
- package/dist/datamitsu-config/alint-defaults.d.ts +22 -0
- package/dist/datamitsu-config/apps/eslint.deps.d.ts +22 -7
- package/dist/datamitsu-config/apps/lefthook-proxy.d.ts +1 -0
- package/dist/datamitsu-config/apps/lefthook-sort.d.ts +1 -0
- package/dist/datamitsu-config/apps/sort-keys.d.ts +20 -0
- package/dist/datamitsu-config/apps/stylelint.d.ts +1 -0
- package/dist/datamitsu-config/apps/stylelint.deps.d.ts +16 -0
- package/dist/datamitsu-config/cmd-managed-configs.d.ts +2 -0
- package/dist/datamitsu-config/constants.d.ts +26 -0
- package/dist/datamitsu-config/gitleaks-defaults.d.ts +1 -0
- package/dist/datamitsu-config/globs.d.ts +37 -1
- package/dist/datamitsu-config/inline-config/commitlint.d.ts +1 -1
- package/dist/datamitsu-config/inline-config/cspell.d.ts +1 -1
- package/dist/datamitsu-config/inline-config/eslint.d.ts +1 -1
- package/dist/datamitsu-config/inline-config/knip.d.ts +1 -1
- package/dist/datamitsu-config/inline-config/lefthook-proxy.d.ts +1 -0
- package/dist/datamitsu-config/inline-config/lefthook-sort.d.ts +1 -0
- package/dist/datamitsu-config/inline-config/markdownlint-cli2.d.ts +1 -0
- package/dist/datamitsu-config/inline-config/oxfmt.d.ts +1 -1
- package/dist/datamitsu-config/inline-config/oxlint.d.ts +1 -0
- package/dist/datamitsu-config/inline-config/prettier.d.ts +1 -1
- package/dist/datamitsu-config/inline-config/sort-keys.d.ts +1 -0
- package/dist/datamitsu-config/inline-config/stylelint.d.ts +1 -0
- package/dist/datamitsu-config/ls-lint-defaults.d.ts +20 -0
- package/dist/datamitsu-config/managed-configs/__tests__/alint_yml.test.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/__tests__/droast_toml.test.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/__tests__/editorconfig.test.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/__tests__/github_dependabot_yml.test.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/__tests__/lefthook_yaml.test.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/__tests__/ls_lint_yml.test.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/__tests__/package_json.test.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/__tests__/pnpm_workspace_yaml.test.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/__tests__/typos_toml.test.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/__tests__/yamlfmt_yaml.test.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/_alint_yml.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/_datamitsu_scripts_check_empty_files_sh.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/_datamitsu_scripts_format_terraform_spacing_sh.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/_dclint_yaml.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/_dockerignore.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/_editorconfig.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/_editorconfig_checker_json.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/_github_dependabot_yml.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/_github_zizmor_yml.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/_gitignore.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/_gitleaks_toml.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/_golangci_yaml.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/_ls_lint_yml.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/_markdownlint_cli2_mjs.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/_node_version.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/_npmrc.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/_pinact_yaml.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/_sqruff.d.ts +14 -0
- package/dist/datamitsu-config/managed-configs/_syncpackrc_json.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/_tflint_hcl.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/_tombi_toml.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/_trufflehog_exclude_paths_txt.d.ts +2 -0
- package/dist/datamitsu-config/managed-configs/_typos_toml.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/_vale_ini.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/_vscode_extensions_json.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/_vscode_settings_json.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/_yamlfmt_yaml.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/_yamllint_yaml.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/ai-tools.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/commitlint_config_mjs.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/cspell_config_mjs.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/deny_toml.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/deprecated_configs.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/droast_toml.d.ts +9 -0
- package/dist/datamitsu-config/managed-configs/eslint_config_mjs.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/hadolint_yaml.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/knip_config_js.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/lefthook_yaml.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/lychee_toml.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/mdsf_json.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/oxfmt_config_ts.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/oxlint_config_mts.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/package_json.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/pnpm_workspace_yaml.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/prettier_config_mjs.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/pyproject_toml.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/rustfmt_toml.d.ts +13 -0
- package/dist/datamitsu-config/managed-configs/stylelint_config_mjs.d.ts +1 -0
- package/dist/datamitsu-config/managed-configs/turbo_json.d.ts +1 -0
- package/dist/datamitsu-config/oci.d.ts +3 -3
- package/dist/datamitsu-config/parsers.d.ts +17 -5
- package/dist/datamitsu-config/skills.d.ts +10 -4
- package/dist/datamitsu-config/tsconfig.md.d.ts +2 -2
- package/dist/datamitsu-config/utils/{detectPackageType.d.ts → detect-package-type.d.ts} +1 -1
- package/dist/globs/globs.d.ts +30 -1
- package/dist/ignore/__tests__/catalog.test.d.ts +1 -0
- package/dist/ignore/__tests__/eslint-traversal.test.d.ts +1 -0
- package/dist/ignore/__tests__/ls-lint.test.d.ts +1 -0
- package/dist/ignore/__tests__/pins.test.d.ts +1 -0
- package/dist/ignore/__tests__/profiles.test.d.ts +1 -0
- package/dist/ignore/catalog.d.ts +1555 -0
- package/dist/ignore/profile.d.ts +24 -0
- package/dist/ignore/profiles/cspell.d.ts +2 -0
- package/dist/ignore/profiles/eslint.d.ts +2 -0
- package/dist/ignore/profiles/gitignore.d.ts +2 -0
- package/dist/ignore/profiles/json-exclude.d.ts +2 -0
- package/dist/ignore/profiles/ls-lint.d.ts +2 -0
- package/dist/ignore/profiles/trufflehog.d.ts +2 -0
- package/dist/ignore/profiles/yaml-exclude.d.ts +2 -0
- package/dist/ignore/profiles/yaml.d.ts +2 -0
- package/dist/ignore/types.d.ts +18 -0
- package/dist/lib/datamitsu.d.ts +1 -1
- package/dist/lint-rules/__tests__/index.test.d.ts +1 -0
- package/dist/lint-rules/index.d.ts +46 -0
- package/dist/lint-rules/oxlint-known-rules.generated.d.ts +1 -0
- package/dist/lint-rules/permanent-disabled.d.ts +19 -0
- package/dist/lint-rules/permanent-enabled.d.ts +49 -0
- package/dist/lint-rules/rule-names.generated.d.ts +5 -0
- package/dist/lint-rules/temporary.d.ts +25 -0
- package/dist/s0/cmd/pulumi/__tests__/cleanup-state.test.d.ts +1 -0
- package/dist/s0/cmd/pulumi/__tests__/decrypt-state.test.d.ts +1 -0
- package/dist/s0/cmd/pulumi/__tests__/encrypt-editor.test.d.ts +1 -0
- package/dist/s0/cmd/pulumi/__tests__/encrypt-state.test.d.ts +1 -0
- package/dist/s0/cmd/pulumi/__tests__/state-content.test.d.ts +1 -0
- package/dist/s0/cmd/pulumi/__tests__/state-files.test.d.ts +1 -0
- package/dist/s0/cmd/pulumi/__tests__/state-guard.test.d.ts +1 -0
- package/dist/s0/cmd/pulumi/constants.d.ts +5 -0
- package/dist/s0/cmd/pulumi/decrypt-state.d.ts +8 -0
- package/dist/s0/cmd/pulumi/encrypt-state.d.ts +14 -0
- package/dist/s0/cmd/pulumi/index.d.ts +3 -1
- package/dist/s0/cmd/pulumi/state-content.d.ts +21 -0
- package/dist/s0/cmd/pulumi/state-files.d.ts +13 -0
- package/dist/s0/cmd/pulumi/state-guard.d.ts +15 -0
- package/dist/s0/index.js +7012 -185
- package/dist/s0/utils/datamitsu.d.ts +1 -1
- package/dist/utils/{typeGuards.d.ts → type-guards.d.ts} +1 -1
- package/package.json +7 -7
- package/tsconfig/base.json +11 -3
- package/tsconfig/infra-pulumi.json +12 -4
- package/tsconfig/nextjs.json +11 -3
- package/tsconfig/react-library.json +5 -1
- package/tsconfig/service-worker.json +3 -1
- package/tsconfig/service.json +3 -1
- package/tsconfig/shared-react-library.json +5 -1
- package/dist/apps/eslint/plugins/arrow-return-style.d.ts +0 -2
- package/dist/apps/eslint/plugins/json.d.ts +0 -2
- package/dist/apps/eslint/plugins/react-perf.d.ts +0 -2
- package/dist/datamitsu-config/cmdSetup.d.ts +0 -3
- package/dist/datamitsu-config/env.d.ts +0 -5
- package/dist/datamitsu-config/gitleaksDefaults.d.ts +0 -4
- package/dist/datamitsu-config/inline-config/oxlint_configuration_schema.d.ts +0 -1
- package/dist/datamitsu-config/setup/_datamitsu_scripts_check_empty_files_sh.d.ts +0 -1
- package/dist/datamitsu-config/setup/_datamitsu_scripts_format_terraform_spacing_sh.d.ts +0 -1
- package/dist/datamitsu-config/setup/_dockerignore.d.ts +0 -1
- package/dist/datamitsu-config/setup/_editorconfig.d.ts +0 -1
- package/dist/datamitsu-config/setup/_editorconfig_checker_json.d.ts +0 -1
- package/dist/datamitsu-config/setup/_gitignore.d.ts +0 -1
- package/dist/datamitsu-config/setup/_gitleaks_toml.d.ts +0 -1
- package/dist/datamitsu-config/setup/_golangci_yaml.d.ts +0 -1
- package/dist/datamitsu-config/setup/_node_version.d.ts +0 -1
- package/dist/datamitsu-config/setup/_npmrc.d.ts +0 -1
- package/dist/datamitsu-config/setup/_oxlintrc_json.d.ts +0 -1
- package/dist/datamitsu-config/setup/_syncpackrc_json.d.ts +0 -1
- package/dist/datamitsu-config/setup/_tflint_hcl.d.ts +0 -1
- package/dist/datamitsu-config/setup/_tombi_toml.d.ts +0 -1
- package/dist/datamitsu-config/setup/_trufflehog_exclude_paths_txt.d.ts +0 -2
- package/dist/datamitsu-config/setup/_vale_ini.d.ts +0 -1
- package/dist/datamitsu-config/setup/_vscode_extensions_json.d.ts +0 -1
- package/dist/datamitsu-config/setup/_vscode_settings_json.d.ts +0 -1
- package/dist/datamitsu-config/setup/_yamlfmt_yaml.d.ts +0 -1
- package/dist/datamitsu-config/setup/_yamllint_yaml.d.ts +0 -1
- package/dist/datamitsu-config/setup/aiTools.d.ts +0 -1
- package/dist/datamitsu-config/setup/commitlint_config_mjs.d.ts +0 -1
- package/dist/datamitsu-config/setup/cspell_config_mjs.d.ts +0 -1
- package/dist/datamitsu-config/setup/deprecated_configs.d.ts +0 -1
- package/dist/datamitsu-config/setup/eslint_config_mjs.d.ts +0 -1
- package/dist/datamitsu-config/setup/hadolint_yaml.d.ts +0 -1
- package/dist/datamitsu-config/setup/knip_config_js.d.ts +0 -1
- package/dist/datamitsu-config/setup/lefthook_yaml.d.ts +0 -1
- package/dist/datamitsu-config/setup/oxfmt_config_ts.d.ts +0 -1
- package/dist/datamitsu-config/setup/package_json.d.ts +0 -1
- package/dist/datamitsu-config/setup/pnpm_workspace_yaml.d.ts +0 -1
- package/dist/datamitsu-config/setup/prettier_config_mjs.d.ts +0 -1
- package/dist/datamitsu-config/setup/pyproject_toml.d.ts +0 -1
- package/dist/datamitsu-config/setup/rustfmt_toml.d.ts +0 -1
- package/dist/datamitsu-config/setup/turbo_json.d.ts +0 -1
- package/dist/s0/__tests__/helpers/mockCrypto.d.ts +0 -22
- package/dist/s0/__tests__/helpers/mockExeca.d.ts +0 -47
- package/dist/s0/__tests__/helpers/mockFs.d.ts +0 -44
- package/dist/s0/__tests__/helpers/mockGlob.d.ts +0 -21
- package/dist/s0/cmd/pulumi/decryptState.d.ts +0 -1
- package/dist/s0/cmd/pulumi/encryptState.d.ts +0 -1
- /package/dist/apps/eslint/plugins/{arrayFunc.d.ts → array-func.d.ts} +0 -0
- /package/dist/apps/eslint/plugins/{deMorgan.d.ts → de-morgan.d.ts} +0 -0
- /package/dist/{datamitsu-config/__tests__/agentsUpgrade.test.d.ts → apps/knip/__tests__/index.test.d.ts} +0 -0
- /package/dist/{datamitsu-config/setup/__tests__/package_json.test.d.ts → apps/lefthook-proxy/__tests__/proxy.test.d.ts} +0 -0
- /package/dist/{datamitsu-config/setup/__tests__/pnpm_workspace_yaml.test.d.ts → apps/lefthook-proxy/__tests__/real-lefthook.test.d.ts} +0 -0
- /package/dist/{s0/cmd/pulumi/__tests__/cleanupState.test.d.ts → apps/lefthook-sort/__tests__/cli.test.d.ts} +0 -0
- /package/dist/{s0/cmd/pulumi/__tests__/decryptState.test.d.ts → apps/lefthook-sort/__tests__/sort.test.d.ts} +0 -0
- /package/dist/{s0/cmd/pulumi/__tests__/encryptState.test.d.ts → apps/oxfmt/__tests__/index.test.d.ts} +0 -0
- /package/dist/datamitsu-config/{agentsUpgrade.d.ts → agents-upgrade.d.ts} +0 -0
- /package/dist/datamitsu-config/{setup → managed-configs}/shared.d.ts +0 -0
- /package/dist/datamitsu-config/utils/{cleanDependencies.d.ts → clean-dependencies.d.ts} +0 -0
- /package/dist/s0/cmd/pulumi/{cleanupState.d.ts → cleanup-state.d.ts} +0 -0
package/dist/apps/knip/index.js
CHANGED
|
@@ -1,11 +1,210 @@
|
|
|
1
1
|
//#region src/apps/knip/index.ts
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
const KNIP_DEFAULT_ENTRY = ["{index,cli,main}.{js,mjs,cjs,jsx,ts,tsx,mts,cts}!", "src/{index,cli,main}.{js,mjs,cjs,jsx,ts,tsx,mts,cts}!"];
|
|
3
|
+
const PROJECT_SCOPED_CONFIGS = [
|
|
4
|
+
"eslint.config.mjs",
|
|
5
|
+
"oxlint.config.mts",
|
|
6
|
+
"prettier.config.mjs"
|
|
7
|
+
];
|
|
8
|
+
const GIT_ROOT_SCOPED_CONFIGS = [
|
|
9
|
+
".markdownlint-cli2.mjs",
|
|
10
|
+
"commitlint.config.mjs",
|
|
11
|
+
"cspell.config.mjs",
|
|
12
|
+
"datamitsu.config.{js,ts}",
|
|
13
|
+
"knip.config.js",
|
|
14
|
+
"oxfmt.config.ts"
|
|
15
|
+
];
|
|
16
|
+
const ROOT_WORKSPACE_NAME = ".";
|
|
17
|
+
const SHARED_WORKSPACE_KEY = "**";
|
|
18
|
+
/**
|
|
19
|
+
* Options knip reads _only_ from the workspace config, so the root loses them the moment
|
|
20
|
+
* `workspaces` exists — see {@link withRootWorkspace}.
|
|
21
|
+
*
|
|
22
|
+
* Deliberately shorter than the set of options that can appear in a workspace block. `ignore` and
|
|
23
|
+
* `ignoreFiles` are registered globally from the top-level config as well, and
|
|
24
|
+
* `ignoreExportsUsedInFile` and `includeEntryExports` are read as `workspaceConfig.x ?? topLevel.x`
|
|
25
|
+
* — moving either kind under `"."` would turn a global default into a root-only one.
|
|
26
|
+
*/
|
|
27
|
+
const WORKSPACE_SCOPED_OPTIONS = [
|
|
28
|
+
"entry",
|
|
29
|
+
"ignoreMembers",
|
|
30
|
+
"paths",
|
|
31
|
+
"project"
|
|
32
|
+
];
|
|
33
|
+
/**
|
|
34
|
+
* What a finding says:
|
|
35
|
+
*
|
|
36
|
+
* - `correctness` — real defects: an import that does not resolve, a dependency used but never
|
|
37
|
+
* declared, a module exporting the same value twice.
|
|
38
|
+
* - `cycles` — circular imports. A real defect class, and one of the two groups off by default — not
|
|
39
|
+
* because the findings are weak but because reaching them is expensive. knip withholds this type
|
|
40
|
+
* from its own default set, and the only lever that brings it back, `include`, is merged with the
|
|
41
|
+
* command line's, so a config carrying one defeats `--files`, `--exports` and `--dependencies`
|
|
42
|
+
* for every later run. Adopt it where the trade is worth making.
|
|
43
|
+
* - `dependencies` — declared but never used. Needs `ignoreDependencies` for tools a config loads by
|
|
44
|
+
* name.
|
|
45
|
+
* - `exports` — unused exports and types. The largest group in a library monorepo.
|
|
46
|
+
* - `files` — unreachable files. Only as true as the entry graph, so it needs the plugins right.
|
|
47
|
+
* - `namespaces` — exports reachable only through an `import * as`. Off by default, and the one group
|
|
48
|
+
* that stays off: knip cannot tell whether these are used, so the finding is not "this is dead"
|
|
49
|
+
* but "restructure your imports so I can see". That is a style position, not a defect.
|
|
50
|
+
*
|
|
51
|
+
* This is also every value {@link DefineConfigOptions.adopted} accepts.
|
|
52
|
+
*/
|
|
53
|
+
const ISSUE_GROUPS = [
|
|
54
|
+
"correctness",
|
|
55
|
+
"cycles",
|
|
56
|
+
"dependencies",
|
|
57
|
+
"exports",
|
|
58
|
+
"files",
|
|
59
|
+
"namespaces"
|
|
60
|
+
];
|
|
61
|
+
/**
|
|
62
|
+
* Every knip issue type, and the group that owns it.
|
|
63
|
+
*
|
|
64
|
+
* `satisfies Record<IssueType, IssueGroup>` is the point: a knip upgrade that adds an issue type
|
|
65
|
+
* stops this file compiling until somebody decides which group it belongs to. Without it the new
|
|
66
|
+
* type would simply be absent from the emitted `rules` and fall back to knip's own default — the
|
|
67
|
+
* kind of residual with no author behind it that `src/lint-rules` exists to prevent.
|
|
68
|
+
*/
|
|
69
|
+
const ISSUE_TYPE_GROUPS = {
|
|
70
|
+
binaries: "correctness",
|
|
71
|
+
catalog: "dependencies",
|
|
72
|
+
catalogReferences: "correctness",
|
|
73
|
+
cycles: "cycles",
|
|
74
|
+
dependencies: "dependencies",
|
|
75
|
+
devDependencies: "dependencies",
|
|
76
|
+
duplicates: "correctness",
|
|
77
|
+
enumMembers: "exports",
|
|
78
|
+
exports: "exports",
|
|
79
|
+
files: "files",
|
|
80
|
+
namespaceMembers: "exports",
|
|
81
|
+
nsExports: "namespaces",
|
|
82
|
+
nsTypes: "namespaces",
|
|
83
|
+
optionalPeerDependencies: "dependencies",
|
|
84
|
+
types: "exports",
|
|
85
|
+
unlisted: "correctness",
|
|
86
|
+
unresolved: "correctness"
|
|
5
87
|
};
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
88
|
+
const ISSUE_TYPES = Object.keys(ISSUE_TYPE_GROUPS);
|
|
89
|
+
const ADOPTED_BY_DEFAULT = [
|
|
90
|
+
"correctness",
|
|
91
|
+
"dependencies",
|
|
92
|
+
"exports",
|
|
93
|
+
"files"
|
|
94
|
+
];
|
|
95
|
+
const EXCLUDED_BY_KNIP = /* @__PURE__ */ new Set([
|
|
96
|
+
"cycles",
|
|
97
|
+
"nsExports",
|
|
98
|
+
"nsTypes"
|
|
99
|
+
]);
|
|
100
|
+
const DEPENDENCY_TYPES_COUPLED_TO_DEPENDENCIES = ["devDependencies", "optionalPeerDependencies"];
|
|
101
|
+
const createBaseConfig = () => ({
|
|
102
|
+
entry: [
|
|
103
|
+
...KNIP_DEFAULT_ENTRY,
|
|
104
|
+
...PROJECT_SCOPED_CONFIGS,
|
|
105
|
+
...GIT_ROOT_SCOPED_CONFIGS
|
|
106
|
+
],
|
|
107
|
+
ignoreBinaries: [
|
|
108
|
+
"datamitsu",
|
|
109
|
+
"dm",
|
|
110
|
+
"s0"
|
|
111
|
+
],
|
|
112
|
+
tags: ["-knipignore"],
|
|
113
|
+
workspaces: { [SHARED_WORKSPACE_KEY]: { entry: [...KNIP_DEFAULT_ENTRY, ...PROJECT_SCOPED_CONFIGS] } }
|
|
114
|
+
});
|
|
115
|
+
const rulesFor = (adopted, overrides, explicit) => {
|
|
116
|
+
const reported = new Set(adopted);
|
|
117
|
+
const rules = Object.fromEntries(ISSUE_TYPES.map((issueType) => {
|
|
118
|
+
const override = overrides?.[issueType];
|
|
119
|
+
if (override !== void 0) return [issueType, override === "off" ? "off" : "error"];
|
|
120
|
+
return [issueType, reported.has(ISSUE_TYPE_GROUPS[issueType]) ? "error" : "off"];
|
|
121
|
+
}));
|
|
122
|
+
if (rules.dependencies === "off") {
|
|
123
|
+
const demanded = DEPENDENCY_TYPES_COUPLED_TO_DEPENDENCIES.filter((issueType) => explicit?.[issueType] === "error");
|
|
124
|
+
if (demanded.length > 0) throw new Error(`knip cannot report ${demanded.join(" or ")} while \`dependencies\` is off: turning \`dependencies\` off excludes them too, and an exclusion cannot be undone by an include. Drop the \`dependencies: "off"\`, or drop these.`);
|
|
125
|
+
for (const issueType of DEPENDENCY_TYPES_COUPLED_TO_DEPENDENCIES) rules[issueType] = "off";
|
|
126
|
+
}
|
|
127
|
+
return rules;
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* The `include` list knip needs, or `undefined` when its own default set already covers what is
|
|
131
|
+
* reported.
|
|
132
|
+
*
|
|
133
|
+
* Severities are not the lever for turning an issue type **on**: knip feeds the types set to `off`
|
|
134
|
+
* into its `exclude` and never reads severities into its `include`, so a type it leaves out of its
|
|
135
|
+
* default set stays out however loudly `rules` asks for it. Naming one in `include` then replaces
|
|
136
|
+
* that default set wholesale — listing only `cycles` reports _nothing but_ cycles — so the list has
|
|
137
|
+
* to be every reported type, not just the ones knip omits.
|
|
138
|
+
*
|
|
139
|
+
* Which is why nothing this emits is on by default. knip **unions** a config's `include` with the
|
|
140
|
+
* command line's, so a config carrying one makes `--files`, `--exports`, `--dependencies` and
|
|
141
|
+
* `--include <type>` stop narrowing anything: the union is still every reported type, and a run
|
|
142
|
+
* meant to look at one kind of finding fails on the other fourteen. That is the whole cost of
|
|
143
|
+
* adopting `cycles` or `namespaces`, and it lands on `datamitsu exec knip`, which is the only way
|
|
144
|
+
* these findings are read by a person. `--exclude` still narrows; it is applied last and wins.
|
|
145
|
+
*/
|
|
146
|
+
const includeFor = (rules) => {
|
|
147
|
+
const reported = ISSUE_TYPES.filter((issueType) => rules?.[issueType] === "error");
|
|
148
|
+
return reported.some((issueType) => EXCLUDED_BY_KNIP.has(issueType)) ? reported : void 0;
|
|
149
|
+
};
|
|
150
|
+
const isPlainObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
151
|
+
const mergeValue = (current, value) => {
|
|
152
|
+
if (value === void 0) return current;
|
|
153
|
+
if (Array.isArray(current) && Array.isArray(value)) return [...current, ...value];
|
|
154
|
+
if (isPlainObject(current) && isPlainObject(value)) {
|
|
155
|
+
const merged = { ...current };
|
|
156
|
+
for (const [key, nested] of Object.entries(value)) merged[key] = mergeValue(merged[key], nested);
|
|
157
|
+
return merged;
|
|
158
|
+
}
|
|
159
|
+
return value;
|
|
160
|
+
};
|
|
161
|
+
const mergeConfig = (base, overrides) => mergeValue(base, overrides);
|
|
162
|
+
const withSharedWorkspaceDefaults = (config) => {
|
|
163
|
+
const workspaces = config.workspaces;
|
|
164
|
+
const shared = workspaces?.[SHARED_WORKSPACE_KEY];
|
|
165
|
+
if (!workspaces || !shared) return config;
|
|
166
|
+
return {
|
|
167
|
+
...config,
|
|
168
|
+
workspaces: Object.fromEntries(Object.entries(workspaces).map(([key, value]) => key === SHARED_WORKSPACE_KEY || key === ROOT_WORKSPACE_NAME ? [key, value] : [key, mergeValue(shared, value)]))
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
const withRootWorkspace = (config) => {
|
|
172
|
+
const rest = { ...config };
|
|
173
|
+
const moved = {};
|
|
174
|
+
for (const option of WORKSPACE_SCOPED_OPTIONS) {
|
|
175
|
+
if (!(option in rest)) continue;
|
|
176
|
+
moved[option] = rest[option];
|
|
177
|
+
delete rest[option];
|
|
178
|
+
}
|
|
179
|
+
if (Object.keys(moved).length === 0) return config;
|
|
180
|
+
const workspaces = rest["workspaces"] ?? {};
|
|
181
|
+
return {
|
|
182
|
+
...rest,
|
|
183
|
+
workspaces: {
|
|
184
|
+
...workspaces,
|
|
185
|
+
[ROOT_WORKSPACE_NAME]: {
|
|
186
|
+
...moved,
|
|
187
|
+
...workspaces[ROOT_WORKSPACE_NAME]
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
const defineConfig = (overrides, options) => {
|
|
193
|
+
const adopted = options?.adopted ?? ADOPTED_BY_DEFAULT;
|
|
194
|
+
const baseRules = rulesFor(adopted);
|
|
195
|
+
const base = {
|
|
196
|
+
...createBaseConfig(),
|
|
197
|
+
rules: baseRules
|
|
198
|
+
};
|
|
199
|
+
const merged = typeof overrides === "function" ? overrides(base) : overrides ? mergeConfig(base, overrides) : base;
|
|
200
|
+
const explicitRules = typeof overrides === "function" || !overrides ? Object.fromEntries(Object.entries(merged.rules ?? {}).filter(([issueType, severity]) => severity !== baseRules[issueType])) : overrides.rules;
|
|
201
|
+
const rules = rulesFor(adopted, merged.rules, explicitRules);
|
|
202
|
+
const include = merged.include ?? includeFor(rules);
|
|
203
|
+
return withRootWorkspace(withSharedWorkspaceDefaults({
|
|
204
|
+
...merged,
|
|
205
|
+
...include && { include },
|
|
206
|
+
rules
|
|
207
|
+
}));
|
|
9
208
|
};
|
|
10
209
|
//#endregion
|
|
11
|
-
export { defineConfig };
|
|
210
|
+
export { ISSUE_GROUPS, defineConfig };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface ProxyEnvironment {
|
|
2
|
+
active: boolean;
|
|
3
|
+
gitIndexFile?: string;
|
|
4
|
+
noColor: boolean;
|
|
5
|
+
path: string;
|
|
6
|
+
pathExtensions: string;
|
|
7
|
+
publicProxy?: string;
|
|
8
|
+
upstream?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function childEnvironment(markActive: boolean): NodeJS.ProcessEnv;
|
|
11
|
+
export declare function hookRuntimeSettings(): {
|
|
12
|
+
directory: string;
|
|
13
|
+
options: string;
|
|
14
|
+
};
|
|
15
|
+
export declare function proxyEnvironment(source?: NodeJS.ProcessEnv): ProxyEnvironment;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exit codes the proxy adds on top of whatever upstream Lefthook returns. They start at the
|
|
3
|
+
* sysexits.h range so they cannot be confused with a Lefthook command's own non-zero status.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* The working tree could not be isolated, or could not be restored afterwards. Nothing was lost —
|
|
7
|
+
* the transaction stash is retained and the recovery commands are printed — but the tree may be
|
|
8
|
+
* missing the hidden changes until the backup is applied.
|
|
9
|
+
*/
|
|
10
|
+
export declare const restoreFailureExitCode = 70;
|
|
11
|
+
/**
|
|
12
|
+
* The working tree is intact, but the installed Git hooks could not be re-pointed at the public
|
|
13
|
+
* proxy. Hooks keep working; they just may call upstream Lefthook directly until the next
|
|
14
|
+
* successful `lefthook install`, which means the next commit can run without isolation.
|
|
15
|
+
*/
|
|
16
|
+
export declare const hookBindingFailureExitCode = 71;
|
|
17
|
+
/**
|
|
18
|
+
* Upstream Lefthook could not be found or could not be executed at all.
|
|
19
|
+
*/
|
|
20
|
+
export declare const upstreamMissingExitCode = 127;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface StashEntry {
|
|
2
|
+
oid: string;
|
|
3
|
+
selector: string;
|
|
4
|
+
subject: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function gitCommand(args: readonly string[], input?: Buffer): Promise<Buffer>;
|
|
7
|
+
export declare function gitDirectory(repositoryRootPath: string): Promise<string>;
|
|
8
|
+
export declare function gitOutput(args: readonly string[]): Promise<string>;
|
|
9
|
+
export declare function listStashes(repositoryRootPath: string): Promise<StashEntry[]>;
|
|
10
|
+
export declare function nulSeparatedPaths(paths: Buffer): Buffer[];
|
|
11
|
+
/**
|
|
12
|
+
* Name of the in-flight Git operation (merge, rebase, …), if the repository is mid-operation.
|
|
13
|
+
*/
|
|
14
|
+
export declare function operationInProgress(directory: string): string | undefined;
|
|
15
|
+
export declare function repositoryHasHead(repositoryRootPath: string): Promise<boolean>;
|
|
16
|
+
export declare function repositoryRoot(): Promise<string>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function bindInstalledHooksToProxy(publicProxy: string, upstream: string): Promise<number>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type IsolationTarget = "head" | "index";
|
|
2
|
+
export interface StashTransaction {
|
|
3
|
+
marker: string;
|
|
4
|
+
oid: string;
|
|
5
|
+
repositoryRoot: string;
|
|
6
|
+
target: IsolationTarget;
|
|
7
|
+
}
|
|
8
|
+
export declare class IsolationFailureError extends Error {
|
|
9
|
+
readonly marker: string;
|
|
10
|
+
readonly repositoryRoot: string;
|
|
11
|
+
readonly transaction: StashTransaction | undefined;
|
|
12
|
+
constructor(message: string, marker: string, repositoryRoot: string, transaction?: StashTransaction);
|
|
13
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ProxyEnvironment } from "./env.js";
|
|
2
|
+
import { type IsolationTarget, type StashTransaction } from "./isolation-failure-error.js";
|
|
3
|
+
export declare function isolateWorkingTree(target: IsolationTarget, environment: ProxyEnvironment): Promise<StashTransaction | undefined>;
|
|
4
|
+
export declare function isolationTarget(args: readonly string[]): IsolationTarget | undefined;
|
|
5
|
+
export declare function restoreTransaction(transaction: StashTransaction): Promise<void>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { StashTransaction } from "./isolation-failure-error.js";
|
|
2
|
+
export declare function errorMessage(error: unknown): string;
|
|
3
|
+
export declare function writeError(message: string): void;
|
|
4
|
+
export declare function writeProxyNotice(): void;
|
|
5
|
+
export declare function writeRecovery(transaction: StashTransaction): void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ChildProcess } from "node:child_process";
|
|
2
|
+
export interface ChildResult {
|
|
3
|
+
code: number;
|
|
4
|
+
error?: Error;
|
|
5
|
+
}
|
|
6
|
+
export type RelaySignal = "SIGHUP" | "SIGINT" | "SIGTERM";
|
|
7
|
+
export declare const signalExitCodes: Record<RelaySignal, number>;
|
|
8
|
+
export declare class SignalRelay {
|
|
9
|
+
private child;
|
|
10
|
+
private readonly handlers;
|
|
11
|
+
private received;
|
|
12
|
+
constructor();
|
|
13
|
+
lastSignal(): RelaySignal | undefined;
|
|
14
|
+
setChild(child?: ChildProcess): void;
|
|
15
|
+
start(): void;
|
|
16
|
+
stop(): void;
|
|
17
|
+
private forward;
|
|
18
|
+
}
|
|
19
|
+
export declare function resultForSignal(signal: NodeJS.Signals | null): ChildResult;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Markdown gets a structural linter, not a second formatter.
|
|
3
|
+
*
|
|
4
|
+
* Oxfmt owns how a Markdown file looks — and it owns the fenced code inside it too: measured on a
|
|
5
|
+
* file holding thirteen languages, it reformats `js`, `ts`, `tsx`, `json`, `css`, `yaml` and
|
|
6
|
+
* `graphql` blocks, byte-identical to what prettier writes. What no formatter reports is the
|
|
7
|
+
* structure: a fence with no language, a bare URL, a heading level that skips a step, a link whose
|
|
8
|
+
* fragment does not exist, a table whose rows disagree on column count. That is the whole job here
|
|
9
|
+
* — 42 findings on this repository's 45 Markdown files, none of which any other tool in the
|
|
10
|
+
* toolchain reports.
|
|
11
|
+
*
|
|
12
|
+
* Every rule that decides what the file _looks_ like is therefore off, and the list below says
|
|
13
|
+
* which of two reasons put it there. Leaving one on does not produce a second opinion, it produces
|
|
14
|
+
* a loop: the formatter writes its form, the linter reports it, and `dm check` fails on a file `dm
|
|
15
|
+
* fix` has just written.
|
|
16
|
+
*
|
|
17
|
+
* The types are written here rather than imported from the package. markdownlint-cli2 is a managed
|
|
18
|
+
* binary, not a dependency of this repository or of a consuming project, so there is nothing to
|
|
19
|
+
* import them from at build time — and pulling the package in as a devDependency to type a config
|
|
20
|
+
* object of six keys is a poor trade.
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* The markdownlint-cli2 configuration object — the shape a `.markdownlint-cli2.mjs` exports.
|
|
24
|
+
*/
|
|
25
|
+
export interface Config {
|
|
26
|
+
config?: MarkdownlintConfig;
|
|
27
|
+
customRules?: string[];
|
|
28
|
+
fix?: boolean;
|
|
29
|
+
frontMatter?: string;
|
|
30
|
+
gitignore?: boolean;
|
|
31
|
+
globs?: string[];
|
|
32
|
+
ignores?: string[];
|
|
33
|
+
markdownItPlugins?: unknown[];
|
|
34
|
+
modulePaths?: string[];
|
|
35
|
+
noBanner?: boolean;
|
|
36
|
+
noProgress?: boolean;
|
|
37
|
+
outputFormatters?: unknown[];
|
|
38
|
+
showFound?: boolean;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The `config` object: markdownlint's own rule configuration.
|
|
42
|
+
*/
|
|
43
|
+
export interface MarkdownlintConfig {
|
|
44
|
+
[rule: string]: null | RuleConfig | string | undefined;
|
|
45
|
+
default?: boolean;
|
|
46
|
+
extends?: null | string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* A markdownlint rule: off, on, or on with options.
|
|
50
|
+
*/
|
|
51
|
+
export type RuleConfig = boolean | Record<string, unknown>;
|
|
52
|
+
/**
|
|
53
|
+
* Merges one level deep, so `defineConfig({ config: { MD041: false } })` keeps the rule decisions
|
|
54
|
+
* above instead of replacing all of them with that one entry — the failure mode documented for
|
|
55
|
+
* oxlint, stylelint and oxfmt in AGENTS.md, and the one anyone writing this call would hit first.
|
|
56
|
+
* Replacing wholesale is the function form, where `base` is in hand.
|
|
57
|
+
*/
|
|
58
|
+
export declare const defineConfig: (config?: ((base: Config) => Config) | Config) => Config;
|
|
@@ -1,3 +1,13 @@
|
|
|
1
1
|
import { type OxfmtConfig } from "oxfmt";
|
|
2
2
|
export type { OxfmtConfig } from "oxfmt";
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Accepts an overrides object, shallow-merged over the base, or a function that receives the base
|
|
5
|
+
* and returns the final config — the latter is how a project extends `overrides` instead of
|
|
6
|
+
* replacing it:
|
|
7
|
+
*
|
|
8
|
+
* export default defineConfig((base) => ({
|
|
9
|
+
* ...base,
|
|
10
|
+
* overrides: [...(base.overrides ?? []), { files: ["*.md"], options: { printWidth: 80 } }],
|
|
11
|
+
* }));
|
|
12
|
+
*/
|
|
13
|
+
export declare const defineConfig: (config?: ((base: OxfmtConfig) => OxfmtConfig) | OxfmtConfig) => OxfmtConfig;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,2 +1,90 @@
|
|
|
1
1
|
import type { Oxlintrc } from "./schema";
|
|
2
|
+
export type { Oxlintrc } from "./schema";
|
|
3
|
+
/**
|
|
4
|
+
* The part of a `package.json` this config reads.
|
|
5
|
+
*
|
|
6
|
+
* Deliberately narrower than type-fest's `PackageJson`, which is what the ESLint half takes: a
|
|
7
|
+
* `with { type: "json" }` import hands TypeScript the literal shape of the consumer's own manifest,
|
|
8
|
+
* and the wide type does not always accept it — `exports` and `bin` are the usual casualties. Every
|
|
9
|
+
* real manifest satisfies this one, and it says exactly what is looked at.
|
|
10
|
+
*/
|
|
11
|
+
export interface OxlintPackageJson {
|
|
12
|
+
dependencies?: Partial<Record<string, string>> | undefined;
|
|
13
|
+
devDependencies?: Partial<Record<string, string>> | undefined;
|
|
14
|
+
optionalDependencies?: Partial<Record<string, string>> | undefined;
|
|
15
|
+
peerDependencies?: Partial<Record<string, string>> | undefined;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The oxlint half of the shared lint configuration.
|
|
19
|
+
*
|
|
20
|
+
* Every category is on, including `restriction` — which, unlike the others, is not a quality bar
|
|
21
|
+
* but a bag of project-specific bans that oxlint expects you to opt into one rule at a time.
|
|
22
|
+
* Turning it on lights up every rule at once, so the ones this stack does not want are turned off
|
|
23
|
+
* by name in `src/lint-rules` rather than by leaving the category off. A project that wants the
|
|
24
|
+
* backlog rules back on re-enables them in its own `.oxlintrc.json`, which extends this one.
|
|
25
|
+
*
|
|
26
|
+
* That list is shared with ESLint on purpose. `eslint-plugin-oxlint` suppresses an ESLint rule only
|
|
27
|
+
* while oxlint is _reporting_ the equivalent, so turning a rule off here used to hand it straight
|
|
28
|
+
* back to ESLint — the same finding, same file, still failing, now under a different rule name.
|
|
29
|
+
* Feeding both tools the same list is what stops that.
|
|
30
|
+
*
|
|
31
|
+
* No `$schema`: this is consumed as a TypeScript module, where the `Oxlintrc` type does the job a
|
|
32
|
+
* JSON schema reference used to.
|
|
33
|
+
*/
|
|
2
34
|
export declare const oxlintConfig: Oxlintrc;
|
|
35
|
+
/**
|
|
36
|
+
* Options a consumer's `oxlint.config.mts` can pass, mirroring the ESLint half's.
|
|
37
|
+
*/
|
|
38
|
+
export interface OxlintDefineConfigOptions {
|
|
39
|
+
/**
|
|
40
|
+
* Apply the shared migration backlog — the rules in `src/lint-rules/temporary` that should be on
|
|
41
|
+
* and are off only until the code is ready for them. Defaults to `true`.
|
|
42
|
+
*
|
|
43
|
+
* The ESLint half has had this since it was written; oxlint's did not, because
|
|
44
|
+
* `disabledRulesForOxlint()` was called with no arguments at module scope and `defineConfig` had
|
|
45
|
+
* nowhere to put an option. So `defineConfig(pkg, config, { temporaryRules: false })` raised the
|
|
46
|
+
* bar in ESLint while oxlint kept every backlog rule off — and since `eslint-plugin-oxlint`
|
|
47
|
+
* suppresses whatever oxlint reports, the documented "we are already clean, opt out" path made
|
|
48
|
+
* the config quieter in the one place it claimed to make it stricter.
|
|
49
|
+
*/
|
|
50
|
+
temporaryRules?: boolean | undefined;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* {@link oxlintConfig} narrowed to a project: framework plugins it does not depend on removed, and
|
|
54
|
+
* the migration backlog dropped if it opted out.
|
|
55
|
+
*
|
|
56
|
+
* Exported so the ESLint half can build its `eslint-plugin-oxlint` suppressions from the same
|
|
57
|
+
* config the project's oxlint run uses. That plugin turns an ESLint rule off on the premise that
|
|
58
|
+
* oxlint is reporting the equivalent — so handing it a config claiming plugins the project does not
|
|
59
|
+
* have, or turn-offs the project opted out of, would suppress rules nothing reports.
|
|
60
|
+
*/
|
|
61
|
+
export declare function oxlintConfigFor(packageJSON?: OxlintPackageJson, options?: OxlintDefineConfigOptions): Oxlintrc;
|
|
62
|
+
/**
|
|
63
|
+
* The entry point a consumer's `oxlint.config.mts` calls.
|
|
64
|
+
*
|
|
65
|
+
* Takes the project's `package.json` first, the way the ESLint half's `defineConfig` does and for
|
|
66
|
+
* the same reason: which framework plugins run is a question about the project, and the manifest is
|
|
67
|
+
* the only place the answer is written down. Passing nothing keeps every plugin, so a config
|
|
68
|
+
* generated before this parameter existed behaves as it did.
|
|
69
|
+
*
|
|
70
|
+
* Then either an overrides object, shallow-merged over the base, or a function that receives the
|
|
71
|
+
* base and returns the final config — the latter for extending an array or object field instead of
|
|
72
|
+
* replacing it:
|
|
73
|
+
*
|
|
74
|
+
* ```ts
|
|
75
|
+
* export default defineConfig(packageJSON, (base) => ({
|
|
76
|
+
* ...base,
|
|
77
|
+
* overrides: [...(base.overrides ?? []), { files: ["src/legacy/**"], rules: { … } }],
|
|
78
|
+
* }));
|
|
79
|
+
* ```
|
|
80
|
+
*
|
|
81
|
+
* The object form adds to the base rather than replacing the keys it names — see
|
|
82
|
+
* {@link mergeConfig}. The function form is what to reach for when the base genuinely has to be
|
|
83
|
+
* replaced or reordered.
|
|
84
|
+
*
|
|
85
|
+
* This is what a JSON config could not do. `extends` in a JSON config carries `rules`, `plugins`
|
|
86
|
+
* and `overrides` and silently drops `env`, `globals`, `settings`, `ignorePatterns` and `options`,
|
|
87
|
+
* so half of what this file decides never reached the project that extended it. Composing objects
|
|
88
|
+
* in JS has nothing to drop.
|
|
89
|
+
*/
|
|
90
|
+
export declare const defineConfig: (packageJSON?: OxlintPackageJson, config?: ((base: Oxlintrc) => Oxlintrc) | Oxlintrc, options?: OxlintDefineConfigOptions) => Oxlintrc;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { LintPluginOptionsSchema } from "./schema";
|
|
2
|
+
export declare const OXLINT_PLUGINS: readonly ["eslint", "import", "jsdoc", "jsx-a11y", "nextjs", "node", "oxc", "promise", "react", "react-perf", "typescript", "unicorn", "vitest", "vue"];
|
|
3
|
+
/**
|
|
4
|
+
* Plugins deliberately left off. The reasons live in scripts/generate-oxlint-plugins.ts; they are
|
|
5
|
+
* exported so the inventory validator can tell a decision apart from an oversight.
|
|
6
|
+
*/
|
|
7
|
+
export declare const OXLINT_EXCLUDED_PLUGINS: readonly ["jest"];
|
|
8
|
+
/**
|
|
9
|
+
* Fails the typecheck if a plugin is neither enabled nor deliberately excluded — including one the
|
|
10
|
+
* next oxlint bump adds. Dropping a plugin from the array by hand is a compile error rather than a
|
|
11
|
+
* quietly narrower lint.
|
|
12
|
+
*/
|
|
13
|
+
export type _EveryOxlintPluginIsAccountedFor = AssertNever<Exclude<LintPluginOptionsSchema, (typeof OXLINT_EXCLUDED_PLUGINS)[number] | (typeof OXLINT_PLUGINS)[number]>>;
|
|
14
|
+
type AssertNever<T extends never> = T;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Alphabetical key sorting for `.properties`, done on the text rather than through a data model.
|
|
3
|
+
*
|
|
4
|
+
* The previous sorter piped the file through YAML (`yq -p props -o props 'sort_keys(..)'`), and
|
|
5
|
+
* that round trip is lossy: YAML reads `a.b` as `b` nested under `a`, so a file holding both
|
|
6
|
+
* `a.b=hello` and `a=world` came back as `a = world` alone — one line silently gone. Java
|
|
7
|
+
* properties has no nesting; a dot is an ordinary character in a key.
|
|
8
|
+
*
|
|
9
|
+
* So nothing here parses values. A record is "whatever comment and blank lines precede a key line,
|
|
10
|
+
* plus that key line and its continuations", records are ordered by key, and every byte of each
|
|
11
|
+
* record is written back untouched. What cannot be lost this way: escapes, duplicate keys, unicode
|
|
12
|
+
* escapes, `:` or space as the separator, trailing whitespace inside a value.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Returns the file with its records ordered by key, or the original text when there is nothing to
|
|
16
|
+
* reorder. Trailing comments and blank lines — the ones that follow the last key — stay at the end,
|
|
17
|
+
* where their author put them.
|
|
18
|
+
*/
|
|
19
|
+
export declare const sortProperties: (source: string) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Config } from "stylelint";
|
|
2
|
+
export type { Config } from "stylelint";
|
|
3
|
+
/**
|
|
4
|
+
* Accepts an overrides object — added to the base rather than replacing the keys it names, see
|
|
5
|
+
* {@link mergeConfig} — or a function that receives the base and returns the final config, which is
|
|
6
|
+
* how a project replaces wholesale:
|
|
7
|
+
*
|
|
8
|
+
* export default defineConfig((base) => ({
|
|
9
|
+
* ...base,
|
|
10
|
+
* rules: { ...base.rules, "selector-class-pattern": null },
|
|
11
|
+
* }));
|
|
12
|
+
*/
|
|
13
|
+
export declare const defineConfig: (config?: ((base: Config) => Config) | Config) => Config;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Config } from "stylelint";
|
|
2
|
+
/**
|
|
3
|
+
* Adds the caller's config to the base instead of replacing the keys it names — the same decision,
|
|
4
|
+
* for the same reason, as `src/apps/oxlint/index.ts`.
|
|
5
|
+
*
|
|
6
|
+
* A spread was the obvious implementation and the wrong one. Everything that makes a component
|
|
7
|
+
* parse lives in `overrides`, so `defineConfig({ overrides: [{ files: ["*.css"], rules: … }] })` —
|
|
8
|
+
* the shape anyone would write to adjust one file type — dropped the `postcss-html` wiring along
|
|
9
|
+
* with it. Measured: `.svelte` then fails with `Unknown word <script>`, `.vue` with `Unknown word
|
|
10
|
+
* </style>`, and `.scss` with `Invalid double-slash CSS comment`. A config that silences a rule
|
|
11
|
+
* should not silently stop parsing three languages.
|
|
12
|
+
*
|
|
13
|
+
* Objects merge key by key, arrays append, and the caller still wins wherever they name the same
|
|
14
|
+
* key — `extends` and `overrides` are ordered last-wins in stylelint, so appending is what makes
|
|
15
|
+
* the caller's entry decide. Replacing wholesale is the function form of `defineConfig`.
|
|
16
|
+
*
|
|
17
|
+
* It lives in its own module so the merge can be tested without resolving the presets: `index.ts`
|
|
18
|
+
* turns every preset name into an absolute path in the managed app's install, which exists where
|
|
19
|
+
* stylelint runs and not in this repository.
|
|
20
|
+
*/
|
|
21
|
+
export declare function mergeConfig(base: Config, config?: Config): Config;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function fixtureEnvironment(overrides?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|