From fb06797ad64310f9089882e9a53808bfc0c79115 Mon Sep 17 00:00:00 2001 From: SuperITMan Date: Tue, 9 Mar 2021 12:52:10 +0100 Subject: [PATCH 1/3] refactor(prettier): add documentation in comments in prettier config files Give information about the rules, their default value and provide a direct link to Prettier documentation --- lib/prettier/1.16.x/.prettierrc.js | 34 +++++++++++++++++++++ lib/prettier/1.17.x/.prettierrc.js | 34 +++++++++++++++++++++ lib/prettier/1.18.x/.prettierrc.js | 34 +++++++++++++++++++++ lib/prettier/1.19.x/.prettierrc.js | 34 +++++++++++++++++++++ lib/prettier/2.0.x/.prettierrc.js | 48 ++++++++++++++++++++++++++++++ 5 files changed, 184 insertions(+) diff --git a/lib/prettier/1.16.x/.prettierrc.js b/lib/prettier/1.16.x/.prettierrc.js index b08e9ea1..1835b0fb 100644 --- a/lib/prettier/1.16.x/.prettierrc.js +++ b/lib/prettier/1.16.x/.prettierrc.js @@ -1,8 +1,42 @@ module.exports = { + /** + * The line length where Prettier will try wrap. + * Default: `80` + * + * See: https://prettier.io/docs/en/options.html#print-width + */ printWidth: 140, + + /** + * Number of spaces per indentation level. + * Default: `2` + * + * See: https://prettier.io/docs/en/options.html#tab-width + */ tabWidth: 4, + + /** + * Indent with tabs instead of spaces. + * Default: `false` + * + * https://prettier.io/docs/en/options.html#tabs + */ useTabs: true, + + /** + * Print trailing commas wherever possible when multi-line. + * Default: `"es5"` + * + * See: https://prettier.io/docs/en/options.html#trailing-commas + */ trailingComma: "none", + + /** + * Print spaces between brackets. + * Default: `true` + * + * See: https://prettier.io/docs/en/options.html#bracket-spacing + */ bracketSpacing: true, overrides: [ { diff --git a/lib/prettier/1.17.x/.prettierrc.js b/lib/prettier/1.17.x/.prettierrc.js index b08e9ea1..1835b0fb 100644 --- a/lib/prettier/1.17.x/.prettierrc.js +++ b/lib/prettier/1.17.x/.prettierrc.js @@ -1,8 +1,42 @@ module.exports = { + /** + * The line length where Prettier will try wrap. + * Default: `80` + * + * See: https://prettier.io/docs/en/options.html#print-width + */ printWidth: 140, + + /** + * Number of spaces per indentation level. + * Default: `2` + * + * See: https://prettier.io/docs/en/options.html#tab-width + */ tabWidth: 4, + + /** + * Indent with tabs instead of spaces. + * Default: `false` + * + * https://prettier.io/docs/en/options.html#tabs + */ useTabs: true, + + /** + * Print trailing commas wherever possible when multi-line. + * Default: `"es5"` + * + * See: https://prettier.io/docs/en/options.html#trailing-commas + */ trailingComma: "none", + + /** + * Print spaces between brackets. + * Default: `true` + * + * See: https://prettier.io/docs/en/options.html#bracket-spacing + */ bracketSpacing: true, overrides: [ { diff --git a/lib/prettier/1.18.x/.prettierrc.js b/lib/prettier/1.18.x/.prettierrc.js index b08e9ea1..1835b0fb 100644 --- a/lib/prettier/1.18.x/.prettierrc.js +++ b/lib/prettier/1.18.x/.prettierrc.js @@ -1,8 +1,42 @@ module.exports = { + /** + * The line length where Prettier will try wrap. + * Default: `80` + * + * See: https://prettier.io/docs/en/options.html#print-width + */ printWidth: 140, + + /** + * Number of spaces per indentation level. + * Default: `2` + * + * See: https://prettier.io/docs/en/options.html#tab-width + */ tabWidth: 4, + + /** + * Indent with tabs instead of spaces. + * Default: `false` + * + * https://prettier.io/docs/en/options.html#tabs + */ useTabs: true, + + /** + * Print trailing commas wherever possible when multi-line. + * Default: `"es5"` + * + * See: https://prettier.io/docs/en/options.html#trailing-commas + */ trailingComma: "none", + + /** + * Print spaces between brackets. + * Default: `true` + * + * See: https://prettier.io/docs/en/options.html#bracket-spacing + */ bracketSpacing: true, overrides: [ { diff --git a/lib/prettier/1.19.x/.prettierrc.js b/lib/prettier/1.19.x/.prettierrc.js index b08e9ea1..1835b0fb 100644 --- a/lib/prettier/1.19.x/.prettierrc.js +++ b/lib/prettier/1.19.x/.prettierrc.js @@ -1,8 +1,42 @@ module.exports = { + /** + * The line length where Prettier will try wrap. + * Default: `80` + * + * See: https://prettier.io/docs/en/options.html#print-width + */ printWidth: 140, + + /** + * Number of spaces per indentation level. + * Default: `2` + * + * See: https://prettier.io/docs/en/options.html#tab-width + */ tabWidth: 4, + + /** + * Indent with tabs instead of spaces. + * Default: `false` + * + * https://prettier.io/docs/en/options.html#tabs + */ useTabs: true, + + /** + * Print trailing commas wherever possible when multi-line. + * Default: `"es5"` + * + * See: https://prettier.io/docs/en/options.html#trailing-commas + */ trailingComma: "none", + + /** + * Print spaces between brackets. + * Default: `true` + * + * See: https://prettier.io/docs/en/options.html#bracket-spacing + */ bracketSpacing: true, overrides: [ { diff --git a/lib/prettier/2.0.x/.prettierrc.js b/lib/prettier/2.0.x/.prettierrc.js index 3c4e9752..15e9640b 100644 --- a/lib/prettier/2.0.x/.prettierrc.js +++ b/lib/prettier/2.0.x/.prettierrc.js @@ -1,10 +1,58 @@ module.exports = { + /** + * The line length where Prettier will try wrap. + * Default: `80` + * + * See: https://prettier.io/docs/en/options.html#print-width + */ printWidth: 140, + + /** + * Number of spaces per indentation level. + * Default: `2` + * + * See: https://prettier.io/docs/en/options.html#tab-width + */ tabWidth: 4, + + /** + * Indent with tabs instead of spaces. + * Default: `false` + * + * https://prettier.io/docs/en/options.html#tabs + */ useTabs: true, + + /** + * Print trailing commas wherever possible when multi-line. + * Default: `"es5"` + * + * See: https://prettier.io/docs/en/options.html#trailing-commas + */ trailingComma: "none", + + /** + * Print spaces between brackets. + * Default: `true` + * + * See: https://prettier.io/docs/en/options.html#bracket-spacing + */ bracketSpacing: true, + + /** + * Which end of line characters to apply. + * Default: `lf` + * + * See: https://prettier.io/docs/en/options.html#end-of-line + */ endOfLine: "auto", + + /** + * Include parentheses around a sole arrow function parameter. + * Default: `"always"` + * + * See: https://prettier.io/docs/en/options.html#arrow-function-parentheses + */ arrowParens: "always", overrides: [ { From 4ed0a92f4d82979a61f9f62685befbfa72111525 Mon Sep 17 00:00:00 2001 From: SuperITMan Date: Tue, 9 Mar 2021 13:06:37 +0100 Subject: [PATCH 2/3] feat(prettier): add support for prettier 2.1.x Set default value for new "embeddedLanguageFormatting" option and overrides configuration for markdown files to use 2 spaces instead of tab. --- .prettierrc.js | 2 +- lib/prettier/2.1.x/.prettierrc.js | 80 +++++++++++++++++++++++++++++++ lib/prettier/2.1.x/README.md | 15 ++++++ lib/prettier/2.1.x/package.json | 4 ++ lib/prettier/README.md | 13 ++--- package-lock.json | 10 ++-- package.json | 2 +- 7 files changed, 112 insertions(+), 14 deletions(-) create mode 100644 lib/prettier/2.1.x/.prettierrc.js create mode 100644 lib/prettier/2.1.x/README.md create mode 100644 lib/prettier/2.1.x/package.json diff --git a/.prettierrc.js b/.prettierrc.js index 91545ebe..a3259219 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -1 +1 @@ -module.exports = require("./lib/prettier/2.0.x/.prettierrc.js"); +module.exports = require("./lib/prettier/2.1.x/.prettierrc.js"); diff --git a/lib/prettier/2.1.x/.prettierrc.js b/lib/prettier/2.1.x/.prettierrc.js new file mode 100644 index 00000000..1004aca9 --- /dev/null +++ b/lib/prettier/2.1.x/.prettierrc.js @@ -0,0 +1,80 @@ +module.exports = { + /** + * The line length where Prettier will try wrap. + * Default: `80` + * + * See: https://prettier.io/docs/en/options.html#print-width + */ + printWidth: 140, + + /** + * Number of spaces per indentation level. + * Default: `2` + * + * See: https://prettier.io/docs/en/options.html#tab-width + */ + tabWidth: 4, + + /** + * Indent with tabs instead of spaces. + * Default: `false` + * + * https://prettier.io/docs/en/options.html#tabs + */ + useTabs: true, + + /** + * Print trailing commas wherever possible when multi-line. + * Default: `"es5"` + * + * See: https://prettier.io/docs/en/options.html#trailing-commas + */ + trailingComma: "none", + + /** + * Print spaces between brackets. + * Default: `true` + * + * See: https://prettier.io/docs/en/options.html#bracket-spacing + */ + bracketSpacing: true, + + /** + * Which end of line characters to apply. + * Default: `lf` + * + * See: https://prettier.io/docs/en/options.html#end-of-line + */ + endOfLine: "auto", + + /** + * Include parentheses around a sole arrow function parameter. + * Default: `"always"` + * + * See: https://prettier.io/docs/en/options.html#arrow-function-parentheses + */ + arrowParens: "always", + + /** + * Control how Prettier formats quoted code embedded in the file. + * Default: `"auto"` + * + * See: https://prettier.io/docs/en/options.html#embedded-language-formatting + */ + embeddedLanguageFormatting: "auto", + overrides: [ + { + files: "*.{pcss,scss,css,json,md,yml}", + options: { + tabWidth: 2, + useTabs: false + } + }, + { + files: "*.html", + options: { + parser: "angular" + } + } + ] +}; diff --git a/lib/prettier/2.1.x/README.md b/lib/prettier/2.1.x/README.md new file mode 100644 index 00000000..be554cbe --- /dev/null +++ b/lib/prettier/2.1.x/README.md @@ -0,0 +1,15 @@ +

+ code style - Prettier 2.1.x +

+ +## About + +This sub-package hosts the [Prettier](https://prettier.io) configuration for version 2.1.x. + +## Usage + +Create a `.prettierrc.js` file and copy the following content inside: + +```js +module.exports = require("@nationalbankbelgium/code-style/prettier/2.1.x"); +``` diff --git a/lib/prettier/2.1.x/package.json b/lib/prettier/2.1.x/package.json new file mode 100644 index 00000000..22bdb5f7 --- /dev/null +++ b/lib/prettier/2.1.x/package.json @@ -0,0 +1,4 @@ +{ + "name": "@nationalbankbelgium/code-style/prettier/2.1.x", + "main": ".prettierrc.js" +} diff --git a/lib/prettier/README.md b/lib/prettier/README.md index 903aa7b1..79a943a5 100644 --- a/lib/prettier/README.md +++ b/lib/prettier/README.md @@ -8,18 +8,19 @@ This sub-package hosts the [Prettier](https://prettier.io) configuration. The following versions are available (based on **Prettier** version): -- 1.16.x - `@nationalbankbelgium/code-style/prettier/1.16.x` -- 1.17.x - `@nationalbankbelgium/code-style/prettier/1.17.x` -- 1.18.x - `@nationalbankbelgium/code-style/prettier/1.18.x` -- 1.19.x - `@nationalbankbelgium/code-style/prettier/1.19.x` -- 2.0.x - `@nationalbankbelgium/code-style/prettier/2.0.x` +- 1.16.x - `@nationalbankbelgium/code-style/prettier/1.16.x` +- 1.17.x - `@nationalbankbelgium/code-style/prettier/1.17.x` +- 1.18.x - `@nationalbankbelgium/code-style/prettier/1.18.x` +- 1.19.x - `@nationalbankbelgium/code-style/prettier/1.19.x` +- 2.0.x - `@nationalbankbelgium/code-style/prettier/2.0.x` +- 2.1.x - `@nationalbankbelgium/code-style/prettier/2.1.x` ## Usage Create a `.prettierrc.js` file and copy the following content inside: ```js -module.exports = require("@nationalbankbelgium/code-style/prettier/2.0.x"); +module.exports = require("@nationalbankbelgium/code-style/prettier/2.1.x"); ``` ## Recommended Additional Configs diff --git a/package-lock.json b/package-lock.json index a885a757..ecebc7e5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4370,7 +4370,6 @@ "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.1.0.tgz", "integrity": "sha512-+mi/lmVVNKFNVyLXV31ERiy2CY5E1/F6QtJFEzoChPRwwngMNXRDQ9GJ5WdE2Z2P4AujsOi0/+2qHID68KwfIQ==", "dev": true, - "optional": true, "requires": { "@babel/code-frame": "^7.0.0", "error-ex": "^1.3.1", @@ -4382,8 +4381,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", - "dev": true, - "optional": true + "dev": true } } }, @@ -8549,9 +8547,9 @@ "dev": true }, "prettier": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.4.tgz", - "integrity": "sha512-SVJIQ51spzFDvh4fIbCLvciiDMCrRhlN3mbZvv/+ycjvmF5E73bKdGfU8QDLNmjYJf+lsGnDBC4UUnvTe5OO0w==", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.1.2.tgz", + "integrity": "sha512-16c7K+x4qVlJg9rEbXl7HEGmQyZlG4R9AgP+oHKRMsMsuk8s+ATStlf1NpDqyBI1HpVyfjLOeMhH2LvuNvV5Vg==", "dev": true }, "process-nextick-args": { diff --git a/package.json b/package.json index 331dd7fc..0eb2719f 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "cz-customizable": "^6.2.0", "husky": "^4.2.1", "lint-staged": "^10.0.7", - "prettier": "~2.0.4", + "prettier": "~2.1.2", "release-it": "^14.2.0", "stylelint": "~13.3.1", "tslint": "~6.1.0", From 533bd19256cfa264ba9784391948e3049b311376 Mon Sep 17 00:00:00 2001 From: SuperITMan Date: Tue, 9 Mar 2021 13:15:14 +0100 Subject: [PATCH 3/3] feat(prettier): add support for prettier 2.2.x --- .prettierrc.js | 2 +- lib/prettier/2.2.x/.prettierrc.js | 80 +++++++++++++++++++++++++++++++ lib/prettier/2.2.x/README.md | 15 ++++++ lib/prettier/2.2.x/package.json | 4 ++ lib/prettier/README.md | 3 +- package-lock.json | 6 +-- package.json | 2 +- 7 files changed, 106 insertions(+), 6 deletions(-) create mode 100644 lib/prettier/2.2.x/.prettierrc.js create mode 100644 lib/prettier/2.2.x/README.md create mode 100644 lib/prettier/2.2.x/package.json diff --git a/.prettierrc.js b/.prettierrc.js index a3259219..339afaae 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -1 +1 @@ -module.exports = require("./lib/prettier/2.1.x/.prettierrc.js"); +module.exports = require("./lib/prettier/2.2.x/.prettierrc.js"); diff --git a/lib/prettier/2.2.x/.prettierrc.js b/lib/prettier/2.2.x/.prettierrc.js new file mode 100644 index 00000000..1004aca9 --- /dev/null +++ b/lib/prettier/2.2.x/.prettierrc.js @@ -0,0 +1,80 @@ +module.exports = { + /** + * The line length where Prettier will try wrap. + * Default: `80` + * + * See: https://prettier.io/docs/en/options.html#print-width + */ + printWidth: 140, + + /** + * Number of spaces per indentation level. + * Default: `2` + * + * See: https://prettier.io/docs/en/options.html#tab-width + */ + tabWidth: 4, + + /** + * Indent with tabs instead of spaces. + * Default: `false` + * + * https://prettier.io/docs/en/options.html#tabs + */ + useTabs: true, + + /** + * Print trailing commas wherever possible when multi-line. + * Default: `"es5"` + * + * See: https://prettier.io/docs/en/options.html#trailing-commas + */ + trailingComma: "none", + + /** + * Print spaces between brackets. + * Default: `true` + * + * See: https://prettier.io/docs/en/options.html#bracket-spacing + */ + bracketSpacing: true, + + /** + * Which end of line characters to apply. + * Default: `lf` + * + * See: https://prettier.io/docs/en/options.html#end-of-line + */ + endOfLine: "auto", + + /** + * Include parentheses around a sole arrow function parameter. + * Default: `"always"` + * + * See: https://prettier.io/docs/en/options.html#arrow-function-parentheses + */ + arrowParens: "always", + + /** + * Control how Prettier formats quoted code embedded in the file. + * Default: `"auto"` + * + * See: https://prettier.io/docs/en/options.html#embedded-language-formatting + */ + embeddedLanguageFormatting: "auto", + overrides: [ + { + files: "*.{pcss,scss,css,json,md,yml}", + options: { + tabWidth: 2, + useTabs: false + } + }, + { + files: "*.html", + options: { + parser: "angular" + } + } + ] +}; diff --git a/lib/prettier/2.2.x/README.md b/lib/prettier/2.2.x/README.md new file mode 100644 index 00000000..e03a43ea --- /dev/null +++ b/lib/prettier/2.2.x/README.md @@ -0,0 +1,15 @@ +

+ code style - Prettier 2.2.x +

+ +## About + +This sub-package hosts the [Prettier](https://prettier.io) configuration for version 2.2.x. + +## Usage + +Create a `.prettierrc.js` file and copy the following content inside: + +```js +module.exports = require("@nationalbankbelgium/code-style/prettier/2.2.x"); +``` diff --git a/lib/prettier/2.2.x/package.json b/lib/prettier/2.2.x/package.json new file mode 100644 index 00000000..3170a930 --- /dev/null +++ b/lib/prettier/2.2.x/package.json @@ -0,0 +1,4 @@ +{ + "name": "@nationalbankbelgium/code-style/prettier/2.2.x", + "main": ".prettierrc.js" +} diff --git a/lib/prettier/README.md b/lib/prettier/README.md index 79a943a5..524321ae 100644 --- a/lib/prettier/README.md +++ b/lib/prettier/README.md @@ -14,13 +14,14 @@ The following versions are available (based on **Prettier** version): - 1.19.x - `@nationalbankbelgium/code-style/prettier/1.19.x` - 2.0.x - `@nationalbankbelgium/code-style/prettier/2.0.x` - 2.1.x - `@nationalbankbelgium/code-style/prettier/2.1.x` +- 2.2.x - `@nationalbankbelgium/code-style/prettier/2.2.x` ## Usage Create a `.prettierrc.js` file and copy the following content inside: ```js -module.exports = require("@nationalbankbelgium/code-style/prettier/2.1.x"); +module.exports = require("@nationalbankbelgium/code-style/prettier/2.2.x"); ``` ## Recommended Additional Configs diff --git a/package-lock.json b/package-lock.json index ecebc7e5..a2fe6ab1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8547,9 +8547,9 @@ "dev": true }, "prettier": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.1.2.tgz", - "integrity": "sha512-16c7K+x4qVlJg9rEbXl7HEGmQyZlG4R9AgP+oHKRMsMsuk8s+ATStlf1NpDqyBI1HpVyfjLOeMhH2LvuNvV5Vg==", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.2.1.tgz", + "integrity": "sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==", "dev": true }, "process-nextick-args": { diff --git a/package.json b/package.json index 0eb2719f..1a7f7d49 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "cz-customizable": "^6.2.0", "husky": "^4.2.1", "lint-staged": "^10.0.7", - "prettier": "~2.1.2", + "prettier": "~2.2.1", "release-it": "^14.2.0", "stylelint": "~13.3.1", "tslint": "~6.1.0",