From 49e3aff78b838b5ebb53f4d61be7590cc429b64a Mon Sep 17 00:00:00 2001 From: Philip <42116482+PhilipAbed@users.noreply.github.com> Date: Fri, 10 Jun 2022 07:48:06 +0300 Subject: [PATCH] docs: update best practices regex groups + windows clrf + exporting test functions (#15969) --- docs/development/best-practices.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/development/best-practices.md b/docs/development/best-practices.md index 5bfc410ee2..d5f5327aec 100644 --- a/docs/development/best-practices.md +++ b/docs/development/best-practices.md @@ -135,6 +135,7 @@ Use `UTC` to be time zone independent. - Avoid `toMatchSnapshot`, only use it for: - huge strings like the Renovate PR body text - huge complex objects where you only need to test parts +- Avoid exporting functions purely for the purpose of testing unless you really need to ### Fixtures @@ -164,3 +165,12 @@ Use [JSDoc](https://jsdoc.app/index.html) to declare types and function prototyp - Omit constructors when defining Static classes - [No `#private` fields](https://google.github.io/styleguide/tsguide.html#private-fields). instead, use TypeScript's visibility annotations - Avoid underscore suffixes or prefixes, for example: `_prop`, use [whole words](https://google.github.io/styleguide/tsguide.html#properties-used-outside-of-class-lexical-scope) as suffix/prefix i.e. `internalProp` + +### regex + +Use [Named Capturing Groups](https://www.regular-expressions.info/named.html) when capturing multiple groups, for example: `(?<groupName>CapturedGroup)`. + +### Windows + +We recommend you set [`core.autocrlf = input`](https://git-scm.com/docs/gitattributes#_text) in your `gitConfig`, or the carriage return `\r\n` might confuse Renovate bot. +You can also set the line endings in your repository by adding `* text=auto eol=lf` to your `.gitattributes` file. -- GitLab