@entro314labs/markdownfix 0.0.11 → 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.
- package/ESLINT_INTEGRATION.md +19 -12
- package/README.md +8 -6
- package/cli.js +14 -13
- 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,12 +238,12 @@ 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
|
|
|
@@ -251,7 +251,7 @@ async function runNuclearMode(files, options = {}) {
|
|
|
251
251
|
if (!quiet) console.log('Step 3/4: Running ESLint auto-fix...');
|
|
252
252
|
try {
|
|
253
253
|
const fileList = files.join(' ');
|
|
254
|
-
const eslintCmd = `npx eslint --config "${
|
|
254
|
+
const eslintCmd = `npx eslint --config "${configPath}" --fix ${fileList}`;
|
|
255
255
|
|
|
256
256
|
try {
|
|
257
257
|
execSync(eslintCmd, {
|
|
@@ -274,7 +274,7 @@ async function runNuclearMode(files, options = {}) {
|
|
|
274
274
|
if (!quiet) console.log('Step 4/4: Running ESLint linting...');
|
|
275
275
|
try {
|
|
276
276
|
const fileList = files.join(' ');
|
|
277
|
-
const eslintCmd = `npx eslint --config "${
|
|
277
|
+
const eslintCmd = `npx eslint --config "${configPath}" ${fileList}`;
|
|
278
278
|
|
|
279
279
|
execSync(eslintCmd, {
|
|
280
280
|
stdio: quiet ? 'pipe' : 'inherit',
|
|
@@ -288,6 +288,7 @@ async function runNuclearMode(files, options = {}) {
|
|
|
288
288
|
if (!quiet) console.log(` ⚠️ ESLint linting found issues\n`);
|
|
289
289
|
}
|
|
290
290
|
} else {
|
|
291
|
+
// ESLint not installed
|
|
291
292
|
if (!quiet) {
|
|
292
293
|
console.log('Step 3/4: Skipping ESLint (not installed)');
|
|
293
294
|
console.log(' ℹ️ Install ESLint with: npm install -D eslint eslint-plugin-mdx\n');
|
|
@@ -332,22 +333,22 @@ async function checkEslintAvailable() {
|
|
|
332
333
|
|
|
333
334
|
/**
|
|
334
335
|
* Get ESLint config path
|
|
335
|
-
* Returns
|
|
336
|
+
* Returns local config if it exists, otherwise uses bundled config
|
|
337
|
+
* Since ESLint dependencies are included in the package, bundled config always works
|
|
336
338
|
*/
|
|
337
339
|
async function getEslintConfigPath() {
|
|
338
340
|
const localConfig = path.join(process.cwd(), 'eslint.config.js');
|
|
339
341
|
|
|
340
342
|
try {
|
|
341
343
|
await fs.access(localConfig);
|
|
342
|
-
|
|
344
|
+
// Local config exists - use it
|
|
345
|
+
return { configPath: localConfig, source: 'local' };
|
|
343
346
|
} catch {
|
|
344
|
-
// Use bundled config
|
|
347
|
+
// Use bundled config - dependencies are always available
|
|
345
348
|
const bundledConfig = new URL('./eslint.config.js', import.meta.url).pathname;
|
|
346
|
-
return bundledConfig;
|
|
349
|
+
return { configPath: bundledConfig, source: 'bundled' };
|
|
347
350
|
}
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
/**
|
|
351
|
+
}/**
|
|
351
352
|
* Initialize .remarkrc.js configuration
|
|
352
353
|
*/
|
|
353
354
|
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.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.
|
|
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",
|