slopless 0.1.0 → 0.2.0

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
@@ -5,29 +5,23 @@ Deterministic textlint rules for catching slop in prose.
5
5
  ## Install
6
6
 
7
7
  ```bash
8
- npm install -D textlint slopless
8
+ npm install -D slopless
9
9
  ```
10
10
 
11
- ## Configure
11
+ ## Run
12
12
 
13
- Create `.textlintrc.json`:
13
+ Check Markdown files:
14
14
 
15
- ```json
16
- {
17
- "rules": {
18
- "preset-slopless": true
19
- }
20
- }
15
+ ```bash
16
+ npx slopless
21
17
  ```
22
18
 
23
- ## Run
24
-
25
19
  Add an npm script:
26
20
 
27
21
  ```json
28
22
  {
29
23
  "scripts": {
30
- "lint:prose": "textlint \"**/*.md\""
24
+ "lint:prose": "slopless"
31
25
  }
32
26
  }
33
27
  ```
@@ -38,13 +32,18 @@ Run it:
38
32
  npm run lint:prose
39
33
  ```
40
34
 
41
- ## CI Output
35
+ Check a specific path:
36
+
37
+ ```bash
38
+ npx slopless "docs/**/*.md"
39
+ ```
40
+
41
+ ## Output
42
42
 
43
- Use standard textlint formatters:
43
+ Output is always JSON.
44
44
 
45
45
  ```bash
46
- npx textlint "docs/**/*.md" --format stylish
47
- npx textlint "docs/**/*.md" --format json
46
+ npx slopless "docs/**/*.md" > slopless.json
48
47
  ```
49
48
 
50
49
  ## What It Checks
@@ -61,4 +60,3 @@ npx textlint "docs/**/*.md" --format json
61
60
  ## Requirements
62
61
 
63
62
  - Node.js 20 or newer
64
- - textlint 15
package/dist/cli.js ADDED
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env node
2
+ import { dirname, resolve } from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ import { cli } from "textlint/lib/src/cli.js";
5
+ const DEFAULT_TARGET = "**/*.md";
6
+ const FORMAT_FLAGS = new Set(["--format", "-f"]);
7
+ function hasFormatOverride(args) {
8
+ return args.some((arg, index) => FORMAT_FLAGS.has(arg) ||
9
+ arg.startsWith("--format=") ||
10
+ (index > 0 && FORMAT_FLAGS.has(args[index - 1] ?? "")));
11
+ }
12
+ function hasFileTarget(args) {
13
+ return args.some((arg) => !arg.startsWith("-"));
14
+ }
15
+ function packageNodeModules() {
16
+ const packageRoot = dirname(dirname(fileURLToPath(import.meta.url)));
17
+ return resolve(packageRoot, "..");
18
+ }
19
+ async function main() {
20
+ const userArgs = process.argv.slice(2);
21
+ if (hasFormatOverride(userArgs)) {
22
+ process.stderr.write("slopless always writes JSON output. Remove --format / -f.\n");
23
+ return 2;
24
+ }
25
+ const args = [
26
+ "node",
27
+ "slopless",
28
+ "--preset",
29
+ "slopless",
30
+ "--rules-base-directory",
31
+ packageNodeModules(),
32
+ "--format",
33
+ "json",
34
+ ...userArgs
35
+ ];
36
+ if (!hasFileTarget(userArgs)) {
37
+ args.push(DEFAULT_TARGET);
38
+ }
39
+ return cli.execute(args);
40
+ }
41
+ process.exitCode = await main();
42
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAE9C,MAAM,cAAc,GAAG,SAAS,CAAC;AACjC,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC;AAEjD,SAAS,iBAAiB,CAAC,IAAuB;IAChD,OAAO,IAAI,CAAC,IAAI,CACd,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CACb,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC;QACrB,GAAG,CAAC,UAAU,CAAC,WAAW,CAAC;QAC3B,CAAC,KAAK,GAAG,CAAC,IAAI,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CACzD,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CAAC,IAAuB;IAC5C,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;AAClD,CAAC;AAED,SAAS,kBAAkB;IACzB,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAErE,OAAO,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;AACpC,CAAC;AAED,KAAK,UAAU,IAAI;IACjB,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAEvC,IAAI,iBAAiB,CAAC,QAAQ,CAAC,EAAE,CAAC;QAChC,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,6DAA6D,CAC9D,CAAC;QACF,OAAO,CAAC,CAAC;IACX,CAAC;IAED,MAAM,IAAI,GAAG;QACX,MAAM;QACN,UAAU;QACV,UAAU;QACV,UAAU;QACV,wBAAwB;QACxB,kBAAkB,EAAE;QACpB,UAAU;QACV,MAAM;QACN,GAAG,QAAQ;KACZ,CAAC;IAEF,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC7B,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC5B,CAAC;IAED,OAAO,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC;AAED,OAAO,CAAC,QAAQ,GAAG,MAAM,IAAI,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "slopless",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Deterministic textlint rules for detecting slop in prose.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -13,6 +13,7 @@
13
13
  "url": "https://github.com/agent-quality-controls/slopless/issues"
14
14
  },
15
15
  "type": "module",
16
+ "main": "./dist/index.js",
16
17
  "engines": {
17
18
  "node": ">=20.0.0"
18
19
  },
@@ -30,6 +31,9 @@
30
31
  "dist",
31
32
  "README.md"
32
33
  ],
34
+ "bin": {
35
+ "slopless": "dist/cli.js"
36
+ },
33
37
  "exports": {
34
38
  ".": "./dist/index.js",
35
39
  "./families/metrics/avg-sentence-length": "./dist/families/metrics/avg-sentence-length.js",
@@ -82,18 +86,17 @@
82
86
  },
83
87
  "dependencies": {
84
88
  "@lunarisapp/readability": "^1.1.0",
89
+ "@textlint/ast-node-types": "15.6.1",
90
+ "@textlint/types": "15.6.1",
85
91
  "sentence-splitter": "5.0.1",
92
+ "textlint": "15.6.1",
86
93
  "textlint-rule-helper": "2.5.0",
87
94
  "textlint-util-to-string": "3.3.4"
88
95
  },
89
- "peerDependencies": {
90
- "textlint": "^15.6.1"
91
- },
92
96
  "devDependencies": {
93
97
  "@double-great/stylelint-a11y": "3.4.12",
94
98
  "@eslint-community/eslint-plugin-eslint-comments": "4.7.1",
95
- "@textlint/ast-node-types": "15.6.1",
96
- "@textlint/types": "15.6.1",
99
+ "@types/node": "^24.10.1",
97
100
  "@typescript-eslint/eslint-plugin": "8.59.3",
98
101
  "@typescript-eslint/parser": "8.59.3",
99
102
  "cspell": "10.0.0",
@@ -108,7 +111,6 @@
108
111
  "stylelint": "17.11.0",
109
112
  "stylelint-config-standard": "40.0.0",
110
113
  "stylelint-config-tailwindcss": "1.0.1",
111
- "textlint": "15.6.1",
112
114
  "type-coverage": "2.29.7",
113
115
  "typescript": "5.9.3"
114
116
  }