eslint-mdx
Advanced tools
Comparing version 1.17.0 to 2.0.0-next.0
{ | ||
"name": "eslint-mdx", | ||
"version": "1.17.0", | ||
"version": "2.0.0-next.0", | ||
"description": "ESLint Parser for MDX", | ||
@@ -14,3 +14,3 @@ "repository": "git+https://github.com/mdx-js/eslint-mdx.git", | ||
"engines": { | ||
"node": ">=10.0.0" | ||
"node": ">=12.20" | ||
}, | ||
@@ -21,4 +21,3 @@ "main": "lib/index.js", | ||
"files": [ | ||
"lib", | ||
"typings.d.ts" | ||
"lib" | ||
], | ||
@@ -33,13 +32,14 @@ "keywords": [ | ||
"peerDependencies": { | ||
"eslint": ">=5.0.0" | ||
"eslint": ">=8.0.0" | ||
}, | ||
"dependencies": { | ||
"cosmiconfig": "^7.0.1", | ||
"remark-mdx": "^1.6.22", | ||
"remark-parse": "^8.0.3", | ||
"remark-stringify": "^8.1.1", | ||
"remark-mdx": "^2.1.0", | ||
"remark-parse": "^10.0.1", | ||
"remark-stringify": "^10.0.2", | ||
"synckit": "^0.6.0", | ||
"tslib": "^2.3.1", | ||
"unified": "^9.2.2" | ||
"unified": "^10.1.2" | ||
}, | ||
"gitHead": "16c5934530b2f55059dcb7695707f721a693a0d6" | ||
"gitHead": "bafa756a1da0e6aac954344d67b6f3ea7725befa" | ||
} |
133
README.md
@@ -37,4 +37,2 @@ <p align="center"> | ||
- [Rules](#rules) | ||
- [mdx/no-jsx-html-comments](#mdxno-jsx-html-comments) | ||
- [mdx/no-unused-expressions](#mdxno-unused-expressions) | ||
- [mdx/remark](#mdxremark) | ||
@@ -78,95 +76,17 @@ - [Prettier Integration](#prettier-integration) | ||
1. In your ESLint config file: | ||
1. In your ESLint 8+ config file, just add: | ||
1. If you're using `eslint >= 6.4.0`, just add: | ||
```jsonc | ||
{ | ||
"extends": ["plugin:mdx/recommended"], | ||
// optional, if you want to lint code blocks at the same time | ||
"settings": { | ||
"mdx/code-blocks": true, | ||
// optional, if you want to disable language mapper, set it to `false` | ||
// if you want to override the default language mapper inside, you can provide your own | ||
"mdx/language-mapper": {} | ||
} | ||
} | ||
``` | ||
```jsonc | ||
{ | ||
"extends": ["plugin:mdx/recommended"], | ||
// optional, if you want to lint code blocks at the same time | ||
"settings": { | ||
"mdx/code-blocks": true, | ||
// optional, if you want to disable language mapper, set it to `false` | ||
// if you want to override the default language mapper inside, you can provide your own | ||
"mdx/language-mapper": {} | ||
} | ||
} | ||
``` | ||
2. If you're using `eslint >=6.0.0 and <6.4.0`, add as following because it does not support overrides from npm pkg: | ||
```jsonc | ||
{ | ||
"extends": ["plugin:mdx/recommended"], | ||
// optional, if you want to lint code blocks at the same time | ||
"settings": { | ||
"mdx/code-blocks": true, | ||
// optional, if you want to disable language mapper, set it to `false` | ||
// if you want to override the default language mapper inside, you can provide your own | ||
"mdx/language-mapper": {} | ||
}, | ||
"overrides": [ | ||
{ | ||
"files": ["*.md"], | ||
"rules": { | ||
"prettier/prettier": [ | ||
2, | ||
{ | ||
// unnecessary if you're not using `eslint-plugin-prettier`, but required if you are | ||
"parser": "markdown" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"files": ["*.mdx"], | ||
"extends": ["plugin:mdx/overrides"] | ||
}, | ||
{ | ||
"files": "**/*.{md,mdx}/**", | ||
"extends": "plugin:mdx/code-blocks" | ||
} | ||
] | ||
} | ||
``` | ||
3. If you're using `eslint@^5.0.0`, you need to enable this parser/plugin manually, because `eslint@5` does not support `extends` for `overrides` property in its configuration: | ||
```js | ||
const configs = require('eslint-plugin-mdx/lib/configs') | ||
module.exports = { | ||
extends: ['plugin:mdx/recommended'], | ||
// optional, if you want to lint code blocks at the same time | ||
settings: { | ||
'mdx/code-blocks': true, | ||
// optional, if you want to disable language mapper, set it to `false` | ||
// if you want to override the default language mapper inside, you can provide your own | ||
'mdx/language-mapper': {}, | ||
}, | ||
overrides: [ | ||
{ | ||
files: ['*.md'], | ||
rules: { | ||
'prettier/prettier': [ | ||
2, | ||
{ | ||
// unnecessary if you're not using `eslint-plugin-prettier`, but required if you are | ||
parser: 'markdown', | ||
}, | ||
], | ||
}, | ||
}, | ||
{ | ||
files: ['*.mdx'], | ||
...configs.overrides, | ||
}, | ||
{ | ||
files: '**/*.{md,mdx}/**', | ||
...configs.codeBlocks, | ||
}, | ||
], | ||
} | ||
``` | ||
2. Make sure ESLint knows to run on `.md` or `.mdx` files: | ||
@@ -180,29 +100,10 @@ | ||
1. `parser` (`string | ParserConfig | ParserFn`): Custom parser for ES syntax is supported, although `@typescript-eslint/parser` or `@babel/eslint-parser` or `babel-eslint` will be detected automatically what means you actually do not need to do this: | ||
1. `extensions` (`string | string[]`): `eslint-mdx` will only resolve `.mdx` files by default, if you want to resolve other extensions as like `.mdx`, you can use this option. | ||
```json | ||
{ | ||
"extends": ["plugin:mdx/recommended"], | ||
"parserOptions": { | ||
"parser": "babel-eslint" | ||
} | ||
} | ||
``` | ||
2. `markdownExtensions` (`string | string[]`): `eslint-mdx` will only treat `.md` files as plain markdown by default, and will lint them via remark plugins. If you want to resolve other extensions as like `.md`, you can use this option. | ||
2. `extensions` (`string | string[]`): `eslint-mdx` will only resolve `.mdx` files by default, files with other extensions will be resolved by the `parser` option. If you want to resolve other extensions as like `.mdx`, you can use this option. | ||
3. `ignoreRemarkConfig` (`boolean`): Ignore the `remark` configuration defined in the project. | ||
3. `markdownExtensions` (`string | string[]`): `eslint-mdx` will only treat `.md` files as plain markdown by default, and will lint them via remark plugins. If you want to resolve other extensions as like `.md`, you can use this option. | ||
4. `ignoreRemarkConfig` (`boolean`): Ignore the `remark` configuration defined in the project. | ||
## Rules | ||
### mdx/no-jsx-html-comments | ||
_Fixable_: HTML style comments in jsx block is invalid, this rule will help you to fix it by transforming it to JSX style comments. | ||
### mdx/no-unused-expressions | ||
[MDX][] can render `jsx` block automatically without exporting them, but [ESLint][] will report `no-unused-expressions` issue which could be unexpected, this rule is the replacement, so make sure that you've turned off the original `no-unused-expressions` rule. | ||
### mdx/remark | ||
@@ -231,4 +132,2 @@ | ||
Some plugins are ESM and eslint don't supports them. So, a workaround is to set `ignoreRemarkConfig` to `true` and execute `remark-lint` through the terminal before running eslint. For example: `remark **/*.mdx --no-stdout && eslint . --fix --ext .mdx`. | ||
## Prettier Integration | ||
@@ -235,0 +134,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
1
10484
8
3
0
1
164
2
+ Addedsynckit@^0.6.0
+ Added@types/acorn@4.0.6(transitive)
+ Added@types/debug@4.1.12(transitive)
+ Added@types/estree-jsx@1.0.5(transitive)
+ Added@types/hast@2.3.10(transitive)
+ Added@types/mdast@3.0.15(transitive)
+ Added@types/ms@0.7.34(transitive)
+ Addedbail@2.0.2(transitive)
+ Addedccount@2.0.1(transitive)
+ Addedcharacter-entities@2.0.2(transitive)
+ Addedcharacter-entities-html4@2.1.0(transitive)
+ Addedcharacter-entities-legacy@3.0.0(transitive)
+ Addedcharacter-reference-invalid@2.0.1(transitive)
+ Addeddecode-named-character-reference@1.0.2(transitive)
+ Addeddequal@2.0.3(transitive)
+ Addeddiff@5.2.0(transitive)
+ Addedestree-util-is-identifier-name@2.1.0(transitive)
+ Addedestree-util-visit@1.2.1(transitive)
+ Addedis-alphabetical@2.0.1(transitive)
+ Addedis-alphanumerical@2.0.1(transitive)
+ Addedis-decimal@2.0.1(transitive)
+ Addedis-hexadecimal@2.0.1(transitive)
+ Addedis-plain-obj@4.1.0(transitive)
+ Addedkleur@4.1.5(transitive)
+ Addedlongest-streak@3.1.0(transitive)
+ Addedmdast-util-from-markdown@1.3.1(transitive)
+ Addedmdast-util-mdx@2.0.1(transitive)
+ Addedmdast-util-mdx-expression@1.3.2(transitive)
+ Addedmdast-util-mdx-jsx@2.1.4(transitive)
+ Addedmdast-util-mdxjs-esm@1.3.1(transitive)
+ Addedmdast-util-phrasing@3.0.1(transitive)
+ Addedmdast-util-to-markdown@1.5.0(transitive)
+ Addedmdast-util-to-string@3.2.0(transitive)
+ Addedmicromark@3.2.0(transitive)
+ Addedmicromark-core-commonmark@1.1.0(transitive)
+ Addedmicromark-extension-mdx-expression@1.0.8(transitive)
+ Addedmicromark-extension-mdx-jsx@1.0.5(transitive)
+ Addedmicromark-extension-mdx-md@1.0.1(transitive)
+ Addedmicromark-extension-mdxjs@1.0.1(transitive)
+ Addedmicromark-extension-mdxjs-esm@1.0.5(transitive)
+ Addedmicromark-factory-destination@1.1.0(transitive)
+ Addedmicromark-factory-label@1.1.0(transitive)
+ Addedmicromark-factory-mdx-expression@1.0.9(transitive)
+ Addedmicromark-factory-space@1.1.0(transitive)
+ Addedmicromark-factory-title@1.1.0(transitive)
+ Addedmicromark-factory-whitespace@1.1.0(transitive)
+ Addedmicromark-util-character@1.2.0(transitive)
+ Addedmicromark-util-chunked@1.1.0(transitive)
+ Addedmicromark-util-classify-character@1.1.0(transitive)
+ Addedmicromark-util-combine-extensions@1.1.0(transitive)
+ Addedmicromark-util-decode-numeric-character-reference@1.1.0(transitive)
+ Addedmicromark-util-decode-string@1.1.0(transitive)
+ Addedmicromark-util-encode@1.1.0(transitive)
+ Addedmicromark-util-events-to-acorn@1.2.3(transitive)
+ Addedmicromark-util-html-tag-name@1.2.0(transitive)
+ Addedmicromark-util-normalize-identifier@1.1.0(transitive)
+ Addedmicromark-util-resolve-all@1.1.0(transitive)
+ Addedmicromark-util-sanitize-uri@1.2.0(transitive)
+ Addedmicromark-util-subtokenize@1.1.0(transitive)
+ Addedmicromark-util-symbol@1.1.0(transitive)
+ Addedmicromark-util-types@1.1.0(transitive)
+ Addedmri@1.2.0(transitive)
+ Addedparse-entities@4.0.1(transitive)
+ Addedremark-mdx@2.3.0(transitive)
+ Addedremark-parse@10.0.2(transitive)
+ Addedremark-stringify@10.0.3(transitive)
+ Addedsade@1.8.1(transitive)
+ Addedstringify-entities@4.0.4(transitive)
+ Addedsynckit@0.6.2(transitive)
+ Addedtrough@2.2.0(transitive)
+ Addedunified@10.1.2(transitive)
+ Addedunist-util-is@5.2.1(transitive)
+ Addedunist-util-position-from-estree@1.1.2(transitive)
+ Addedunist-util-remove-position@4.0.2(transitive)
+ Addedunist-util-stringify-position@3.0.3(transitive)
+ Addedunist-util-visit@4.1.2(transitive)
+ Addedunist-util-visit-parents@5.1.3(transitive)
+ Addeduvu@0.5.6(transitive)
+ Addedvfile@5.3.7(transitive)
+ Addedvfile-message@3.1.4(transitive)
+ Addedzwitch@2.0.4(transitive)
- Removed@babel/core@7.12.9(transitive)
- Removed@babel/generator@7.25.7(transitive)
- Removed@babel/helper-module-imports@7.25.7(transitive)
- Removed@babel/helper-module-transforms@7.25.7(transitive)
- Removed@babel/helper-plugin-utils@7.10.47.25.7(transitive)
- Removed@babel/helper-simple-access@7.25.7(transitive)
- Removed@babel/helper-string-parser@7.25.7(transitive)
- Removed@babel/helpers@7.25.7(transitive)
- Removed@babel/parser@7.25.8(transitive)
- Removed@babel/plugin-proposal-object-rest-spread@7.12.1(transitive)
- Removed@babel/plugin-syntax-jsx@7.12.1(transitive)
- Removed@babel/plugin-syntax-object-rest-spread@7.8.3(transitive)
- Removed@babel/plugin-transform-parameters@7.25.7(transitive)
- Removed@babel/template@7.25.7(transitive)
- Removed@babel/traverse@7.25.7(transitive)
- Removed@babel/types@7.25.8(transitive)
- Removed@jridgewell/gen-mapping@0.3.5(transitive)
- Removed@jridgewell/resolve-uri@3.1.2(transitive)
- Removed@jridgewell/set-array@1.2.1(transitive)
- Removed@jridgewell/sourcemap-codec@1.5.0(transitive)
- Removed@jridgewell/trace-mapping@0.3.25(transitive)
- Removed@mdx-js/util@1.6.22(transitive)
- Removedbail@1.0.5(transitive)
- Removedccount@1.1.0(transitive)
- Removedcharacter-entities@1.2.4(transitive)
- Removedcharacter-entities-html4@1.1.4(transitive)
- Removedcharacter-entities-legacy@1.1.4(transitive)
- Removedcharacter-reference-invalid@1.1.4(transitive)
- Removedcollapse-white-space@1.0.6(transitive)
- Removedconvert-source-map@1.9.0(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedgensync@1.0.0-beta.2(transitive)
- Removedglobals@11.12.0(transitive)
- Removedhasown@2.0.2(transitive)
- Removedinherits@2.0.4(transitive)
- Removedis-alphabetical@1.0.4(transitive)
- Removedis-alphanumeric@1.0.0(transitive)
- Removedis-alphanumerical@1.0.4(transitive)
- Removedis-core-module@2.15.1(transitive)
- Removedis-decimal@1.0.4(transitive)
- Removedis-hexadecimal@1.0.4(transitive)
- Removedis-plain-obj@2.1.0(transitive)
- Removedis-whitespace-character@1.0.4(transitive)
- Removedis-word-character@1.0.4(transitive)
- Removedjsesc@3.0.2(transitive)
- Removedjson5@2.2.3(transitive)
- Removedlodash@4.17.21(transitive)
- Removedlongest-streak@2.0.4(transitive)
- Removedmarkdown-escapes@1.0.4(transitive)
- Removedmarkdown-table@2.0.0(transitive)
- Removedmdast-util-compact@2.0.1(transitive)
- Removedparse-entities@2.0.0(transitive)
- Removedpath-parse@1.0.7(transitive)
- Removedremark-mdx@1.6.22(transitive)
- Removedremark-parse@8.0.3(transitive)
- Removedremark-stringify@8.1.1(transitive)
- Removedrepeat-string@1.6.1(transitive)
- Removedresolve@1.22.8(transitive)
- Removedsemver@5.7.2(transitive)
- Removedsource-map@0.5.7(transitive)
- Removedstate-toggle@1.0.3(transitive)
- Removedstringify-entities@3.1.0(transitive)
- Removedsupports-preserve-symlinks-flag@1.0.0(transitive)
- Removedto-fast-properties@2.0.0(transitive)
- Removedtrim@0.0.1(transitive)
- Removedtrim-trailing-lines@1.1.4(transitive)
- Removedtrough@1.0.5(transitive)
- Removedunherit@1.1.3(transitive)
- Removedunified@9.2.09.2.2(transitive)
- Removedunist-util-is@4.1.0(transitive)
- Removedunist-util-remove-position@2.0.1(transitive)
- Removedunist-util-stringify-position@2.0.3(transitive)
- Removedunist-util-visit@2.0.3(transitive)
- Removedunist-util-visit-parents@3.1.1(transitive)
- Removedvfile@4.2.1(transitive)
- Removedvfile-location@3.2.0(transitive)
- Removedvfile-message@2.0.4(transitive)
- Removedxtend@4.0.2(transitive)
Updatedremark-mdx@^2.1.0
Updatedremark-parse@^10.0.1
Updatedremark-stringify@^10.0.2
Updatedunified@^10.1.2