diff --git a/.gitattributes b/.gitattributes index 10ab780..0306584 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,5 +1,4 @@ * text=auto -*.sh text=auto eol=lf *.asc binary *.gif binary diff --git a/npm/prettier-config/package.json b/npm/prettier-config/package.json new file mode 100644 index 0000000..124ca61 --- /dev/null +++ b/npm/prettier-config/package.json @@ -0,0 +1,26 @@ +{ + "$schema": "https://json.schemastore.org/package.json", + "name": "@revi/prettier-config", + "version": "0.0.1", + "description": "@revi's prettier configs", + "main": "prettier.config.js", + "dependencies": { + "prettier": "^3.3.2" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/revi/sandbox/blob/master/npm-prettier-config" + }, + "bugs": { + "url": "https://revi.xyz/new" + }, + "keywords": [ + "prettier" + ], + "type": "module", + "scripts": { + "p:c": "prettier --check" + }, + "author": "revi", + "license": "Apache-2.0" +} diff --git a/npm/prettier-config/prettier.config.js b/npm/prettier-config/prettier.config.js new file mode 100644 index 0000000..8fa7554 --- /dev/null +++ b/npm/prettier-config/prettier.config.js @@ -0,0 +1,40 @@ +// @ts-check +/** + * @file revi's prettier config preset + * @see https://prettier.io/docs/en/configuration.html + * @type {import("prettier").Config} + * @copyright Hong Yongmin 2024 + * @license Apache-2.0 + */ + +const config = { + bracketSpacing: false, + bracketSameLine: true, + proseWrap: 'preserve', + singleQuote: true, + trailingComma: 'all', + overrides: [ + { + files: '.arcconfig', + options: {parser: 'json'}, + }, + { + files: '.arclint', + options: {parser: 'json'}, + }, + { + files: '.arcunit', + options: {parser: 'json'}, + }, + { + files: '.imgbotconfig', + options: {parser: 'json'}, + }, + { + files: '.yamllint', + options: {parser: 'yaml'}, + }, + ], +}; + +export default config; diff --git a/package-lock.json b/package-lock.json index e617d5d..2e7273a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,23 @@ { - "name": "sandbox", + "name": "@revi/scripts", "lockfileVersion": 2, "requires": true, "packages": { "": { + "name": "@revi/scripts", + "workspaces": [ + "npm/prettier-config" + ], "devDependencies": { "csslint": "^1.0.5", "jshint": "^2.13.6", "prettier": "^3.3.1" } }, + "node_modules/@revi/prettier-config": { + "resolved": "npm/prettier-config", + "link": true + }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -321,10 +329,9 @@ } }, "node_modules/prettier": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.1.tgz", - "integrity": "sha512-7CAwy5dRsxs8PHXT3twixW9/OEll8MLE0VRPCJyl7CkS6VHGPSlsVaWTiASPTyGyYRyApxlaWTzwUxVNrhcwDg==", - "dev": true, + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.2.tgz", + "integrity": "sha512-rAVeHYMcv8ATV5d508CFdn+8/pHPpXeIid1DdrPwXnaAdH7cqjVbpJaT5eq4yRAFU/lsbwYwSF/n5iNrdJHPQA==", "license": "MIT", "bin": { "prettier": "bin/prettier.cjs" @@ -375,9 +382,22 @@ "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", "dev": true, "license": "ISC" + }, + "npm/prettier-config": { + "version": "0.0.1", + "license": "Apache-2.0", + "dependencies": { + "prettier": "^3.3.2" + } } }, "dependencies": { + "@revi/prettier-config": { + "version": "file:npm/prettier-config", + "requires": { + "prettier": "^3.3.2" + } + }, "balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -626,10 +646,9 @@ "dev": true }, "prettier": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.1.tgz", - "integrity": "sha512-7CAwy5dRsxs8PHXT3twixW9/OEll8MLE0VRPCJyl7CkS6VHGPSlsVaWTiASPTyGyYRyApxlaWTzwUxVNrhcwDg==", - "dev": true + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.2.tgz", + "integrity": "sha512-rAVeHYMcv8ATV5d508CFdn+8/pHPpXeIid1DdrPwXnaAdH7cqjVbpJaT5eq4yRAFU/lsbwYwSF/n5iNrdJHPQA==" }, "readable-stream": { "version": "1.1.14", diff --git a/package.json b/package.json index e29025b..2154d2b 100644 --- a/package.json +++ b/package.json @@ -1,4 +1,5 @@ { + "$schema": "https://json.schemastore.org/package.json", "name": "@revi/scripts", "private": true, "devDependencies": { @@ -7,7 +8,10 @@ "prettier": "^3.3.1" }, "scripts": { - "p:c": "prettier --check .", - "p:w": "prettier --write ." - } + "p:c": "prettier --check", + "p:w": "prettier --write" + }, + "workspaces": [ + "npm/prettier-config" + ] }