0

我想禁用警告 AL1025,因为 AL 编译器的性质,我收到很多与我的node_modules文件夹相关的警告。显然,应该可以像这样在 app.json 中抑制警告

  "suppressWarnings": ["AL1025"]

但我仍然收到这些警告:

Microsoft (R) AL Compiler version 7.4.7.43721
Copyright (C) Microsoft Corporation. All rights reserved

Compilation started for project 'ABC Sample Ext' containing '11' files at '19:58:7.337'.

/Users/username/Dev/abc-workspace/abc-sample/node_modules/he/LICENSE-MIT.txt(1,1): warning AL1025: The file at location '/Users/username/Dev/abc-workspace/abc-sample/node_modules/he/LICENSE-MIT.txt' does not match any definition.

我究竟做错了什么?

4

1 回答 1

1

您需要定义一个规则集,告诉编译器要忽略哪些警告/错误。

这有两个部分:

  1. 定义规则集
  2. 激活规则集

规则集以 JSON 格式定义,带有name,descriptionrules. 规则必须有iddescriptionjustification

一个例子可能是:

{
    "name": "Custom ruleset",
    "description": "Set some rules as hidden",
    "rules": [
        {
            "id": "AL1025",
            "action": "Info",
            "justification": "Allow non-AL files in workspace"           
        }
    ]
}

然后您需要激活您定义的规则。这是通过al.ruleSetPath在您的settings.json(在.vscode文件夹中)定义来完成的:

{
    "al.ruleSetPath": "./custom.ruleset.json"
}
于 2021-09-07T11:13:53.173 回答