Bugzilla – Attachment 163695 Details for
Bug 36400
Centralize {js,ts,vue} formatting config in .prettierrc.js
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Attachment to Bug 36400 - Centralize {js,ts,vue} formatting config in .prettierrc.js
Bug-36400-Centralize-jstsvue-formatting-config-in-.patch (text/plain), 6.81 KB, created by
Paul Derscheid
on 2024-03-22 11:41:41 UTC
(
hide
)
Description:
Attachment to Bug 36400 - Centralize {js,ts,vue} formatting config in .prettierrc.js
Filename:
MIME Type:
Creator:
Paul Derscheid
Created:
2024-03-22 11:41:41 UTC
Size:
6.81 KB
patch
obsolete
>From acf3ddcbb77a5d1d9328f414c95c146cbc18273f Mon Sep 17 00:00:00 2001 >From: Paul Derscheid <paul.derscheid@lmscloud.de> >Date: Fri, 22 Mar 2024 12:29:50 +0100 >Subject: [PATCH] Bug 36400: Centralize {js,ts,vue} formatting config in > .prettierrc.js > > Let's centralize all formatting for js, ts and vue files in a .prettierrc.js. > The goal here is to preserve eslint's linting but ignore all of its formatting options. > > Seems to work for vue files in vscode, vscodium and neovim w/ vscode-eslint-language-server. > > To test: > 1) Pick any vue file for example. > 2) Run format via your editor and either npx prettier -c .prettierrc.js <PATH_TO_VUE_FILE> [you can also use the -w flag to directly write]. > 3) Look for unexpected changes: vue files should be already formatted w/ these inline flags (see: https://wiki.koha-community.org/wiki/Coding_Guidelines#JS14:_Prettier_JavaScript): [--trailing-comma es5, --arrow-parens avoid]. > 4) Sign off if you're happy and comment or show what went wrong in a comment. >--- > .eslintrc.json | 8 ++++++-- > .prettierrc.js | 13 +++++++++++++ > package.json | 2 ++ > yarn.lock | 43 +++++++++++++++++++++++++++++++++++++++++++ > 4 files changed, 64 insertions(+), 2 deletions(-) > create mode 100644 .prettierrc.js > >diff --git a/.eslintrc.json b/.eslintrc.json >index d4d775c4eb..e6bb78fb4c 100644 >--- a/.eslintrc.json >+++ b/.eslintrc.json >@@ -3,7 +3,10 @@ > "browser": true, > "jquery": true > }, >- "extends": "eslint:recommended", >+ "extends": [ >+ "eslint:recommended", >+ "prettier" >+ ], > "rules": { > "indent": [ > "error", >@@ -17,5 +20,6 @@ > "error", > "always" > ] >- } >+ }, >+ "prettier/prettier": "error" > } >diff --git a/.prettierrc.js b/.prettierrc.js >new file mode 100644 >index 0000000000..62b9288b56 >--- /dev/null >+++ b/.prettierrc.js >@@ -0,0 +1,13 @@ >+module.exports = { >+ arrowParens: "avoid", >+ editorconfig: "false", >+ trailingComma: "es5", >+ overrides: [ >+ { >+ files: "*.vue", >+ options: { >+ semi: false, >+ } >+ } >+ ] >+} >\ No newline at end of file >diff --git a/package.json b/package.json >index 06bcf3fe68..15ef5d1fcb 100644 >--- a/package.json >+++ b/package.json >@@ -73,6 +73,8 @@ > "babelify": "^10.0.0", > "browserify": "^17.0.0", > "clean-webpack-plugin": "^4.0.0", >+ "eslint-config-prettier": "^9.1.0", >+ "eslint-plugin-prettier": "^5.1.3", > "gulp-tap": "^1.0.1", > "html-webpack-plugin": "^5.5.0", > "postcss": "^8.4.14", >diff --git a/yarn.lock b/yarn.lock >index 06fc64ea41..a407c3c137 100644 >--- a/yarn.lock >+++ b/yarn.lock >@@ -1130,6 +1130,11 @@ > "@nodelib/fs.scandir" "2.1.5" > fastq "^1.6.0" > >+"@pkgr/core@^0.1.0": >+ version "0.1.1" >+ resolved "https://registry.yarnpkg.com/@pkgr/core/-/core-0.1.1.tgz#1ec17e2edbec25c8306d424ecfbf13c7de1aaa31" >+ integrity sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA== >+ > "@polka/url@^1.0.0-next.20": > version "1.0.0-next.21" > resolved "https://registry.yarnpkg.com/@polka/url/-/url-1.0.0-next.21.tgz#5de5a2385a35309427f6011992b544514d559aa1" >@@ -4075,6 +4080,19 @@ escape-string-regexp@^1.0.5: > resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" > integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= > >+eslint-config-prettier@^9.1.0: >+ version "9.1.0" >+ resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz#31af3d94578645966c082fcb71a5846d3c94867f" >+ integrity sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw== >+ >+eslint-plugin-prettier@^5.1.3: >+ version "5.1.3" >+ resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-5.1.3.tgz#17cfade9e732cef32b5f5be53bd4e07afd8e67e1" >+ integrity sha512-C9GCVAs4Eq7ZC/XFQHITLiHJxQngdtraXaM+LoUFoFp/lHNl2Zn8f3WQbe9HvTBBQ9YnKFB0/2Ajdqwo5D1EAw== >+ dependencies: >+ prettier-linter-helpers "^1.0.0" >+ synckit "^0.8.6" >+ > eslint-scope@5.1.1: > version "5.1.1" > resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c" >@@ -4347,6 +4365,11 @@ fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: > resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" > integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== > >+fast-diff@^1.1.2: >+ version "1.3.0" >+ resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.3.0.tgz#ece407fa550a64d638536cd727e129c61616e0f0" >+ integrity sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw== >+ > fast-glob@^3.2.11, fast-glob@^3.2.9: > version "3.2.11" > resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.11.tgz#a1172ad95ceb8a16e20caa5c5e56480e5129c1d9" >@@ -7833,6 +7856,13 @@ postcss@^8.3.11, postcss@^8.4.14, postcss@^8.4.16: > picocolors "^1.0.0" > source-map-js "^1.0.2" > >+prettier-linter-helpers@^1.0.0: >+ version "1.0.0" >+ resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b" >+ integrity sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w== >+ dependencies: >+ fast-diff "^1.1.2" >+ > "prettier@^1.18.2 || ^2.0.0": > version "2.7.1" > resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.7.1.tgz#e235806850d057f97bb08368a4f7d899f7760c64" >@@ -9285,6 +9315,14 @@ svgo@^2.7.0: > picocolors "^1.0.0" > stable "^0.1.8" > >+synckit@^0.8.6: >+ version "0.8.8" >+ resolved "https://registry.yarnpkg.com/synckit/-/synckit-0.8.8.tgz#fe7fe446518e3d3d49f5e429f443cf08b6edfcd7" >+ integrity sha512-HwOKAP7Wc5aRGYdKH+dw0PRRpbO841v2DENBtjnR5HFWoiNByAl7vrx3p0G/rCyYXQsrxqtX48TImFtPcIHSpQ== >+ dependencies: >+ "@pkgr/core" "^0.1.0" >+ tslib "^2.6.2" >+ > syntax-error@^1.1.1: > version "1.4.0" > resolved "https://registry.yarnpkg.com/syntax-error/-/syntax-error-1.4.0.tgz#2d9d4ff5c064acb711594a3e3b95054ad51d907c" >@@ -9532,6 +9570,11 @@ tslib@^2.0.3, tslib@^2.1.0: > resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3" > integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ== > >+tslib@^2.6.2: >+ version "2.6.2" >+ resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae" >+ integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q== >+ > tty-browserify@0.0.1: > version "0.0.1" > resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.1.tgz#3f05251ee17904dfd0677546670db9651682b811" >-- >2.44.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 36400
:
163695
|
163710
|
163799
|
163818
|
163825
|
164248
|
164249