@entro314labs/markdownfix 0.0.11 → 0.0.13
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/ESLINT_INTEGRATION.md +19 -12
- package/README.md +8 -6
- package/cli.js +18 -15
- package/package.json +5 -5
package/ESLINT_INTEGRATION.md
CHANGED
|
@@ -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,15 +47,9 @@ While remark-lint handles markdown syntax and formatting, ESLint adds:
|
|
|
46
47
|
|
|
47
48
|
## Installation
|
|
48
49
|
|
|
49
|
-
### Local Installation (Project-specific)
|
|
50
|
-
|
|
51
|
-
```bash
|
|
52
|
-
pnpm add -D eslint eslint-plugin-mdx eslint-plugin-react
|
|
53
|
-
```
|
|
54
|
-
|
|
55
50
|
### Global Installation (Recommended)
|
|
56
51
|
|
|
57
|
-
Install `markdownfix` globally
|
|
52
|
+
Install `markdownfix` globally - **ESLint support is built-in**:
|
|
58
53
|
|
|
59
54
|
```bash
|
|
60
55
|
npm install -g @entro314labs/markdownfix
|
|
@@ -69,11 +64,22 @@ cd your-project
|
|
|
69
64
|
mdfix nuclear
|
|
70
65
|
```
|
|
71
66
|
|
|
72
|
-
|
|
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)
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
npm install -D @entro314labs/markdownfix
|
|
78
|
+
# or
|
|
79
|
+
pnpm add -D @entro314labs/markdownfix
|
|
80
|
+
```
|
|
73
81
|
|
|
74
|
-
|
|
75
|
-
- ✅ Fall back to bundled ESLint config if not found
|
|
76
|
-
- ✅ Always respect your local `.remarkrc.js` if present
|
|
82
|
+
ESLint dependencies are included automatically.
|
|
77
83
|
|
|
78
84
|
## Configuration Files
|
|
79
85
|
|
|
@@ -86,8 +92,9 @@ ESLint 9 flat config that:
|
|
|
86
92
|
- Enables code block linting
|
|
87
93
|
- Defines globals for documentation examples
|
|
88
94
|
|
|
89
|
-
**Note:** When `markdownfix` is installed globally
|
|
95
|
+
**Note:** When `markdownfix` is installed (globally or locally):
|
|
90
96
|
|
|
97
|
+
- ✅ ESLint dependencies are **always included** (opinionated approach)
|
|
91
98
|
- ✅ Uses local `eslint.config.js` if it exists
|
|
92
99
|
- ✅ Falls back to bundled config if not found
|
|
93
100
|
- ℹ️ Shows a message when using bundled config
|
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
|
|
@@ -341,13 +342,14 @@ Central configuration defining:
|
|
|
341
342
|
|
|
342
343
|
### `eslint.config.js` (Optional)
|
|
343
344
|
|
|
344
|
-
|
|
345
|
+
ESLint is **built-in** with opinionated defaults. Customize by creating `eslint.config.js` in your project:
|
|
345
346
|
|
|
346
|
-
**
|
|
347
|
+
**Default Behavior:**
|
|
347
348
|
|
|
348
|
-
- ✅
|
|
349
|
-
- ✅
|
|
350
|
-
-
|
|
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
|
|
351
353
|
|
|
352
354
|
**Custom Configuration:**
|
|
353
355
|
|
package/cli.js
CHANGED
|
@@ -238,20 +238,21 @@ 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
|
|
244
|
-
const
|
|
243
|
+
const eslintConfigInfo = await getEslintConfigPath();
|
|
244
|
+
const { configPath, source } = eslintConfigInfo;
|
|
245
245
|
|
|
246
|
-
if (!quiet &&
|
|
246
|
+
if (!quiet && source === 'bundled') {
|
|
247
247
|
console.log(' ℹ️ Using bundled ESLint config (no local config found)\n');
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
// Step 3: ESLint auto-fix
|
|
251
251
|
if (!quiet) console.log('Step 3/4: Running ESLint auto-fix...');
|
|
252
252
|
try {
|
|
253
|
-
|
|
254
|
-
const
|
|
253
|
+
// Quote each file path to handle spaces and special characters
|
|
254
|
+
const fileList = files.map(f => `"${f}"`).join(' ');
|
|
255
|
+
const eslintCmd = `npx eslint --config "${configPath}" --fix ${fileList}`;
|
|
255
256
|
|
|
256
257
|
try {
|
|
257
258
|
execSync(eslintCmd, {
|
|
@@ -273,8 +274,9 @@ async function runNuclearMode(files, options = {}) {
|
|
|
273
274
|
// Step 4: ESLint linting
|
|
274
275
|
if (!quiet) console.log('Step 4/4: Running ESLint linting...');
|
|
275
276
|
try {
|
|
276
|
-
|
|
277
|
-
const
|
|
277
|
+
// Quote each file path to handle spaces and special characters
|
|
278
|
+
const fileList = files.map(f => `"${f}"`).join(' ');
|
|
279
|
+
const eslintCmd = `npx eslint --config "${configPath}" ${fileList}`;
|
|
278
280
|
|
|
279
281
|
execSync(eslintCmd, {
|
|
280
282
|
stdio: quiet ? 'pipe' : 'inherit',
|
|
@@ -288,6 +290,7 @@ async function runNuclearMode(files, options = {}) {
|
|
|
288
290
|
if (!quiet) console.log(` ⚠️ ESLint linting found issues\n`);
|
|
289
291
|
}
|
|
290
292
|
} else {
|
|
293
|
+
// ESLint not installed
|
|
291
294
|
if (!quiet) {
|
|
292
295
|
console.log('Step 3/4: Skipping ESLint (not installed)');
|
|
293
296
|
console.log(' ℹ️ Install ESLint with: npm install -D eslint eslint-plugin-mdx\n');
|
|
@@ -332,22 +335,22 @@ async function checkEslintAvailable() {
|
|
|
332
335
|
|
|
333
336
|
/**
|
|
334
337
|
* Get ESLint config path
|
|
335
|
-
* Returns
|
|
338
|
+
* Returns local config if it exists, otherwise uses bundled config
|
|
339
|
+
* Since ESLint dependencies are included in the package, bundled config always works
|
|
336
340
|
*/
|
|
337
341
|
async function getEslintConfigPath() {
|
|
338
342
|
const localConfig = path.join(process.cwd(), 'eslint.config.js');
|
|
339
343
|
|
|
340
344
|
try {
|
|
341
345
|
await fs.access(localConfig);
|
|
342
|
-
|
|
346
|
+
// Local config exists - use it
|
|
347
|
+
return { configPath: localConfig, source: 'local' };
|
|
343
348
|
} catch {
|
|
344
|
-
// Use bundled config
|
|
349
|
+
// Use bundled config - dependencies are always available
|
|
345
350
|
const bundledConfig = new URL('./eslint.config.js', import.meta.url).pathname;
|
|
346
|
-
return bundledConfig;
|
|
351
|
+
return { configPath: bundledConfig, source: 'bundled' };
|
|
347
352
|
}
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
/**
|
|
353
|
+
}/**
|
|
351
354
|
* Initialize .remarkrc.js configuration
|
|
352
355
|
*/
|
|
353
356
|
async function initConfig() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@entro314labs/markdownfix",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
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.
|
|
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",
|