Skip to content

docs: one example of no-multiple-empty-lines rule has double line numbers #16841

@jonz94

Description

@jonz94

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

Screenshot 2023-01-30 at 18 58 00

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:

/**
*
* 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

No one assigned

    Labels

    acceptedThere is consensus among the team that this change meets the criteria for inclusionarchived due to ageThis issue has been archived; please open a new issue for any further discussionbugESLint is working incorrectlydocumentationRelates to ESLint's documentation

    Type

    No type

    Projects

    Status

    Complete

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions