From 9643e951ca4aa2c29839cc42365cec8eab582fe4 Mon Sep 17 00:00:00 2001 From: Krakazybik Date: Mon, 20 Dec 2021 12:21:06 +0300 Subject: [PATCH 1/2] doc(readme): rules customization. --- README.md | 24 ++++++++++++++++++++++-- rules/import-order/index.md | 5 ++++- rules/layers-slices-boundaries/index.md | 3 +++ rules/public-api-boundaries/index.md | 5 ++++- 4 files changed, 33 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a1f4ccd..dde5186 100644 --- a/README.md +++ b/README.md @@ -113,7 +113,7 @@ import { Button } from "shared/ui"; npm install --save-dev @feature-sliced/eslint-config eslint-plugin-import eslint-plugin-boundaries ``` -3. Add config to the `extends` section of your eslint configuration file. You can omit the `eslint-plugin` suffix: +3. Add config ( for **recommended** presets ) to the `extends` section of your eslint configuration file. You can omit the `eslint-plugin` suffix: ```json { @@ -121,7 +121,27 @@ import { Button } from "shared/ui"; } ``` -> Further, you can override / disable some rules if needed. +## Customization +You can partially use the rules + +#### Note: +Don't use main config (`@feature-sliced`) in customization to avoid rules conflicts. + +#### Example: +```json + { + "extends": [ + "@feature-sliced/eslint-config/rules/import-order", + "@feature-sliced/eslint-config/rules/public-api-boundaries", + "@feature-sliced/eslint-config/rules/layers-slices-boundaries" + ] + } +``` + +#### Available rules +- [import-order](./rules/import-order/index.md) +- [public-api-boundaries](./rules/public-api-boundaries/index.md) +- [layers-slices-boundaries](./rules/layers-slices-boundaries/index.md) ## Usage with TypeScript diff --git a/rules/import-order/index.md b/rules/import-order/index.md index 06fb534..cf78f80 100644 --- a/rules/import-order/index.md +++ b/rules/import-order/index.md @@ -1,6 +1,9 @@ # @feature-sliced/import-order -Reference: [Layers](https://feature-sliced.design/docs/reference/layers) +#### Reference: [Layers](https://feature-sliced.design/docs/reference/layers) + +#### Usage: +Add `"@feature-sliced/eslint-config/rules/import-order"` to you `extends` section in ESLint config. ```js // 👎 Fail diff --git a/rules/layers-slices-boundaries/index.md b/rules/layers-slices-boundaries/index.md index 96569e5..1b62f9a 100644 --- a/rules/layers-slices-boundaries/index.md +++ b/rules/layers-slices-boundaries/index.md @@ -2,6 +2,9 @@ Reference: [Cross-communication](https://feature-sliced.design/docs/concepts/cross-communication) +#### Usage: +Add `"@feature-sliced/eslint-config/rules/layers-slices-boundaries"` to you `extends` section in ESLint config. + ```js // 👎 Fail // 🛣 features/auth-form/index.ts diff --git a/rules/public-api-boundaries/index.md b/rules/public-api-boundaries/index.md index ea36cef..0483dc6 100644 --- a/rules/public-api-boundaries/index.md +++ b/rules/public-api-boundaries/index.md @@ -1,6 +1,9 @@ # @feature-sliced/public-api-boundaries -Reference: [PublicAPI](https://feature-sliced.design/docs/concepts/public-api) +#### Reference: [PublicAPI](https://feature-sliced.design/docs/concepts/public-api) + +#### Usage: +Add `"@feature-sliced/eslint-config/rules/public-api-boundaries"` to you `extends` section in ESLint config. ```js // 👎 Fail From b5700cc73771f07f98d196ad998e79511dd35a67 Mon Sep 17 00:00:00 2001 From: Krakazybik Date: Mon, 20 Dec 2021 12:27:21 +0300 Subject: [PATCH 2/2] doc(readme): to same style of reference --- rules/layers-slices-boundaries/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/layers-slices-boundaries/index.md b/rules/layers-slices-boundaries/index.md index 1b62f9a..e3dd9b5 100644 --- a/rules/layers-slices-boundaries/index.md +++ b/rules/layers-slices-boundaries/index.md @@ -1,6 +1,6 @@ # @feature-sliced/layers-slices-boundaries -Reference: [Cross-communication](https://feature-sliced.design/docs/concepts/cross-communication) +#### Reference: [Cross-communication](https://feature-sliced.design/docs/concepts/cross-communication) #### Usage: Add `"@feature-sliced/eslint-config/rules/layers-slices-boundaries"` to you `extends` section in ESLint config.