forked from fannheyward/coc-pyright
-
Notifications
You must be signed in to change notification settings - Fork 0
/
diff.mjs
25 lines (22 loc) · 929 Bytes
/
diff.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { readFile } from 'fs';
import { promisify } from 'util';
async function diff() {
const text = await promisify(readFile)('./package.json');
const config = JSON.parse(text.toString());
const overrides = config.contributes.configuration.properties['python.analysis.diagnosticSeverityOverrides'].properties;
const resp = await fetch('https://raw.githubusercontent.com/microsoft/pyright/main/packages/vscode-pyright/schemas/pyrightconfig.schema.json');
const schema = await resp.json();
for (const [key, val] of Object.entries(schema.properties)) {
if (val['$ref'] === '#/definitions/diagnostic') {
if (!overrides[key]) {
console.error('missing:', key);
} else {
const obj = overrides[key];
if (obj.default !== val.default) {
console.error(`${key}, package.json value: ${obj.default}, schema value: ${val.default}`);
}
}
}
}
}
await diff();