@theholocron/lint-staged-config 8.2.4 → 8.4.2
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/dist/index.js +26 -4
- package/package.json +10 -8
package/dist/index.js
CHANGED
|
@@ -1,14 +1,36 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
1
2
|
//#region index.ts
|
|
2
3
|
/**
|
|
4
|
+
* `<tool> --write`/`<tool>` alone falls back to the tool's own auto-discovery
|
|
5
|
+
* of a local config file — unchanged from today, safe when a consuming repo
|
|
6
|
+
* hasn't adopted the shared `@theholocron/*-config` packages (or predates
|
|
7
|
+
* this fix). When the shared package *is* installed, point `--config`
|
|
8
|
+
* straight at its built entry point instead of relying on a local
|
|
9
|
+
* `prettier.config.ts`/`eslint.config.ts` that may no longer exist (epic
|
|
10
|
+
* #672 Phase 5, theholocron/holocron#680) — same requirement astromech's
|
|
11
|
+
* `resolveToolConfig()` already established for `holocron run <task>`
|
|
12
|
+
* (theholocron/holocron#676/#749) and `.husky/commit-msg`'s commitlint
|
|
13
|
+
* invocation. Resolved relative to the consuming repo's root, since
|
|
14
|
+
* `lint-staged` — like every git hook — always runs from there regardless
|
|
15
|
+
* of which subdirectory a staged file lives in.
|
|
16
|
+
*/
|
|
17
|
+
function resolveConfig(relativePath) {
|
|
18
|
+
return existsSync(relativePath) ? relativePath : null;
|
|
19
|
+
}
|
|
20
|
+
const prettierConfig = resolveConfig("node_modules/@theholocron/prettier-config/dist/index.js");
|
|
21
|
+
const eslintConfig = resolveConfig("node_modules/@theholocron/eslint-config/dist/bundles/library.js");
|
|
22
|
+
const prettierWrite = prettierConfig ? `prettier --config ${prettierConfig} --write` : "prettier --write";
|
|
23
|
+
const eslint = eslintConfig ? `eslint --config ${eslintConfig}` : "eslint";
|
|
24
|
+
/**
|
|
3
25
|
* @see https://github.com/lint-staged/lint-staged?tab=readme-ov-file#configuration
|
|
4
26
|
*/
|
|
5
27
|
const config = {
|
|
6
28
|
"*.css": "stylelint --fix",
|
|
7
|
-
"*.{js,jsx}": [
|
|
8
|
-
"*.md": [
|
|
9
|
-
"*.mdx": [
|
|
29
|
+
"*.{js,jsx}": [prettierWrite, eslint],
|
|
30
|
+
"*.md": [prettierWrite],
|
|
31
|
+
"*.mdx": [prettierWrite],
|
|
10
32
|
"*.scss": "stylelint --syntax=scss --fix",
|
|
11
|
-
"*.{ts,tsx}": [
|
|
33
|
+
"*.{ts,tsx}": [prettierWrite, eslint],
|
|
12
34
|
"package.json": "sort-package-json"
|
|
13
35
|
};
|
|
14
36
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/lint-staged-config",
|
|
3
|
-
"version": "8.2
|
|
3
|
+
"version": "8.4.2",
|
|
4
4
|
"description": "A Lint Staged configuration for linting code that has been staged in Git within the Galaxy.",
|
|
5
5
|
"homepage": "https://github.com/theholocron/configs/tree/main/packages/lint-staged-config#readme",
|
|
6
6
|
"bugs": "https://github.com/theholocron/configs/issues",
|
|
@@ -21,13 +21,14 @@
|
|
|
21
21
|
"type": "module",
|
|
22
22
|
"main": "dist/index.js",
|
|
23
23
|
"devDependencies": {
|
|
24
|
+
"@theholocron/cli": "5.0.0-alpha.3",
|
|
25
|
+
"@vitest/coverage-v8": "^4.1.10",
|
|
24
26
|
"husky": "^9.1.7",
|
|
25
27
|
"tsdown": "^0.22.14",
|
|
26
28
|
"typescript": "^5.9.3",
|
|
27
29
|
"vitest": "^4.1.10",
|
|
28
|
-
"@
|
|
29
|
-
"@theholocron/
|
|
30
|
-
"@theholocron/vitest-config": "8.2.4"
|
|
30
|
+
"@theholocron/tsconfig": "8.4.2",
|
|
31
|
+
"@theholocron/vitest-config": "8.4.2"
|
|
31
32
|
},
|
|
32
33
|
"exports": {
|
|
33
34
|
".": {
|
|
@@ -59,9 +60,10 @@
|
|
|
59
60
|
"releases": "https://github.com/theholocron/configs/releases",
|
|
60
61
|
"wiki": "https://github.com/theholocron/configs/wiki",
|
|
61
62
|
"scripts": {
|
|
62
|
-
"build": "tsdown",
|
|
63
|
-
"
|
|
64
|
-
"test": "vitest
|
|
65
|
-
"
|
|
63
|
+
"delivery.build": "tsdown",
|
|
64
|
+
"sourceQuality.staticAnalysis": "holocron run sourceQuality.staticAnalysis --",
|
|
65
|
+
"test:watch": "vitest",
|
|
66
|
+
"verification.typeSafety": "holocron run verification.typeSafety --",
|
|
67
|
+
"verification.unitTests": "holocron run verification.unitTests --"
|
|
66
68
|
}
|
|
67
69
|
}
|