@entro314labs/markdownfix 0.0.10 → 0.0.12

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.
@@ -10,6 +10,7 @@ While remark-lint handles markdown syntax and formatting, ESLint adds:
10
10
  - **IDE integration** - Better VS Code support with ESLint extension
11
11
  - **Unified error reporting** - Consistent error format across tools
12
12
  - **Code quality checks** - Catch unused variables, syntax errors in examples
13
+ - **Built-in by default** - No extra installation needed, opinionated and ready to use
13
14
 
14
15
  ## Architecture
15
16
 
@@ -46,12 +47,40 @@ While remark-lint handles markdown syntax and formatting, ESLint adds:
46
47
 
47
48
  ## Installation
48
49
 
49
- Already installed in this project:
50
+ ### Global Installation (Recommended)
51
+
52
+ Install `markdownfix` globally - **ESLint support is built-in**:
53
+
54
+ ```bash
55
+ npm install -g @entro314labs/markdownfix
56
+ # or
57
+ pnpm add -g @entro314labs/markdownfix
58
+ ```
59
+
60
+ Then use anywhere:
61
+
62
+ ```bash
63
+ cd your-project
64
+ mdfix nuclear
65
+ ```
66
+
67
+ **ESLint is included by default:**
68
+
69
+ - ✅ `eslint` and `eslint-plugin-mdx` are bundled dependencies
70
+ - ✅ Works out of the box - no additional installation needed
71
+ - ✅ Uses bundled config automatically
72
+ - ✅ Override by creating local `eslint.config.js`
73
+
74
+ ### Local Installation (Project-specific)
50
75
 
51
76
  ```bash
52
- pnpm add -D eslint eslint-plugin-mdx eslint-plugin-react
77
+ npm install -D @entro314labs/markdownfix
78
+ # or
79
+ pnpm add -D @entro314labs/markdownfix
53
80
  ```
54
81
 
82
+ ESLint dependencies are included automatically.
83
+
55
84
  ## Configuration Files
56
85
 
57
86
  ### [eslint.config.js](./eslint.config.js)
@@ -63,6 +92,13 @@ ESLint 9 flat config that:
63
92
  - Enables code block linting
64
93
  - Defines globals for documentation examples
65
94
 
95
+ **Note:** When `markdownfix` is installed (globally or locally):
96
+
97
+ - ✅ ESLint dependencies are **always included** (opinionated approach)
98
+ - ✅ Uses local `eslint.config.js` if it exists
99
+ - ✅ Falls back to bundled config if not found
100
+ - ℹ️ Shows a message when using bundled config
101
+
66
102
  ### [.remarkrc.js](./.remarkrc.js)
67
103
 
68
104
  Existing remark configuration with 40+ lint rules. This is **automatically used** by ESLint via the `mdx/remark` rule.
@@ -135,6 +171,7 @@ pnpm test
135
171
  ```
136
172
 
137
173
  This runs `process:safe` which:
174
+
138
175
  1. Checks formatting (no writes)
139
176
  2. Runs remark-lint
140
177
  3. Runs ESLint
@@ -194,6 +231,7 @@ See [.remarkrc.js](./.remarkrc.js) for full configuration.
194
231
  ### Catching Code Block Issues
195
232
 
196
233
  **Before:**
234
+
197
235
  ```javascript
198
236
  function example() {
199
237
  var unused = "bad";
@@ -202,10 +240,12 @@ function example() {
202
240
  ```
203
241
 
204
242
  **ESLint warnings:**
243
+
205
244
  - `no-var`: Unexpected var, use let or const instead
206
245
  - `no-unused-vars`: 'unused' is assigned but never used
207
246
 
208
247
  **After:**
248
+
209
249
  ```javascript
210
250
  function greet(name) {
211
251
  return `Hello ${name}`;
@@ -217,6 +257,7 @@ console.log(greet("World"));
217
257
  ### Markdown Issues (remark-lint)
218
258
 
219
259
  **Before:**
260
+
220
261
  ```markdown
221
262
  #No Space After Hash
222
263
  - item 1
@@ -225,10 +266,12 @@ console.log(greet("World"));
225
266
  ```
226
267
 
227
268
  **Remark-lint errors:**
269
+
228
270
  - Headings must have space after `#`
229
271
  - List items need blank lines between them
230
272
 
231
273
  **After:**
274
+
232
275
  ```markdown
233
276
  # Proper Heading
234
277
 
@@ -246,6 +289,7 @@ Files are ignored via:
246
289
  2. **Remark** - [.remarkignore](./.remarkignore)
247
290
 
248
291
  Common ignored files:
292
+
249
293
  - `README.md`
250
294
  - `CHANGELOG.md`
251
295
  - `LICENSE`
package/README.md CHANGED
@@ -11,9 +11,10 @@ Built on the Remark ecosystem with strict, consistent formatting rules for devel
11
11
  - ✅ **MDX support** - JSX components in markdown with ESLint integration
12
12
  - ✅ **MDC syntax support** - Markdown Components for Nuxt Content
13
13
  - ✅ **Comprehensive linting** - 40+ remark-lint rules for quality and consistency
14
- - ✅ **Code block linting** - ESLint integration for JavaScript/JSX in code blocks
14
+ - ✅ **Code block linting** - ESLint integration built-in for JavaScript/JSX in code blocks
15
15
  - ✅ **Link validation** - Check for broken links
16
16
  - ✅ **Auto-fixing** - Automatically fix formatting issues
17
+ - ✅ **Zero config** - Works out of the box, customize if needed
17
18
  - ✅ **IDE integration** - Works with VS Code ESLint extension
18
19
 
19
20
  ## Installation
@@ -138,12 +139,14 @@ This is a warning message!
138
139
  ```
139
140
 
140
141
  **Perfect for:**
142
+
141
143
  - Nuxt Content projects
142
144
  - Component-driven documentation
143
145
  - Interactive markdown content
144
146
  - Vue.js documentation sites
145
147
 
146
148
  **File Usage:**
149
+
147
150
  - `.mdc` extension - Dedicated MDC files (like `.mdx` for JSX)
148
151
  - MDC syntax also works in `.md` and `.mdx` files
149
152
 
@@ -337,6 +340,35 @@ Central configuration defining:
337
340
  4. Lint presets + rules
338
341
  5. `remark-stringify` - Must be last
339
342
 
343
+ ### `eslint.config.js` (Optional)
344
+
345
+ ESLint is **built-in** with opinionated defaults. Customize by creating `eslint.config.js` in your project:
346
+
347
+ **Default Behavior:**
348
+
349
+ - ✅ ESLint and eslint-plugin-mdx are included in the package
350
+ - ✅ Automatically uses bundled config if no local config found
351
+ - ✅ Lints JavaScript/JSX in code blocks
352
+ - ✅ Works out of the box globally or locally
353
+
354
+ **Custom Configuration:**
355
+
356
+ Create `eslint.config.js` in your project to override defaults:
357
+
358
+ ```javascript
359
+ import * as mdxPlugin from 'eslint-plugin-mdx';
360
+
361
+ export default [
362
+ {
363
+ files: ['**/*.{md,mdx,mdc,mdd}'],
364
+ ...mdxPlugin.flat,
365
+ // Your custom rules here
366
+ }
367
+ ];
368
+ ```
369
+
370
+ See [ESLINT\_INTEGRATION.md](ESLINT_INTEGRATION.md) for full details.
371
+
340
372
  ### `.remarkignore`
341
373
 
342
374
  Files excluded from processing:
@@ -468,7 +500,7 @@ Desktop knowledge management application with MDD integration:
468
500
  ## Documentation
469
501
 
470
502
  - **[content/guides/style-guide.md](content/guides/style-guide.md)** - Style specifications
471
- - **[ESLINT_INTEGRATION.md](ESLINT_INTEGRATION.md)** - ESLint + MDX integration guide
503
+ - **[ESLINT\_INTEGRATION.md](ESLINT_INTEGRATION.md)** - ESLint + MDX integration guide
472
504
 
473
505
  ## Tech Stack
474
506
 
package/cli.js CHANGED
@@ -238,13 +238,20 @@ async function runNuclearMode(files, options = {}) {
238
238
  if (!quiet) console.log(` ✗ Remark linting failed: ${error.message}\n`);
239
239
  }
240
240
 
241
- // Step 3 & 4: ESLint (only if available)
241
+ // Step 3 & 4: ESLint (only if ESLint is available)
242
242
  if (hasEslint) {
243
+ const eslintConfigInfo = await getEslintConfigPath();
244
+ const { configPath, source } = eslintConfigInfo;
245
+
246
+ if (!quiet && source === 'bundled') {
247
+ console.log(' ℹ️ Using bundled ESLint config (no local config found)\n');
248
+ }
249
+
243
250
  // Step 3: ESLint auto-fix
244
251
  if (!quiet) console.log('Step 3/4: Running ESLint auto-fix...');
245
252
  try {
246
253
  const fileList = files.join(' ');
247
- const eslintCmd = `npx eslint --ext .md,.mdx,.mdc,.mdd --fix ${fileList}`;
254
+ const eslintCmd = `npx eslint --config "${configPath}" --fix ${fileList}`;
248
255
 
249
256
  try {
250
257
  execSync(eslintCmd, {
@@ -267,7 +274,7 @@ async function runNuclearMode(files, options = {}) {
267
274
  if (!quiet) console.log('Step 4/4: Running ESLint linting...');
268
275
  try {
269
276
  const fileList = files.join(' ');
270
- const eslintCmd = `npx eslint --ext .md,.mdx,.mdc,.mdd ${fileList}`;
277
+ const eslintCmd = `npx eslint --config "${configPath}" ${fileList}`;
271
278
 
272
279
  execSync(eslintCmd, {
273
280
  stdio: quiet ? 'pipe' : 'inherit',
@@ -281,6 +288,7 @@ async function runNuclearMode(files, options = {}) {
281
288
  if (!quiet) console.log(` ⚠️ ESLint linting found issues\n`);
282
289
  }
283
290
  } else {
291
+ // ESLint not installed
284
292
  if (!quiet) {
285
293
  console.log('Step 3/4: Skipping ESLint (not installed)');
286
294
  console.log(' ℹ️ Install ESLint with: npm install -D eslint eslint-plugin-mdx\n');
@@ -324,6 +332,23 @@ async function checkEslintAvailable() {
324
332
  }
325
333
 
326
334
  /**
335
+ * Get ESLint config path
336
+ * Returns local config if it exists, otherwise uses bundled config
337
+ * Since ESLint dependencies are included in the package, bundled config always works
338
+ */
339
+ async function getEslintConfigPath() {
340
+ const localConfig = path.join(process.cwd(), 'eslint.config.js');
341
+
342
+ try {
343
+ await fs.access(localConfig);
344
+ // Local config exists - use it
345
+ return { configPath: localConfig, source: 'local' };
346
+ } catch {
347
+ // Use bundled config - dependencies are always available
348
+ const bundledConfig = new URL('./eslint.config.js', import.meta.url).pathname;
349
+ return { configPath: bundledConfig, source: 'bundled' };
350
+ }
351
+ }/**
327
352
  * Initialize .remarkrc.js configuration
328
353
  */
329
354
  async function initConfig() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@entro314labs/markdownfix",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "description": "Opinionated markdown formatter and linter for MD, MDX, MDC, and MDD files using Remark/Unified ecosystem",
5
5
  "type": "module",
6
6
  "repository": {
@@ -45,9 +45,6 @@
45
45
  "author": "Dominikos Pritis",
46
46
  "license": "MIT",
47
47
  "devDependencies": {
48
- "eslint": "^9.38.0",
49
- "eslint-plugin-mdx": "^3.6.2",
50
- "eslint-plugin-react": "^7.37.5",
51
48
  "markdown-link-check": "^3.14.1",
52
49
  "remark-cli": "^12.0.1"
53
50
  },
@@ -59,6 +56,9 @@
59
56
  "@code-dot-org/remark-plugins": "^2.0.0",
60
57
  "@entro314labs/remark-mdd": "^0.0.10",
61
58
  "@theguild/remark-mermaid": "^0.3.0",
59
+ "eslint": "^9.38.0",
60
+ "eslint-plugin-mdx": "^3.6.2",
61
+ "eslint-plugin-react": "^7.37.5",
62
62
  "fumadocs-docgen": "^3.0.2",
63
63
  "glob": "^11.0.3",
64
64
  "js-yaml": "^4.1.0",
@@ -117,7 +117,7 @@
117
117
  "remark-rehype": "^11.1.2",
118
118
  "remark-stringify": "^11.0.0",
119
119
  "remark-toc": "^9.0.0",
120
- "remark-typography": "^0.6.36",
120
+ "remark-typography": "^0.7.0",
121
121
  "remark-validate-links": "^13.1.0",
122
122
  "to-vfile": "^8.0.0",
123
123
  "unified-lint-rule": "^3.0.1",
@@ -126,8 +126,8 @@
126
126
  },
127
127
  "scripts": {
128
128
  "lint": "remark . --quiet --frail",
129
- "lint:eslint": "eslint --ext .md,.mdx,.mdc,.mdd .",
130
- "lint:eslint:fix": "eslint --ext .md,.mdx,.mdc,.mdd --fix .",
129
+ "lint:eslint": "eslint --config eslint.config.js .",
130
+ "lint:eslint:fix": "eslint --config eslint.config.js --fix .",
131
131
  "lint:all": "pnpm run lint && pnpm run lint:eslint",
132
132
  "format": "remark . --output --quiet",
133
133
  "format:check": "remark . --quiet",