From 8403a0fa7d0d2eb7e5050c6257f24f12e617db67 Mon Sep 17 00:00:00 2001 From: Shinrai Date: Sat, 3 Oct 2026 23:49:42 -0700 Subject: [PATCH] fix(fix-headers): let @Last modified by follow real edits Set forceLastModifiedAuthorUpdate to false. With it on, every fix-headers run stamped whoever ran it as @Last modified by on every file. From fix-headers 2.2.0 (CLDMV/fix-headers#128) that field changes only when a file's content was edited, and a header-only rewrite just updates @Last modified time, so the force is no longer wanted. Also bump this repository's own @cldmv/fix-headers to 2.2.0 (no headers changed) and document 2.2.0 as the version the author rules need. Refs #15 --- README.md | 32 +++++++++++++++++--------------- fix-headers.json | 2 +- package-lock.json | 8 ++++---- package.json | 2 +- 4 files changed, 23 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index d838455..64902bb 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ The package has no runtime code and no dependencies. It ships the config files, ### Requirements -- A tool that can extend a shared config. For fix-headers that is **v2.0.0 or later**: `extends` arrives in [CLDMV/fix-headers#88](https://github.com/CLDMV/fix-headers/pull/88), and several of the options this config sets (`fixCreatedDate`, `normalizeDateFormat`, `strictCreatedDate`) in [CLDMV/fix-headers#67](https://github.com/CLDMV/fix-headers/pull/67). Older releases cannot resolve `extends` and ignore those options. +- A tool that can extend a shared config. For fix-headers that is **v2.0.0 or later**: `extends` arrives in [CLDMV/fix-headers#88](https://github.com/CLDMV/fix-headers/pull/88), and several of the options this config sets (`fixCreatedDate`, `normalizeDateFormat`, `strictCreatedDate`) in [CLDMV/fix-headers#67](https://github.com/CLDMV/fix-headers/pull/67). Older releases cannot resolve `extends` and ignore those options. Use **v2.2.0 or later** for the author rules: from 2.2.0, `@Last modified by` changes only when a file's content was edited ([CLDMV/fix-headers#128](https://github.com/CLDMV/fix-headers/pull/128)). ### Install @@ -107,7 +107,7 @@ Each file is exposed through `package.json` `exports`, so it resolves by its spe "companyName": "Catalyzed Motivation Inc.", "copyrightStartYear": 2013, "forceAuthorUpdate": false, - "forceLastModifiedAuthorUpdate": true, + "forceLastModifiedAuthorUpdate": false, "fixCreatedDate": true, "normalizeDateFormat": true, "strictCreatedDate": true, @@ -115,22 +115,24 @@ Each file is exposed through `package.json` `exports`, so it resolves by its spe } ``` -| Option | Value | Effect | -| ------------------------------- | ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | -| `includeFolders` | `["."]` | Scan the whole project; ignore files (`.gitignore` and everything else git honours) still exclude what they list | -| `useGpgSignerAuthor` | `true` | Take the `@Author` name from the user ID of the OpenPGP key git signs commits with | -| `company` | `"CLDMV"` | Write `@Author` as `Name ` | -| `companyName` | `"Catalyzed Motivation Inc."` | The copyright holder in `@Copyright`. fix-headers v2 has no built-in holder and otherwise reads it from the manifest author (`CLDMV`) | -| `copyrightStartYear` | `2013` | The first year of the `@Copyright` range, for every file | -| `forceAuthorUpdate` | `false` | Never rewrite an existing `@Author` / `@Email`; they record who created the file. A missing value is still filled in | -| `forceLastModifiedAuthorUpdate` | `true` | Always rewrite `@Last modified by` to the detected values | -| `fixCreatedDate` | `true` | Move an existing `@Date` back to the oldest of itself, the file's first git commit and its filesystem creation time | -| `normalizeDateFormat` | `true` | Write every header date in the git `%aI` form (`2026-03-01T17:59:32-08:00`) | -| `strictCreatedDate` | `true` | With `--check`, fail on an `@Date` later than the file's first commit or creation time instead of only warning | -| `margin` | `1` | One blank line between the header and the file's next content. The fix-headers default is two, which prettier collapses to one | +| Option | Value | Effect | +| ------------------------------- | ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `includeFolders` | `["."]` | Scan the whole project; ignore files (`.gitignore` and everything else git honours) still exclude what they list | +| `useGpgSignerAuthor` | `true` | Take the `@Author` name from the user ID of the OpenPGP key git signs commits with | +| `company` | `"CLDMV"` | Write `@Author` as `Name ` | +| `companyName` | `"Catalyzed Motivation Inc."` | The copyright holder in `@Copyright`. fix-headers v2 has no built-in holder and otherwise reads it from the manifest author (`CLDMV`) | +| `copyrightStartYear` | `2013` | The first year of the `@Copyright` range, for every file | +| `forceAuthorUpdate` | `false` | Never rewrite an existing `@Author` / `@Email`; they record who created the file. A missing value is still filled in | +| `forceLastModifiedAuthorUpdate` | `false` | `@Last modified by` follows real edits: it changes only when a file's content was edited, not when fix-headers only rewrites the header (fix-headers 2.2.0+) | +| `fixCreatedDate` | `true` | Move an existing `@Date` back to the oldest of itself, the file's first git commit and its filesystem creation time | +| `normalizeDateFormat` | `true` | Write every header date in the git `%aI` form (`2026-03-01T17:59:32-08:00`) | +| `strictCreatedDate` | `true` | With `--check`, fail on an `@Date` later than the file's first commit or creation time instead of only warning | +| `margin` | `1` | One blank line between the header and the file's next content. The fix-headers default is two, which prettier collapses to one | An existing `@Author` is never rewritten: it records who created the file, and this config sets `forceAuthorUpdate` to `false` explicitly so the decision is visible and wins over anything earlier in an `extends` chain. A repository can turn it on in its own config for a one-off migration of old author names. +`@Last modified by` records the last person to edit the file. With fix-headers 2.2.0 or later it changes only when the file's content was edited; a run that only rewrites the header (date format, spacing, a corrected `@Date`) updates `@Last modified time` but keeps `@Last modified by`. This config therefore sets `forceLastModifiedAuthorUpdate` to `false` as well. With fix-headers before 2.2.0 that setting keeps the existing `@Last modified by` on every run, so upgrade fix-headers alongside this config. + The full description of every option is in the [fix-headers README](https://github.com/CLDMV/fix-headers#readme). ### Using it by URL diff --git a/fix-headers.json b/fix-headers.json index d8be6a4..8673e1a 100644 --- a/fix-headers.json +++ b/fix-headers.json @@ -5,7 +5,7 @@ "companyName": "Catalyzed Motivation Inc.", "copyrightStartYear": 2013, "forceAuthorUpdate": false, - "forceLastModifiedAuthorUpdate": true, + "forceLastModifiedAuthorUpdate": false, "fixCreatedDate": true, "normalizeDateFormat": true, "strictCreatedDate": true, diff --git a/package-lock.json b/package-lock.json index bcd7d83..9d62604 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "license": "Apache-2.0", "devDependencies": { "@cldmv/eslint-plugin-jsonv": "^1.0.13", - "@cldmv/fix-headers": "^2.1.4", + "@cldmv/fix-headers": "^2.2.0", "@cldmv/jsonv": "^1.1.1", "@cldmv/prettier-plugin-jsonv": "^1.1.0", "@cldmv/vitest-runner": "^1.5.1", @@ -136,9 +136,9 @@ } }, "node_modules/@cldmv/fix-headers": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/@cldmv/fix-headers/-/fix-headers-2.1.4.tgz", - "integrity": "sha512-PvCKMztN9k+jOjEpMCANMaDIkNW7cs2qp5P73JVzResk1+DfqhoZVqT9jpTT8cUu+6OGszsNqj8/X0Q9IhfNtg==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@cldmv/fix-headers/-/fix-headers-2.2.0.tgz", + "integrity": "sha512-EQTAKCo0B639q2bde+vO5ciYbtvNgAJFm0DBthIJQnmTFJmQDUlObp5EsTRgg5CUlFoUnGMX+q35LC02QvYU4w==", "dev": true, "license": "Apache-2.0", "dependencies": { diff --git a/package.json b/package.json index be71208..48666b3 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,7 @@ }, "devDependencies": { "@cldmv/eslint-plugin-jsonv": "^1.0.13", - "@cldmv/fix-headers": "^2.1.4", + "@cldmv/fix-headers": "^2.2.0", "@cldmv/jsonv": "^1.1.1", "@cldmv/prettier-plugin-jsonv": "^1.1.0", "@cldmv/vitest-runner": "^1.5.1",