@howells/husky 0.2.2 → 0.2.3

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 CHANGED
@@ -63,7 +63,7 @@ Your `package.json` must have:
63
63
  - a `"prepush"` script appropriate to the repository, or both:
64
64
  - a `"typecheck"` script (e.g. `tsc --noEmit` or `turbo run typecheck`)
65
65
  - a `"lint"` script (e.g. `howells-lint` or `turbo run lint`)
66
- - inline or standard external lint-staged configuration; static inline commands use `howells-fix` (`howells-ox-fix` and `howells-format` remain accepted for projects mid-migration)
66
+ - inline or standard external lint-staged configuration appropriate to the project
67
67
 
68
68
  ## Why a package?
69
69
 
package/bin/detect.mjs CHANGED
@@ -5,15 +5,6 @@
5
5
  * around behaviour that is unit-testable in isolation.
6
6
  */
7
7
 
8
- // `howells-fix` is the current canonical @howells/lint fixer; `howells-ox-fix`
9
- // and `howells-format` are earlier names still in use by repos mid-migration.
10
- // Accept all three so a correct lint-staged config never draws a false warning.
11
- export const lintStagedFormatterCommands = [
12
- "howells-fix",
13
- "howells-ox-fix",
14
- "howells-format",
15
- ];
16
-
17
8
  export const recommendedLintStagedCommand = "howells-fix";
18
9
 
19
10
  // Standard configuration names supported by lint-staged. Package-level files
@@ -37,31 +28,6 @@ export function findLintStagedConfigFile(exists) {
37
28
  return lintStagedConfigFileNames.find((file) => exists(file));
38
29
  }
39
30
 
40
- /**
41
- * Flatten a lint-staged config object into the list of command strings it runs.
42
- * Values may be a single command string or an array of them.
43
- */
44
- export function lintStagedCommandValues(config) {
45
- return Object.values(config).flatMap((value) => {
46
- if (typeof value === "string") {
47
- return [value];
48
- }
49
- if (Array.isArray(value)) {
50
- return value.filter((item) => typeof item === "string");
51
- }
52
- return [];
53
- });
54
- }
55
-
56
- /**
57
- * True when a single lint-staged command invokes a supported Howells formatter.
58
- */
59
- export function usesSupportedFormatter(command) {
60
- return lintStagedFormatterCommands.some((formatter) =>
61
- command.includes(formatter)
62
- );
63
- }
64
-
65
31
  /**
66
32
  * Decide whether the primary `husky` spawn failed to launch and we should
67
33
  * fall back to `npx husky`. A spawn that launched but exited non-zero is not a
@@ -28,10 +28,8 @@ import path from "node:path";
28
28
  import {
29
29
  fallbackFailed,
30
30
  findLintStagedConfigFile,
31
- lintStagedCommandValues,
32
31
  recommendedLintStagedCommand,
33
32
  shouldUseNpxFallback,
34
- usesSupportedFormatter,
35
33
  } from "./detect.mjs";
36
34
 
37
35
  const scriptDir = import.meta.dirname;
@@ -131,22 +129,6 @@ if (existsSync(packageJsonPath)) {
131
129
  );
132
130
  }
133
131
 
134
- // Inline static configs can be checked directly. External JavaScript configs
135
- // may compute commands dynamically, so lint-staged owns their validation.
136
- const lsConfig = packageJson["lint-staged"];
137
- if (lsConfig) {
138
- const commands = lintStagedCommandValues(lsConfig);
139
- const usesHowells = commands.some(usesSupportedFormatter);
140
- if (!usesHowells) {
141
- console.warn(
142
- "[@howells/husky] Warning: lint-staged should use a supported Howells formatter."
143
- );
144
- console.warn(
145
- ` Expected: "*.{js,ts,jsx,tsx,json,jsonc,css}": "${recommendedLintStagedCommand}"`
146
- );
147
- }
148
- }
149
-
150
132
  // Projects can own an appropriately scoped pre-push gate. Older projects
151
133
  // retain the package's typecheck + lint fallback until they add one.
152
134
  const scripts = packageJson.scripts || {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@howells/husky",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Standardised git hooks for Howells projects. Immutable pre-commit and pre-push configuration.",
5
5
  "license": "MIT",
6
6
  "repository": {