feat(fmt): add dprint as code formatter

This commit is contained in:
Thomas Rupprecht 2023-10-23 20:41:55 +02:00
parent 3453207e7e
commit 637a0eb63e
6 changed files with 137 additions and 4 deletions

View File

@ -3,7 +3,7 @@
# top-most EditorConfig file
root = true
[*.{html,css,js,cjs,mjs,json,svg,ts,toml}]
[*.{html,css,js,cjs,mjs,json,jsonc,svg,ts,toml}]
indent_style = tab
indent_size = 2
end_of_line = lf

View File

@ -20,6 +20,7 @@ All notable changes to this project will be documented in this file.
- Update `@types/firefox-webext-browser`, `eslint`, `eslint-plugin-jsdoc`
- Update `stylelint-plugin-defensive-css`, `web-ext`
- Update dependencies
## \[[0.9.5](https://git.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.9.5)] - 2023-09-13

View File

@ -41,9 +41,9 @@ filter_unconventional = false
# process each line of a commit as an individual commit
split_commits = false
# regex for preprocessing the commit messages
commit_preprocessors = [
# { pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](https://git.usrspace.at/XimeX/usrspace-browser-addon/issues/${2}))" },
]
# commit_preprocessors = [
# { pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](https://git.usrspace.at/XimeX/usrspace-browser-addon/issues/${2}))" },
# ]
# regex for parsing and grouping commits
commit_parsers = [
{ message = "^feat", group = "<!-- 0 -->⛰️ Features" },

32
dprint.jsonc Normal file
View File

@ -0,0 +1,32 @@
{
"typescript": {
"lineWidth": 128,
"quoteProps": "consistent",
"quoteStyle": "alwaysSingle",
"semiColons": "always",
"singleBodyPosition": "nextLine",
"useBraces": "always",
"useTabs": true,
"arrowFunction.useParentheses": "force",
"importDeclaration.sortNamedImports": "maintain"
},
"json": {
"trailingCommas": "maintain",
"useTabs": true
},
"markdown": {},
"toml": {
"useTabs": true
},
"excludes": [
"**/node_modules",
"**/*-lock.json",
"src/browser-polyfill.js"
],
"plugins": [
"https://plugins.dprint.dev/typescript-0.88.2.wasm",
"https://plugins.dprint.dev/json-0.18.0.wasm",
"https://plugins.dprint.dev/markdown-0.16.2.wasm",
"https://plugins.dprint.dev/toml-0.5.4.wasm"
]
}

97
package-lock.json generated
View File

@ -18,6 +18,7 @@
"@commitlint/cz-commitlint": "^18.0.0",
"@types/firefox-webext-browser": "^111.0.3",
"commitizen": "^4.3.0",
"dprint": "^0.41.0",
"eslint": "^8.52.0",
"eslint-plugin-jsdoc": "^46.8.2",
"eslint-plugin-no-unsanitized": "^4.0.2",
@ -634,6 +635,84 @@
"node": ">= 0.10.4"
}
},
"node_modules/@dprint/darwin-arm64": {
"version": "0.41.0",
"resolved": "https://registry.npmjs.org/@dprint/darwin-arm64/-/darwin-arm64-0.41.0.tgz",
"integrity": "sha512-P9PtcQI0mrI4U6yyd+/iI664BHSqC9KTS6ogq0ptEdnLtlaWzf09D1nv6FBaHiG9m3conuBRlPsoUqt3j6PZ2w==",
"cpu": [
"arm64"
],
"dev": true,
"optional": true,
"os": [
"darwin"
]
},
"node_modules/@dprint/darwin-x64": {
"version": "0.41.0",
"resolved": "https://registry.npmjs.org/@dprint/darwin-x64/-/darwin-x64-0.41.0.tgz",
"integrity": "sha512-mSYnSoH0uyCkjgIWTny2DZAcaiRTe3kRWY5SeZECLGO37e+SdVg+ZjSzndhOvvEb9pv8EeBO1NJ9gHOSceT5Xw==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"darwin"
]
},
"node_modules/@dprint/linux-arm64-glibc": {
"version": "0.41.0",
"resolved": "https://registry.npmjs.org/@dprint/linux-arm64-glibc/-/linux-arm64-glibc-0.41.0.tgz",
"integrity": "sha512-U4xWzjjO/aAct8cSSMZFhg8l1jWy6VahXh8zWjGBufwX7t3xEcxMG9RyAp/ioYSY6wl4YXAmnUHywhC+wSjDHQ==",
"cpu": [
"arm64"
],
"dev": true,
"optional": true,
"os": [
"linux"
]
},
"node_modules/@dprint/linux-x64-glibc": {
"version": "0.41.0",
"resolved": "https://registry.npmjs.org/@dprint/linux-x64-glibc/-/linux-x64-glibc-0.41.0.tgz",
"integrity": "sha512-wjv5l4mGns7E8i32E8FfAk45tw5O7v4NM17gtvhe6ggOiOD6quHowOH00pLfEakMLMF9y0J5ZO2hxJ/w06bXmQ==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"linux"
]
},
"node_modules/@dprint/linux-x64-musl": {
"version": "0.41.0",
"resolved": "https://registry.npmjs.org/@dprint/linux-x64-musl/-/linux-x64-musl-0.41.0.tgz",
"integrity": "sha512-ZZOqiur9Xi/2uhz0Ce215VTSajAlSrduX/5k/hpIjI7Rgz22Vn77p5fmYxzWkTt/Li1zq5zboTvmGYx0QVNMrQ==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"linux"
]
},
"node_modules/@dprint/win32-x64": {
"version": "0.41.0",
"resolved": "https://registry.npmjs.org/@dprint/win32-x64/-/win32-x64-0.41.0.tgz",
"integrity": "sha512-mFx6x4Hn848/D4gPbDm7g1wlnOh2SGoVF9c9HMGCuOobUU2WIBztzV4L5qlFCB3gprlS0ru9BhlMpGhrp0CBYA==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"win32"
]
},
"node_modules/@es-joy/jsdoccomment": {
"version": "0.40.1",
"resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.40.1.tgz",
@ -3105,6 +3184,24 @@
"node": ">=8"
}
},
"node_modules/dprint": {
"version": "0.41.0",
"resolved": "https://registry.npmjs.org/dprint/-/dprint-0.41.0.tgz",
"integrity": "sha512-9Ctv6EnwOy5Ai566DczI/QhAC6y+AhWDA2gFU8Zz4xezUy1BevHaIYhfdLWZQxh4Qf4H28lRu1Lq+hhIm1US9w==",
"dev": true,
"hasInstallScript": true,
"bin": {
"dprint": "bin.js"
},
"optionalDependencies": {
"@dprint/darwin-arm64": "0.41.0",
"@dprint/darwin-x64": "0.41.0",
"@dprint/linux-arm64-glibc": "0.41.0",
"@dprint/linux-x64-glibc": "0.41.0",
"@dprint/linux-x64-musl": "0.41.0",
"@dprint/win32-x64": "0.41.0"
}
},
"node_modules/dtrace-provider": {
"version": "0.8.8",
"resolved": "https://registry.npmjs.org/dtrace-provider/-/dtrace-provider-0.8.8.tgz",

View File

@ -11,6 +11,7 @@
"@commitlint/cz-commitlint": "^18.0.0",
"@types/firefox-webext-browser": "^111.0.3",
"commitizen": "^4.3.0",
"dprint": "^0.41.0",
"eslint": "^8.52.0",
"eslint-plugin-jsdoc": "^46.8.2",
"eslint-plugin-no-unsanitized": "^4.0.2",
@ -33,6 +34,8 @@
"lint:web-ext": "web-ext lint -w",
"lint:js": "eslint .",
"lint:css": "stylelint \"src/*.css\"",
"fmt:check": "dprint check",
"fmt:update": "dprint config update",
"test": "echo \"Error: no test specified\" && exit 0",
"watch:firefox": "web-ext run -t firefox-desktop",
"watch:firefox-android": "web-ext run -t firefox-android",