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.

Better support for multiple processors

See original GitHub issue

The version of ESLint you are using. v5.8.0

The problem you want to solve. I’m currently using two plugins to lint vue codeblocks in markdown files – eslint-plugin-markdown and eslint-plugin-vue – and they both have processors of their own that only apply to certain file extensions: eslint-plugin-markdown and eslint-plugin-vue. The problem is that the vue processor doesn’t get applied to the Vue codeblocks in the markdown due to the file extension being md.

Your take on the correct solution to problem. Wildcard extension support or the ability to add/mutate the effective filename of each src outputted by the preprocessor so that an extension can be appended (eg. the codeblock type).

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

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:15 (13 by maintainers)

github_iconTop GitHub Comments

4reactions
mysticateacommented, Nov 6, 2018
function preprocess(code: string, filename: string): string[]

This is the current interface. We cannot chain the preprocess because the input type and the output type are different. I think that the enhancement that changes the output type solves this issue.

type VirtualFile = { code: string, filename: string }
function preprocess(code: string, filename: string): VirtualFile[] | string[]

Then we can chain the preprocess. For example:

<!-- example.md -->
# Docs

```js
console.log("hello")
```

```vue
<template><div>Hello</div></template>
```

```c
int main() {}
```
  1. eslint-plugin-markdown’s processor returns

    [
        { "code": "console.log(\"hello\")", "filename": "example.md.js" },
        { "code": "<template><div>Hello</div></template>", "filename": "example.md.vue" },
        { "code": "int main() {}", "filename": "example.md.c" },
    ]
    
  2. eslint checks the virtual files whether it should lint or not by the filename. (by --ext option and input glob patterns?)

  3. eslint gives proper processors the virtual files. So eslint-plugin-vue can handle the <template><div>Hello</div></template>.

  4. Then, eslint gives rules the last code and filename.

  5. eslint gives processors the result messages to postprocess those in the reversed order of the preprocessing.

1reaction
btmillscommented, Jan 17, 2019

🎉 After today’s TSC meeting, this is now accepted based on the RFC: https://github.com/eslint/rfcs/tree/master/designs/2018-processors-improvements

Read more comments on GitHub >

github_iconTop Results From Across the Web

How Many Cores? Is More Always Better? - NewCMI
Principally, having a multi-core processor is better if the program supports it. A quad-core or dual-core processor is sufficient for a standard computer ......
Read more >
Multiple Core Processors: Is More Always Better? - Lifewire
Adding several cores to a single processor offers significant benefits thanks to the multitasking nature of modern operating systems.
Read more >
What is a multicore processor and how does it work?
A multicore processor is an integrated circuit that has two or more processor cores attached for enhanced performance and reduced power consumption.
Read more >
Multicore CPU support — SIMION 2020 Supplemental ...
SIMION 8.1.0 is designed to utilize multiple CPU cores to improve performance on ... The multicore support can utilize systems with multiple CPU...
Read more >
4 Areas Where Multi-core Processing Really Matters - Arcserve
Databases & the Cloud Databases are tasked with running many tasks simultaneously. The more CPU cores you have the more tasks you can...
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