-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathsettings.json.ts
More file actions
47 lines (42 loc) · 1.34 KB
/
settings.json.ts
File metadata and controls
47 lines (42 loc) · 1.34 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import * as JSON5 from "json5";
import type { TemplateFunction } from "../../src/lib/createAdapter";
const templateFunction: TemplateFunction = answers => {
const useESLint = answers.tools && answers.tools.indexOf("ESLint") > -1;
const usePrettier = answers.tools && answers.tools.indexOf("Prettier") > -1;
const useTypeScript = answers.language === "TypeScript";
if (!useESLint && !usePrettier && !useTypeScript) return;
const template = `
{
${useTypeScript ? `"typescript.tsdk": "node_modules/typescript/lib",` : ""}
${useESLint ? `"eslint.enable": true,` : ""}
${usePrettier ? (`
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
${useTypeScript ? (`
"[typescript]": {
"editor.codeActionsOnSave": {
"source.organizeImports": true
},
},
`) : ""}
`) : ""}
"json.schemas": [
{
"fileMatch": ["io-package.json"],
"url": "https://raw.githubusercontent.com/ioBroker/ioBroker.js-controller/master/schemas/io-package.json"
},
{
"fileMatch": [
"admin/jsonConfig.json",
"admin/jsonCustom.json",
"admin/jsonTab.json"
],
"url": "https://raw.githubusercontent.com/ioBroker/ioBroker.admin/master/packages/jsonConfig/schemas/jsonConfig.json"
}
],
}
`;
return JSON.stringify(JSON5.parse(template), null, 4);
};
templateFunction.customPath = ".vscode/settings.json";
export = templateFunction;