npm(prettier-config): add new sharable config

Summary:
Docs: https://prettier.io/docs/en/configuration#sharing-configurations

To be published @ npm and imported elsewhere.

Signed-off-by: Yongmin Hong <revi@omglol.email>

Test Plan: no test can be performed at this time; needs to be landed, published to npm, and then we can test from other tepo importing this.

Reviewers: O1 revi & automations, revi

Reviewed By: O1 revi & automations, revi

Differential Revision: https://issuetracker.revi.xyz/D302
This commit is contained in:
revi 2024-06-14 17:03:06 +09:00
parent 1a8f2aaccf
commit 8865e172f9
Signed by: revi
GPG key ID: 1EB4F6CEEA100E94
5 changed files with 101 additions and 13 deletions

1
.gitattributes vendored
View file

@ -1,5 +1,4 @@
* text=auto
*.sh text=auto eol=lf
*.asc binary
*.gif binary

View file

@ -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"
}

View file

@ -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;

37
package-lock.json generated
View file

@ -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",

View file

@ -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"
]
}