slopless 0.2.16 → 0.2.18

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.
@@ -3,7 +3,6 @@ export const everything = {
3
3
  "affirmation-closers": true,
4
4
  "artifact-placeholders": true,
5
5
  "authority-padding": true,
6
- "avg-sentence-length": true,
7
6
  "blame-reframe": true,
8
7
  "body-action-density": true,
9
8
  "boilerplate-conclusion": true,
@@ -1,11 +1,9 @@
1
- import avgSentenceLength from "../rules/metrics/avg-sentence-length.js";
2
1
  import colemanLiau from "../rules/metrics/coleman-liau.js";
3
2
  import fleschKincaid from "../rules/metrics/flesch-kincaid.js";
4
3
  import gunningFog from "../rules/metrics/gunning-fog.js";
5
4
  import paragraphLength from "../rules/metrics/paragraph-length.js";
6
5
  import wordRepetition from "../rules/metrics/word-repetition.js";
7
6
  export const metricRules = {
8
- "avg-sentence-length": avgSentenceLength,
9
7
  "coleman-liau": colemanLiau,
10
8
  "flesch-kincaid": fleschKincaid,
11
9
  "gunning-fog": gunningFog,
@@ -633,6 +633,7 @@
633
633
  "spread like wildfire",
634
634
  "spring to life",
635
635
  "squeaky wheel gets the grease",
636
+ "stands as a testament to",
636
637
  "stands out like a sore thumb",
637
638
  "start from scratch",
638
639
  "stick in the mud",
@@ -3,7 +3,6 @@
3
3
  "activate the right levers",
4
4
  "apples to apples",
5
5
  "bang for your buck",
6
- "best-in-class solution",
7
6
  "circle back around",
8
7
  "customer-centric innovation",
9
8
  "cross-functional stakeholders",
@@ -35,6 +34,12 @@
35
34
  "synergies across the value chain",
36
35
  "synergy",
37
36
  "take this offline",
37
+ "table stakes",
38
+ "next-level",
39
+ "supercharge",
40
+ "world-class",
41
+ "best-in-class",
42
+ "north star",
38
43
  "think outside the box",
39
44
  "thrown under the bus",
40
45
  "unlock our full potential",
@@ -36,6 +36,21 @@ const PREVIEW_OBJECTS = [
36
36
  const PREVIEW_VERBS = ["explore", "discuss", "examine", "cover"];
37
37
  const REASON_STARTERS = ["reason", "factor", "point", "thing"];
38
38
  const ORDINAL_STARTERS = ["one", "another"];
39
+ // Sentence-initial filler that advertises honesty or clears the throat before
40
+ // the point. Anchored to the start of the sentence to stay low false-positive
41
+ // ("she spoke frankly" does not match; "Frankly, ..." does).
42
+ const FILLER_OPENERS = [
43
+ "to be clear",
44
+ "to be honest",
45
+ "let me be clear",
46
+ "let me be honest",
47
+ "in all honesty",
48
+ "here's the thing",
49
+ "here's the kicker",
50
+ "honestly",
51
+ "frankly",
52
+ "candidly"
53
+ ];
39
54
  function matchEnumerationPreface(words) {
40
55
  if (words.some((word) => VAGUE_INTROS.includes(word)) &&
41
56
  words.some((word) => CATEGORY_WORDS.includes(word)) &&
@@ -81,6 +96,13 @@ function matchBoilerplateFraming(sentence) {
81
96
  if (starter !== undefined) {
82
97
  matches.push(starter);
83
98
  }
99
+ const lowered = stripped
100
+ .toLocaleLowerCase("en")
101
+ .replaceAll(String.fromCharCode(0x2019), "'");
102
+ const filler = FILLER_OPENERS.find((opener) => lowered.startsWith(opener));
103
+ if (filler !== undefined) {
104
+ matches.push(filler);
105
+ }
84
106
  return matches;
85
107
  }
86
108
  const rule = oneToOneRule({
@@ -1,18 +1,8 @@
1
1
  import { allParagraphs } from "./sections.js";
2
- import { splitSentences } from "./sentences.js";
3
- import { wordTokens } from "./tokens.js";
4
2
  export function documentText(document) {
5
3
  return allParagraphs(document)
6
4
  .map((paragraph) => paragraph.text.trim())
7
5
  .filter((text) => text.length > 0)
8
6
  .join("\n\n");
9
7
  }
10
- export function documentMetrics(document) {
11
- const text = documentText(document);
12
- return {
13
- sentenceCount: splitSentences(text).length,
14
- text,
15
- wordCount: wordTokens(text).length
16
- };
17
- }
18
8
  //# sourceMappingURL=document.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "slopless",
3
- "version": "0.2.16",
3
+ "version": "0.2.18",
4
4
  "description": "Deterministic textlint rules and CLI for catching prose slop in English Markdown.",
5
5
  "keywords": [
6
6
  "textlint",
@@ -52,7 +52,6 @@
52
52
  "./rules/academic-slop/academic-boilerplate": "./dist/rules/academic-slop/academic-boilerplate.js",
53
53
  "./rules/academic-slop/academic-formula-frames": "./dist/rules/academic-slop/academic-formula-frames.js",
54
54
  "./rules/academic-slop/tortured-phrases": "./dist/rules/academic-slop/tortured-phrases.js",
55
- "./rules/metrics/avg-sentence-length": "./dist/rules/metrics/avg-sentence-length.js",
56
55
  "./rules/metrics/coleman-liau": "./dist/rules/metrics/coleman-liau.js",
57
56
  "./rules/metrics/flesch-kincaid": "./dist/rules/metrics/flesch-kincaid.js",
58
57
  "./rules/metrics/gunning-fog": "./dist/rules/metrics/gunning-fog.js",
@@ -1,34 +0,0 @@
1
- import { documentMetrics } from "../../shared/text/document.js";
2
- import { oneToOneRule } from "../private/textlint-rule-builders.js";
3
- const MAX_WORDS = 24;
4
- function isDocumentNode(node) {
5
- return node.type === "Document" && "children" in node;
6
- }
7
- const rule = oneToOneRule({
8
- detect: (unit) => {
9
- if (!isDocumentNode(unit.node)) {
10
- return [];
11
- }
12
- const metrics = documentMetrics(unit.node);
13
- if (metrics.sentenceCount === 0) {
14
- return [];
15
- }
16
- const average = Math.floor(metrics.wordCount / metrics.sentenceCount);
17
- if (average <= MAX_WORDS) {
18
- return [];
19
- }
20
- return [
21
- {
22
- evidence: String(average),
23
- label: "average sentence length",
24
- range: { start: 0, end: 0 }
25
- }
26
- ];
27
- },
28
- family: "metrics",
29
- formatMessage: (report) => `Average sentence length is ${report.evidence} words. Keep it at ${MAX_WORDS} or fewer.`,
30
- ruleId: "metrics:avg-sentence-length",
31
- unitKind: "document"
32
- });
33
- export default rule;
34
- //# sourceMappingURL=avg-sentence-length.js.map