npm(prettier-config): add prettier plugins, add rules, consolidate

Summary:
And run `npm run p:w .` for that, and add .prettierignore so `sh` plugin ignores them.

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

Test Plan: `npm run p:c .` and `npm publish`.

Reviewers: O1 revi & automations, revi

Reviewed By: O1 revi & automations, revi

Differential Revision: https://issuetracker.revi.xyz/D355
This commit is contained in:
revi 2024-06-18 18:42:33 +09:00
parent 679378baa3
commit 5c16c87f8d
Signed by: revi
GPG key ID: 1EB4F6CEEA100E94
8 changed files with 302 additions and 38 deletions

View file

@ -35,7 +35,7 @@
},
"text": {
"type": "text",
"exclude": ["(^.gitignore$)", "(\\.md)"],
"exclude": ["(^.gitignore$)", "(\\.md)", "(\\.php)"],
"text.max-line-length": 80,
"severity": {
"1": "autofix",
@ -44,7 +44,7 @@
"5": "disabled"
}
},
"text-no-linelength": {
"text-markdown": {
"type": "text",
"include": ["(^.gitignore$)", "(\\.md)"],
"severity": {
@ -54,6 +54,17 @@
"5": "disabled"
}
},
"text-php": {
"type": "text",
"exclude": ["(\\.php)"],
"text.max-line-length": 80,
"severity": {
"1": "autofix",
"2": "disabled",
"3": "advice",
"5": "disabled"
}
},
"yaml lint": {
"type": "yamllint",
"include": ["(\\.yaml$)", "(\\.yml$)", "(^.yamllint$)"]

View file

@ -1,3 +1,4 @@
---
name: 'Build container images'
on:
push:

View file

@ -81,9 +81,10 @@ jobs:
# "We were unable to automatically build your code", modify the matrix above
# to set the build mode to "manual" for that language. Then modify this step
# to build your code.
# Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
- if: matrix.build-mode == 'manual'
# Command-line programs to run using the OS shell.
# See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
- name: 'warn manual build mode'
if: matrix.build-mode == 'manual'
shell: bash
run: |
echo 'If you are using a "manual" build mode for one or more of the' \

View file

@ -1,2 +1,4 @@
node_modules/
.gitmodules
.pinterest-linters/
CODEOWNERS
node_modules/

View file

@ -14,22 +14,41 @@ ## Config
proseWrap: 'preserve',
singleQuote: true,
trailingComma: 'all',
plugins: [
// https://github.com/prettier/plugin-php
'@prettier/plugin-php',
// https://github.com/un-ts/prettier/tree/master/packages/sh
'prettier-plugin-sh',
// https://github.com/bd82/toml-tools/tree/master/packages/prettier-plugin-toml
'prettier-plugin-toml',
],
overrides: [
{
files: '.arcconfig',
files: '*.php',
options: {
parser: 'php',
phpVersion: '8.1',
useTabs: true,
tabWidth: 4,
braceStyle: '1tbs',
},
},
{
files: [
'.editorconfig',
'.gitattributes',
'.gitignore',
'.prettierignore',
],
options: {parser: 'sh', keepPadding: true, minify: false},
},
{
files: ['.arcconfig', '.arclint', '.arcunit', '.imgbotconfig'],
options: {parser: 'json'},
},
{
files: '.arclint',
options: {parser: 'json'},
},
{
files: '.arcunit',
options: {parser: 'json'},
},
{
files: '.imgbotconfig',
options: {parser: 'json'},
files: ['.vscode/*.json', '**.hujson'],
options: {parser: 'jsonc'},
},
{
files: '.yamllint',
@ -37,4 +56,6 @@ ## Config
},
],
};
export default config;
```

View file

@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/package.json",
"name": "@revi/prettier-config",
"version": "0.0.2",
"version": "0.0.3",
"author": {
"name": "revi",
"email": "revi@omglol.email",
@ -10,7 +10,10 @@
"description": "@revi's prettier configs",
"main": "prettier.config.js",
"peerDependencies": {
"prettier": "^3.3.2"
"@prettier/plugin-php": "0.22.2",
"prettier": "3.3.2",
"prettier-plugin-sh": "0.14.0",
"prettier-plugin-toml": "2.0.1"
},
"scripts": {
"p:c": "prettier --check"

View file

@ -14,22 +14,41 @@ const config = {
proseWrap: 'preserve',
singleQuote: true,
trailingComma: 'all',
plugins: [
// https://github.com/prettier/plugin-php
'@prettier/plugin-php',
// https://github.com/un-ts/prettier/tree/master/packages/sh
'prettier-plugin-sh',
// https://github.com/bd82/toml-tools/tree/master/packages/prettier-plugin-toml
'prettier-plugin-toml',
],
overrides: [
{
files: '.arcconfig',
files: '*.php',
options: {
parser: 'php',
phpVersion: '8.1',
useTabs: true,
tabWidth: 4,
braceStyle: '1tbs',
},
},
{
files: [
'.editorconfig',
'.gitattributes',
'.gitignore',
'.prettierignore',
],
options: {parser: 'sh', keepPadding: true, minify: false},
},
{
files: ['.arcconfig', '.arclint', '.arcunit', '.imgbotconfig'],
options: {parser: 'json'},
},
{
files: '.arclint',
options: {parser: 'json'},
},
{
files: '.arcunit',
options: {parser: 'json'},
},
{
files: '.imgbotconfig',
options: {parser: 'json'},
files: ['.vscode/*.json', '**.hujson'],
options: {parser: 'jsonc'},
},
{
files: '.yamllint',

222
package-lock.json generated
View file

@ -374,6 +374,20 @@
"node": ">= 8"
}
},
"node_modules/@prettier/plugin-php": {
"version": "0.22.2",
"resolved": "https://registry.npmjs.org/@prettier/plugin-php/-/plugin-php-0.22.2.tgz",
"integrity": "sha512-md0+7tNbsP0oy+wIP3KZZc6fzx1k1jtWaMjOy/gM8yU9f2BDYEi+iHOc/UNPihYvPI28zFTbjvlhH4QXQjQwNg==",
"license": "MIT",
"peer": true,
"dependencies": {
"linguist-languages": "^7.27.0",
"php-parser": "^3.1.5"
},
"peerDependencies": {
"prettier": "^3.0.0"
}
},
"node_modules/@revi/eslint-config": {
"resolved": "npm/eslint-config",
"link": true
@ -382,6 +396,21 @@
"resolved": "npm/prettier-config",
"link": true
},
"node_modules/@taplo/core": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/@taplo/core/-/core-0.1.1.tgz",
"integrity": "sha512-BG/zLGf5wiNXGEVPvUAAX/4ilB3PwDUY2o0MV0y47mZbDZ9ad9UK/cIQsILat3bqbPJsALVbU6k3cskNZ3vAQg==",
"license": "MIT"
},
"node_modules/@taplo/lib": {
"version": "0.4.0-alpha.2",
"resolved": "https://registry.npmjs.org/@taplo/lib/-/lib-0.4.0-alpha.2.tgz",
"integrity": "sha512-DV/Re3DPVY+BhBtLZ3dmP4mP6YMLSsgq9qGLXwOV38lvNF/fBlgvQswzlXmzCEefL/3q2eMoefZpOI/+GLuCNA==",
"license": "MIT",
"dependencies": {
"@taplo/core": "^0.1.0"
}
},
"node_modules/@types/eslint": {
"version": "8.56.10",
"resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.56.10.tgz",
@ -1187,8 +1216,8 @@
"version": "9.1.0",
"resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz",
"integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==",
"dev": true,
"license": "MIT",
"peer": true,
"bin": {
"eslint-config-prettier": "bin/cli.js"
},
@ -2559,6 +2588,13 @@
"dev": true,
"license": "MIT"
},
"node_modules/linguist-languages": {
"version": "7.27.0",
"resolved": "https://registry.npmjs.org/linguist-languages/-/linguist-languages-7.27.0.tgz",
"integrity": "sha512-Wzx/22c5Jsv2ag+uKy+ITanGA5hzvBZngrNGDXLTC7ZjGM6FLCYGgomauTkxNJeP9of353OM0pWqngYA180xgw==",
"license": "MIT",
"peer": true
},
"node_modules/locate-path": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz",
@ -2646,6 +2682,12 @@
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
"license": "MIT"
},
"node_modules/mvdan-sh": {
"version": "0.10.1",
"resolved": "https://registry.npmjs.org/mvdan-sh/-/mvdan-sh-0.10.1.tgz",
"integrity": "sha512-kMbrH0EObaKmK3nVRKUIIya1dpASHIEusM13S4V1ViHFuxuNxCo+arxoa6j/dbV22YBGjl7UKJm9QQKJ2Crzhg==",
"license": "BSD-3-Clause"
},
"node_modules/natural-compare": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",
@ -2844,6 +2886,13 @@
"node": ">=8"
}
},
"node_modules/php-parser": {
"version": "3.1.5",
"resolved": "https://registry.npmjs.org/php-parser/-/php-parser-3.1.5.tgz",
"integrity": "sha512-jEY2DcbgCm5aclzBdfW86GM6VEIWcSlhTBSHN1qhJguVePlYe28GhwS0yoeLYXpM2K8y6wzLwrbq814n2PHSoQ==",
"license": "BSD-3-Clause",
"peer": true
},
"node_modules/picocolors": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.1.tgz",
@ -2912,6 +2961,43 @@
"url": "https://github.com/prettier/prettier?sponsor=1"
}
},
"node_modules/prettier-plugin-sh": {
"version": "0.14.0",
"resolved": "https://registry.npmjs.org/prettier-plugin-sh/-/prettier-plugin-sh-0.14.0.tgz",
"integrity": "sha512-hfXulj5+zEl/ulrO5kMuuTPKmXvOg0bnLHY1hKFNN/N+/903iZbNp8NyZBTsgI8dtkSgFfAEIQq0IQTyP1ZVFQ==",
"license": "MIT",
"dependencies": {
"mvdan-sh": "^0.10.1",
"sh-syntax": "^0.4.1"
},
"engines": {
"node": ">=16.0.0"
},
"funding": {
"url": "https://opencollective.com/unts"
},
"peerDependencies": {
"prettier": "^3.0.3"
}
},
"node_modules/prettier-plugin-toml": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/prettier-plugin-toml/-/prettier-plugin-toml-2.0.1.tgz",
"integrity": "sha512-99z1YOkViECHtXQjGIigd3talI/ybUI1zB3yniAwUrlWBXupNXThB1hM6bwSMUEj2/+tomTlMtT98F5t4s8IWA==",
"license": "MIT",
"dependencies": {
"@taplo/lib": "^0.4.0-alpha.2"
},
"engines": {
"node": ">=16.0.0"
},
"funding": {
"url": "https://opencollective.com/unts"
},
"peerDependencies": {
"prettier": "^3.0.3"
}
},
"node_modules/punycode": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
@ -3213,6 +3299,21 @@
"node": ">=10"
}
},
"node_modules/sh-syntax": {
"version": "0.4.2",
"resolved": "https://registry.npmjs.org/sh-syntax/-/sh-syntax-0.4.2.tgz",
"integrity": "sha512-/l2UZ5fhGZLVZa16XQM9/Vq/hezGGbdHeVEA01uWjOL1+7Ek/gt6FquW0iKKws4a9AYPYvlz6RyVvjh3JxOteg==",
"license": "MIT",
"dependencies": {
"tslib": "^2.6.2"
},
"engines": {
"node": ">=16.0.0"
},
"funding": {
"url": "https://opencollective.com/unts"
}
},
"node_modules/shebang-command": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
@ -3403,6 +3504,12 @@
"typescript": ">=4.2.0"
}
},
"node_modules/tslib": {
"version": "2.6.3",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz",
"integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==",
"license": "0BSD"
},
"node_modules/type-check": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
@ -3692,11 +3799,10 @@
},
"npm/eslint-config": {
"name": "@revi/eslint-config",
"version": "0.0.2",
"version": "0.0.3",
"license": "Apache-2.0",
"devDependencies": {
"@revi/prettier-config": "^0.0.2",
"eslint-config-prettier": "^9.1.0",
"prettier": "^3.3.2"
},
"funding": {
@ -3705,12 +3811,15 @@
"peerDependencies": {
"@eslint/js": "^8.0.0 || ^9.0.0",
"eslint": "^8.0.0 || ^9.0.0",
"eslint-config-prettier": "^9.1.0",
"globals": "^15.4.0"
}
},
"npm/prettier-config": {
"name": "@revi/prettier-config",
"npm/eslint-config/node_modules/@revi/prettier-config": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/@revi/prettier-config/-/prettier-config-0.0.2.tgz",
"integrity": "sha512-uusTuawhAcxsIJrQ0skhm2MFQEN1xaH7PMkcQxns8ytD9KDdt5Ma9lfRCy7ahYdEKtev0v95vtq5nbkewRXstg==",
"dev": true,
"license": "Apache-2.0",
"funding": {
"url": "https://github.com/sponsors/revi"
@ -3718,6 +3827,22 @@
"peerDependencies": {
"prettier": "^3.3.2"
}
},
"npm/prettier-config": {
"name": "@revi/prettier-config",
"version": "0.0.3",
"license": "Apache-2.0",
"dependencies": {
"prettier-plugin-sh": "0.14.0",
"prettier-plugin-toml": "2.0.1"
},
"funding": {
"url": "https://github.com/sponsors/revi"
},
"peerDependencies": {
"@prettier/plugin-php": "0.22.2",
"prettier": "3.3.2"
}
}
},
"dependencies": {
@ -3953,17 +4078,51 @@
"fastq": "^1.6.0"
}
},
"@prettier/plugin-php": {
"version": "0.22.2",
"resolved": "https://registry.npmjs.org/@prettier/plugin-php/-/plugin-php-0.22.2.tgz",
"integrity": "sha512-md0+7tNbsP0oy+wIP3KZZc6fzx1k1jtWaMjOy/gM8yU9f2BDYEi+iHOc/UNPihYvPI28zFTbjvlhH4QXQjQwNg==",
"peer": true,
"requires": {
"linguist-languages": "^7.27.0",
"php-parser": "^3.1.5"
}
},
"@revi/eslint-config": {
"version": "file:npm/eslint-config",
"requires": {
"@revi/prettier-config": "^0.0.2",
"eslint-config-prettier": "^9.1.0",
"prettier": "^3.3.2"
},
"dependencies": {
"@revi/prettier-config": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/@revi/prettier-config/-/prettier-config-0.0.2.tgz",
"integrity": "sha512-uusTuawhAcxsIJrQ0skhm2MFQEN1xaH7PMkcQxns8ytD9KDdt5Ma9lfRCy7ahYdEKtev0v95vtq5nbkewRXstg==",
"dev": true,
"requires": {}
}
}
},
"@revi/prettier-config": {
"version": "file:npm/prettier-config",
"requires": {}
"requires": {
"prettier-plugin-sh": "0.14.0",
"prettier-plugin-toml": "2.0.1"
}
},
"@taplo/core": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/@taplo/core/-/core-0.1.1.tgz",
"integrity": "sha512-BG/zLGf5wiNXGEVPvUAAX/4ilB3PwDUY2o0MV0y47mZbDZ9ad9UK/cIQsILat3bqbPJsALVbU6k3cskNZ3vAQg=="
},
"@taplo/lib": {
"version": "0.4.0-alpha.2",
"resolved": "https://registry.npmjs.org/@taplo/lib/-/lib-0.4.0-alpha.2.tgz",
"integrity": "sha512-DV/Re3DPVY+BhBtLZ3dmP4mP6YMLSsgq9qGLXwOV38lvNF/fBlgvQswzlXmzCEefL/3q2eMoefZpOI/+GLuCNA==",
"requires": {
"@taplo/core": "^0.1.0"
}
},
"@types/eslint": {
"version": "8.56.10",
@ -4508,7 +4667,7 @@
"version": "9.1.0",
"resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz",
"integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==",
"dev": true,
"peer": true,
"requires": {}
},
"eslint-config-wikimedia": {
@ -5416,6 +5575,12 @@
"integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==",
"dev": true
},
"linguist-languages": {
"version": "7.27.0",
"resolved": "https://registry.npmjs.org/linguist-languages/-/linguist-languages-7.27.0.tgz",
"integrity": "sha512-Wzx/22c5Jsv2ag+uKy+ITanGA5hzvBZngrNGDXLTC7ZjGM6FLCYGgomauTkxNJeP9of353OM0pWqngYA180xgw==",
"peer": true
},
"locate-path": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz",
@ -5476,6 +5641,11 @@
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
},
"mvdan-sh": {
"version": "0.10.1",
"resolved": "https://registry.npmjs.org/mvdan-sh/-/mvdan-sh-0.10.1.tgz",
"integrity": "sha512-kMbrH0EObaKmK3nVRKUIIya1dpASHIEusM13S4V1ViHFuxuNxCo+arxoa6j/dbV22YBGjl7UKJm9QQKJ2Crzhg=="
},
"natural-compare": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",
@ -5614,6 +5784,12 @@
"integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==",
"dev": true
},
"php-parser": {
"version": "3.1.5",
"resolved": "https://registry.npmjs.org/php-parser/-/php-parser-3.1.5.tgz",
"integrity": "sha512-jEY2DcbgCm5aclzBdfW86GM6VEIWcSlhTBSHN1qhJguVePlYe28GhwS0yoeLYXpM2K8y6wzLwrbq814n2PHSoQ==",
"peer": true
},
"picocolors": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.1.tgz",
@ -5652,6 +5828,23 @@
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.2.tgz",
"integrity": "sha512-rAVeHYMcv8ATV5d508CFdn+8/pHPpXeIid1DdrPwXnaAdH7cqjVbpJaT5eq4yRAFU/lsbwYwSF/n5iNrdJHPQA=="
},
"prettier-plugin-sh": {
"version": "0.14.0",
"resolved": "https://registry.npmjs.org/prettier-plugin-sh/-/prettier-plugin-sh-0.14.0.tgz",
"integrity": "sha512-hfXulj5+zEl/ulrO5kMuuTPKmXvOg0bnLHY1hKFNN/N+/903iZbNp8NyZBTsgI8dtkSgFfAEIQq0IQTyP1ZVFQ==",
"requires": {
"mvdan-sh": "^0.10.1",
"sh-syntax": "^0.4.1"
}
},
"prettier-plugin-toml": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/prettier-plugin-toml/-/prettier-plugin-toml-2.0.1.tgz",
"integrity": "sha512-99z1YOkViECHtXQjGIigd3talI/ybUI1zB3yniAwUrlWBXupNXThB1hM6bwSMUEj2/+tomTlMtT98F5t4s8IWA==",
"requires": {
"@taplo/lib": "^0.4.0-alpha.2"
}
},
"punycode": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
@ -5838,6 +6031,14 @@
"integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==",
"dev": true
},
"sh-syntax": {
"version": "0.4.2",
"resolved": "https://registry.npmjs.org/sh-syntax/-/sh-syntax-0.4.2.tgz",
"integrity": "sha512-/l2UZ5fhGZLVZa16XQM9/Vq/hezGGbdHeVEA01uWjOL1+7Ek/gt6FquW0iKKws4a9AYPYvlz6RyVvjh3JxOteg==",
"requires": {
"tslib": "^2.6.2"
}
},
"shebang-command": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
@ -5971,6 +6172,11 @@
"dev": true,
"requires": {}
},
"tslib": {
"version": "2.6.3",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz",
"integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ=="
},
"type-check": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",