slopfix 0.1.0 → 0.1.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.fr.md CHANGED
@@ -8,6 +8,8 @@ Un linter sans dépendance pour les tics d'écriture IA : tirets cadratins, `ce
8
8
 
9
9
  [Essayer dans le navigateur](https://zwarmex.github.io/slopfix/) · [English](README.md)
10
10
 
11
+ <img src="assets/demo.gif" alt="slopfix surligne 11 tics d'écriture IA, en corrige 9 avec --fix, et le score passe de 96 à 0 après une courte réécriture" width="800">
12
+
11
13
  </div>
12
14
 
13
15
  ```bash
package/README.md CHANGED
@@ -13,6 +13,8 @@ A zero dependency linter for AI writing tells: em dashes, `it's not X, it's Y`,
13
13
 
14
14
  [Try it in your browser](https://zwarmex.github.io/slopfix/) · [Français](README.fr.md)
15
15
 
16
+ <img src="assets/demo.gif" alt="slopfix highlights 11 AI writing tells, fixes 9 of them with --fix, and the score drops from 96 to 0 after a short rewrite" width="800">
17
+
16
18
  </div>
17
19
 
18
20
  ```bash
@@ -149,7 +151,7 @@ jobs:
149
151
  ```yaml
150
152
  repos:
151
153
  - repo: https://github.com/Zwarmex/slopfix
152
- rev: v0.1.0
154
+ rev: v0.1.1
153
155
  hooks:
154
156
  - id: slopfix
155
157
  ```
package/index.d.ts CHANGED
@@ -55,6 +55,8 @@ export interface Hit {
55
55
  length: number;
56
56
  fix?: string | null;
57
57
  fixLabel?: string;
58
+ /** Length of the text the fix replaces, when it differs from the reported length. */
59
+ fixLength?: number;
58
60
  message?: string;
59
61
  quote?: string;
60
62
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "slopfix",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Find and fix AI writing tells (em dashes, \"it's not X, it's Y\", delve, chatbot leftovers) in English and French. Zero dependencies. CLI, library, GitHub Action.",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
package/src/index.js CHANGED
@@ -126,7 +126,7 @@ export function lint(text, options) {
126
126
  fix:
127
127
  hit.fix === undefined || hit.fix === null
128
128
  ? undefined
129
- : { range: [hit.index, hit.index + hit.length], text: hit.fix, label: hit.fixLabel ?? (hit.fix === '' ? '(remove)' : undefined) },
129
+ : { range: [hit.index, hit.index + (hit.fixLength ?? hit.length)], text: hit.fix, label: hit.fixLabel ?? (hit.fix === '' ? '(remove)' : undefined) },
130
130
  });
131
131
  }
132
132
  }
@@ -57,7 +57,8 @@ export function phraseRule({ id, lang, category, severity, message, phrases, dro
57
57
  const next = m[3] || '';
58
58
  const opensSentence = isUpper(matched[0]);
59
59
  const fixedNext = opensSentence ? next.toUpperCase() : next;
60
- yield { index: m.index, length: m[0].length, fix: fixedNext, fixLabel: '(remove)', quote: matched };
60
+ // Report only the phrase, but let the fix also re-case the letter that follows it.
61
+ yield { index: m.index, length: matched.length, fixLength: m[0].length, fix: fixedNext, fixLabel: '(remove)', quote: matched };
61
62
  } else {
62
63
  const fix = entry && entry.replacement !== undefined ? matchCase(entry.replacement, matched) : undefined;
63
64
  yield { index: m.index, length: matched.length, fix, quote: matched };