-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Description
ESLint version
v8.33.0
What problem do you want to solve?
Currently, the second example for https://eslint.org/docs/latest/rules/no-multiple-empty-lines#maxeof has double line numbers
What do you think is the correct solution?
I currently have 2 ideas:
1. Simply remove the line numbers in the example code
This do make the example on the docs site looks nice:
Before | After |
---|---|
but the example on the GitHub markdown preview would be a little bit awkward without these line numbers:
Before | After |
---|---|
2. Add a feature to disable line numbers for specific code block on the docs site
The line numbers feature on docs site is originally modified from vitepress
, Ref:
eslint/docs/src/_plugins/md-syntax-highlighter.js
Lines 55 to 61 in 13552c4
/** | |
* | |
* modified from https://github.com/vuejs/vitepress/blob/main/src/node/markdown/plugins/lineNumbers.ts | |
* @param {MarkdownIt} md | |
* @license MIT License. See file header. | |
*/ | |
const lineNumberPlugin = (md) => { |
Then, I notice
vitepress
do have a way to enable/disable line numbers for individual code block (related PR: vuejs/vitepress#1733)
So if we can implement this feature, we can use the following syntax:
```js:no-line-numbers
to disable line numbers for specific code block.
This also means we can also turn off line numbers for non-code content (e.g. shell commands, command output, etc.) afterward.
Participation
- I am willing to submit a pull request for this change.
Additional comments
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Status