From 8a6c2f833d8b3245399d930c74cf3996384b3d1f Mon Sep 17 00:00:00 2001 From: Denis Raslov Date: Sun, 31 Jul 2022 16:35:38 +0300 Subject: [PATCH] Update README.md --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 27338b1..dab8108 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,9 @@ If you want all the directories of the project to be checked, you don't need to There are 3 ways to specify a rule: - the exact path of a directory, - `*` instead of a directory name if any directory accepted on that level, -- `**` instead of a directory name if any directory accepted on any lower level. +- `**` **at the end of a rule** instead of a directory name if any directory accepted on any lower level. + +⚠️ `**` **can be used only at the end of a rule** because it doesn't make sense to use it at the middle of a rule. It would make any number of nested directories in the middle of a path accepted which gives too much flexibility for the idea of clearly defined directory structure rules. For example: @@ -78,6 +80,7 @@ Rule | Meaning `components/*` | ✅  The directory `components` is accepted.
✅  Any *first level* nested directory is accepted.
❌  Any *second level* nested directory is not accepted. `components/*/utils` | ✅  The directory `components` is accepted.
✅  Any *first level* nested directory is accepted.
✅  The *second level* nested directory `utils` is accepted.
❌  Any other *second level* nested directory is not accepted. `legacy/**` | ✅  The directory `legacy` is accepted.
✅  Any nested directory on *any level* is accepted. +`components/*/legacy/**` | ✅  The directory `components` is accepted.
✅  Any *first level* nested directory is accepted.
✅  The *second level* nested directory `legacy` is accepted.
❌  Any other *second level* nested directory is not accepted.
✅  Any nested directory on *any level* inside of *legacy* directiry is accepted. ⚠️ A rule like `components/*/utils` automatically make the `components` and `components/*` rules work. So, no need to specify a rule for every level directory. You need to specify the deepest path.