Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Commit

Permalink
feat(jsonc): add trailingComma in config #4
Browse files Browse the repository at this point in the history
  • Loading branch information
NewFuture committed May 12, 2019
1 parent da03e73 commit 7caff1a
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 42 deletions.
9 changes: 6 additions & 3 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,18 @@
}
},
{
"files": "*.{jsonc,cjson,json}",
"files": [".*rc", "*.json"],
"options": {
"parser": "json"
}
},
{
"files": ".*rc",
"files": ["*.{jsonc,cjson}", ".vscode/*", "tsconfig.json"],
"options": {
"parser": "json"
"parser": "json5",
"quoteProps": "preserve",
"singleQuote": false,
"trailingComma": "all"
}
},
{
Expand Down
4 changes: 2 additions & 2 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"editorconfig.editorconfig",
"qiu8310.minapp-vscode",
"qiu8310.dot-template-vscode",
"mkaufman.htmlhint"
]
"mkaufman.htmlhint",
],
}
40 changes: 20 additions & 20 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"search.exclude": {
"node_modules": true,
"dist": true,
".vscode": true
".vscode": true,
},
"files.exclude": {
"dist": false,
".vscode": true,
".dtpl": true
".dtpl": true,
},
"files.associations": {
"*.wxss": "css",
Expand All @@ -19,7 +19,7 @@
"*.json5": "jsonc",
".htmlhintrc": "json",
".stylelintrc": "json",
".prettierrc": "json"
".prettierrc": "json",
},
"files.trimTrailingWhitespace": true,
// editor
Expand All @@ -29,17 +29,17 @@
"editor.renderWhitespace": "boundary",
"editor.codeActionsOnSave": {
"source.fixAll": true,
"source.organizeImports": true
"source.organizeImports": true,
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.rulers": [100],
// wxml
"[wxml]": {
"editor.defaultFormatter": "qiu8310.minapp-vscode"
"editor.defaultFormatter": "qiu8310.minapp-vscode",
},
"emmet.includeLanguages": {
"wxml": "html",
"wxss": "css"
"wxss": "css",
},
"css.validate": false,
"html.suggest.html5": false,
Expand All @@ -58,27 +58,27 @@
"javascript",
{
"language": "typescript",
"autoFix": true
}
"autoFix": true,
},
],
// json schema
"json.schemas": [
{
"fileMatch": ["app.json", "app.jsonc", "app.json5", "app.cjson"],
"url": "https://newfuture.github.io/miniprogram-json-schema/app.json"
"url": "https://newfuture.github.io/miniprogram-json-schema/app.json",
},
{
"fileMatch": [
"project.config.json",
"project.config.jsonc",
"project.config.json5",
"project.config.cjson"
"project.config.cjson",
],
"url": "https://newfuture.github.io/miniprogram-json-schema/project.config.json"
"url": "https://newfuture.github.io/miniprogram-json-schema/project.config.json",
},
{
"fileMatch": ["sitemap.json", "sitemap.jsonc", "sitemap.json5", "sitemap.cjson"],
"url": "https://newfuture.github.io/miniprogram-json-schema/sitemap.json"
"url": "https://newfuture.github.io/miniprogram-json-schema/sitemap.json",
},
{
"fileMatch": [
Expand All @@ -89,9 +89,9 @@
"src/page/**/*.jsonc",
"src/page/**/*.json",
"src/page/**/*.json5",
"src/page/**/*.cjson"
"src/page/**/*.cjson",
],
"url": "https://newfuture.github.io/miniprogram-json-schema/page.json"
"url": "https://newfuture.github.io/miniprogram-json-schema/page.json",
},
{
"fileMatch": [
Expand All @@ -102,9 +102,9 @@
"src/component/**/*.jsonc",
"src/component/**/*.json",
"src/component/**/*.json5",
"src/component/**/*.cjson"
"src/component/**/*.cjson",
],
"url": "https://newfuture.github.io/miniprogram-json-schema/component.json"
"url": "https://newfuture.github.io/miniprogram-json-schema/component.json",
},
{
"fileMatch": [
Expand All @@ -115,9 +115,9 @@
"mpconfig.json",
"mpconfig.jsonc",
".mpconfig.json",
".mpconfig.jsonc"
".mpconfig.jsonc",
],
"url": "https://newfuture.github.io/miniprogram-build/config.schema.json"
}
]
"url": "https://newfuture.github.io/miniprogram-build/config.schema.json",
},
],
}
4 changes: 2 additions & 2 deletions env/dev.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
{
"var": {
"APP_ID": "wx820b270148861005", // 开发环境 小程序 AppID
"VERSION": "{{package.version}}" //使用当前package.json中的version字段进行替换
}
"VERSION": "{{package.version}}", //使用当前package.json中的version字段进行替换
},
}
4 changes: 2 additions & 2 deletions env/prod.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
{
"var": {
"APP_ID": "wx_appid_for_production", // 生产环境 小程序 AppID
"VERSION": "{{package.version}}" //使用当前package.json中的version字段进行替换
}
"VERSION": "{{package.version}}", //使用当前package.json中的version字段进行替换
},
}
4 changes: 2 additions & 2 deletions env/test.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
{
"var": {
"APP_ID": "wx_appid_for_test", // 测试环境 小程序 AppID
"VERSION": "{{package.version}}" //使用当前package.json中的version字段进行替换
}
"VERSION": "{{package.version}}", //使用当前package.json中的version字段进行替换
},
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
"lint:js": "eslint \"src/**/*.{ts,js,wxs,wxts}\"",
"lint:wxss": "stylelint \"src/**/*\"",
"lint:wxml": "htmlhint \"src/**/*.{wxml,html}\"",
"lint:config": "prettier *.json .*rc \".vscode/*\" --check",
"lint:config": "prettier *.json .*rc \"env/*\" \".vscode/*\" --check",
"lint-fix": "npm run lint-fix:wxss && npm run lint-fix:js && npm run lint-fix:config",
"lint-fix:js": "eslint \"src/**/*.{ts,js,wxs,wxts}\" --fix",
"lint-fix:wxss": "stylelint \"src/**/*\" --fix",
"lint-fix:config": "prettier *.json .*rc \".vscode/*\" --write",
"lint-fix:config": "prettier *.json .*rc \"env/*\" \".vscode/*\" --write",
"help": "miniprogram-build -h",
"stylelint-check": "stylelint-config-prettier-check",
"eslint-check": "eslint --print-config . | eslint-config-prettier-check",
Expand Down
6 changes: 3 additions & 3 deletions src/app.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"pages/index/index",
/*# INJECT_START {"key": "page"} #*/
/*# INJECT_END #*/
"pages/logs/logs"
"pages/logs/logs",
],
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "WeChat",
"navigationBarTextStyle": "black"
}
"navigationBarTextStyle": "black",
},
}
6 changes: 3 additions & 3 deletions src/project.config.jsonc
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"description": "项目配置文件",
"packOptions": {
"ignore": []
"ignore": [],
},
"compileType": "miniprogram",
"libVersion": "2.4.0",
"projectname": "miniprogram-template",
"setting": {
"nodeModules": true,
"newFeature": true
"newFeature": true,
},
"appid": "{{APP_ID}}", // 会被自动替换
"condition": {}
"condition": {},
}
6 changes: 3 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
"baseUrl": "src" /* Base directory to resolve non-absolute module names. */,
"outDir": "dist/",
"paths": {
"/*": ["./*"]
"/*": ["./*"],
},
"lib": ["es5", "es6"],
"types": ["@dragongate/miniprogram-api-typings"]
"types": ["@dragongate/miniprogram-api-typings"],
},
"include": ["src/**/*.ts"],
"exclude": ["node_modules", "miniprogram_dist", "dist", "**/*.spec.ts"]
"exclude": ["node_modules", "miniprogram_dist", "dist", "**/*.spec.ts"],
}

0 comments on commit 7caff1a

Please sign in to comment.