question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The name of a processor code block is prefixed by its index

See original GitHub issue

The version of ESLint you are using. 7.7.0, git blame shows this was the behavior since it was implemented in v6.

The problem you want to solve. The filename of code block found by a processor is prefixed by its index: https://github.com/eslint/eslint/blob/66442a9faf9872db4a40f56dde28c48f4d02fc7b/lib/linter/linter.js#L1298

This behavior is undocumented and counter-intuitive:

return [ // return an array of code blocks to lint
    { text: code1, filename: "0.js" },
    { text: code2, filename: "1.js" },
];

in which filename is already indexed, suggesting indexing should be handled by the processor

Processors may make named code blocks such as 0.js and 1.js. ESLint handles such a named code block as a child file of the original file.

but block names 0.js and 1.js are never possible and combined with the example above, it suggests that the filename is the blockname

  • This makes hard to configure overrides for code blocks. To override configs for specific code block, one should use "**/*.md/*_name.js"

Your take on the correct solution to problem.

  1. Document the current behavior
  2. Add a noPrefix (default: false) property to code block. If true, the filename is not prefixed. It’d be then up to the processor to provide unique names.

Are you willing to submit a pull request to implement this change? Yes.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mdjermanoviccommented, Sep 21, 2020

Reopening as this issue hasn’t been triaged yet.

0reactions
eslint-deprecated[bot]commented, Dec 25, 2020

Unfortunately, it looks like there wasn’t enough interest from the team or community to implement this change. While we wish we’d be able to accommodate everyone’s requests, we do need to prioritize. We’ve found that issues failing to reach accepted status after 21 days tend to never be accepted, and as such, we close those issues. This doesn’t mean the idea isn’t interesting or useful, just that it’s not something the team can commit to.

Thanks for contributing to ESLint and we appreciate your understanding.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Intel® Processor Names, Numbers and Generation List
Understanding Intel® processor names and numbers helps identify the best laptop, desktop, or mobile device CPU for your computing needs.
Read more >
1 Code::Blocks Project Management
Code::Blocks governs the project files in categories according to their ... to the library or just give the name without the lib prefix...
Read more >
Date index name processor | Elasticsearch Guide [8.5] | Elastic
The processor sets the _index metadata field with a date math index name expression based on the provided index name prefix, a date...
Read more >
Prefix Sums and Their Applications
If we assume a fixed number of processors p, with n > p, then each processor can sum an n/p section of the...
Read more >
YAML - Quick Guide - Tutorialspoint
Now that you have an idea about YAML and its features, let us learn its basics with syntax ... Comments help to add...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found