Gathering detailed insights and metrics for eslint-mdx
Gathering detailed insights and metrics for eslint-mdx
Gathering detailed insights and metrics for eslint-mdx
Gathering detailed insights and metrics for eslint-mdx
npm install eslint-mdx
eslint-mdx@2.3.4
Published on 14 Jan 2024
eslint-plugin-mdx@2.3.4
Published on 14 Jan 2024
v2.3.5
Published on 14 Jan 2024
eslint-plugin-mdx@3.1.5
Published on 14 Jan 2024
eslint-mdx@3.1.5
Published on 14 Jan 2024
v3.1.5
Published on 14 Jan 2024
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
267 Stars
406 Commits
32 Forks
8 Watching
13 Branches
26 Contributors
Updated on 21 Nov 2024
Minified
Minified + Gzipped
TypeScript (98.61%)
JavaScript (1.39%)
Cumulative downloads
Total Downloads
Last day
-4.9%
55,753
Compared to previous day
Last week
1.7%
302,138
Compared to previous week
Last month
5.9%
1,284,958
Compared to previous month
Last year
78.1%
13,097,938
Compared to previous year
ESLint Parser/Plugin for MDX, helps you lint all ES syntaxes. Linting
code
blocks can be enabled withmdx/code-blocks
setting too! Work perfectly witheslint-plugin-import
,eslint-plugin-prettier
or any other eslint plugins. And also can be integrated with remark-lint plugins to lint markdown syntaxes.
VSCode MDX: Integrates with VSCode ESLint, syntaxes highlighting and error reporting.
This repository is a monorepo managed by changesets what means we actually publish several packages to npm from same codebase, including:
Package | Description | Version |
---|---|---|
eslint-mdx | ESLint Parser for MDX | |
eslint-plugin-mdx | ESLint Plugin, Configuration and Rules for MDX |
1# yarn 2yarn add -D eslint-plugin-mdx 3 4# npm 5npm i -D eslint-plugin-mdx
If you're using multi languages, js/jsx/ts/tsx/vue
, etc for example, you'd better to always use overrides
feature of ESLint, because configs may be overridden by following configs.
See #251 for more details.
.eslintrc
file:
1{ 2 "extends": ["plugin:mdx/recommended"], 3 // optional, if you want to lint code blocks at the same time 4 "settings": { 5 "mdx/code-blocks": true, 6 // optional, if you want to disable language mapper, set it to `false` 7 // if you want to override the default language mapper inside, you can provide your own 8 "mdx/language-mapper": {} 9 } 10}
eslint.config.js
file:
1import * as mdx from 'eslint-plugin-mdx' 2 3export default [ 4 { 5 ...mdx.flat, 6 // optional, if you want to lint code blocks at the same 7 processor: mdx.createRemarkProcessor({ 8 lintCodeBlocks: true, 9 // optional, if you want to disable language mapper, set it to `false` 10 // if you want to override the default language mapper inside, you can provide your own 11 languageMapper: {}, 12 }), 13 }, 14 { 15 ...mdx.flatCodeBlocks, 16 rules: { 17 ...mdx.flatCodeBlocks.rules, 18 // if you want to override some rules for code blocks 19 'no-var': 'error', 20 'prefer-const': 'error', 21 }, 22 }, 23]
Then, make sure ESLint knows to run on .md
or .mdx
files:
1eslint . --ext js,md,mdx
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.
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.
ignoreRemarkConfig
(boolean
): Ignore the remark
configuration defined in the project.
MDXCode
A new MDXCode
estree node type is exported from eslint-mdx
which represents code blocks in mdx
like the following:
1<div> 2 ```js 3 export function foo() { 4 return 'bar' 5 } 6 ``` 7</div>
See also https://github.com/syntax-tree/mdast#code
MDXHeading
A new MDXHeading
estree node type is exported from eslint-mdx
which represents markdown heading in mdx
like the following:
1<div> 2# Here's a text gradient short code! 3</div>
See also https://github.com/syntax-tree/mdast#heading
1import type { BaseNode } from 'estree' 2import type { JSXElement } from 'estree-jsx' 3 4export interface MDXCode extends BaseNode { 5 type: 'MDXCode' 6 value: string 7 lang?: string | null 8 meta?: string | null 9} 10 11export type HeadingDepth = 1 | 2 | 3 | 4 | 5 | 6 12 13export interface MDXHeading extends BaseNode { 14 type: 'MDXHeading' 15 depth: HeadingDepth 16 children: JSXElement['children'] 17}
possible fixable depends on your remark plugins:
Integration with remark-lint plugins, it will read remark's configuration automatically via unified-engine. But .remarkignore
will not be respected, you should use .eslintignore
instead.
If you want to disable or change severity of some related rules, it won't work by setting rules in eslint config like 'remark-lint-no-duplicate-headings': 0
, you should change your remark config instead like following:
1{ 2 "plugins": [ 3 "@1stg/remark-config", 4 // change to error severity, notice `[]` is required 5 ["lint-no-duplicate-headings", [2]], 6 // disable following plugin 7 [ 8 "lint-no-multiple-toplevel-headings", 9 [0] // or false 10 ] 11 ] 12}
If you're using remark-lint feature with Prettier both together, you can try remark-preset-prettier which helps you to turn off all rules that are unnecessary or might conflict with Prettier.
1{ 2 "plugins": [ 3 "preset-lint-consistent", 4 "preset-lint-recommended", 5 "preset-lint-markdown-style-guide", 6 "preset-prettier" 7 ] 8}
1stG | RxTS | UnTS |
---|---|---|
1stG | RxTS | UnTS |
---|---|---|
Detailed changes for each release are documented in CHANGELOG.md.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
security policy file detected
Details
Reason
SAST tool detected but not run on all commits
Details
Reason
9 existing vulnerabilities detected
Details
Reason
0 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 2/22 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More