Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

eslint - How to handle duplicate problems reported by multiple problem matchers in VS Code?

I have a custom problem matcher for ESLint problems from vue-cli-service serve. It works fine and also watches all file changes correctly.

My problem is when I open a file, then ESLint extension of VS Code starts reporting the same problems again for the opened file. I end up either with duplicate problems for the same files, or having ESLint extension overwrites my custom problem matcher's problems which causes the problem to be removed after closing the files.

I know why this is happening but I want to get rid of duplicate problems and at the same time I want to keep the problems after closing the files.

Any idea how to solve this problem?

{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "npm",
            "script": "serve",
            "problemMatcher": [
                {
                    "owner": "eslint",
                    "fileLocation": ["absolute"],
                    "pattern": [
                      {
                        "regexp": "^([^\s].*)$",
                        "file": 1
                      },
                      {
                        "regexp": "^\s+(\d+):(\d+)\s+(error|warning|info)\s+(.*)\s\s+(.*)$",
                        "line": 1,
                        "column": 2,
                        "severity": 3,
                        "message": 4,
                        "code": 5,
                        "loop": true
                      }
                    ],
                    "background": {
                        "activeOnStart": true,
                        "beginsPattern": "^Module Warning \(from \.\/node_modules\/eslint-loader\/index\.js\):$",
                        "endsPattern": "^? \d+ problem \(\d+ errors, \d+ warning\)$"
                    }
                  }
            ],
            "isBackground": true,
            "label": "npm: serve",
            "detail": "vue-cli-service serve"
        }
    ]
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...