You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/use/configure/configuration-files.md
+21Lines changed: 21 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -706,6 +706,27 @@ In this example, `exampleConfig` can be either an object or an array, and either
706
706
707
707
For more information on how to combine shareable configs with your preferences, please see [Combine Configs](combine-configs).
708
708
709
+
### When to Use Extends vs Cascading
710
+
711
+
When to use `Extends`:
712
+
713
+
-**For reusing configurations** - When you want to inherit and build upon existing configurations from plugins, shareable packages, or predefined configs.
714
+
-**For plugin configuration** - When applying recommended or specific configurations from ESLint plugins (e.g., `example/recommended`).
715
+
-**For shareable configurations** - When using npm packages that export configuration objects (e.g., `eslint-config-example`).
716
+
-**For predefined configurations** - When using ESLint's built-in configurations like `js/recommended` or `js/all`.
717
+
-**For modular configuration** - When you want to compose multiple configuration sources into a single configuration object.
718
+
-**For maintaining consistency** - When you want to ensure consistent base rules across multiple configuration objects.
719
+
-**For plugin integration** - When you need to apply configurations that come bundled with plugins.
720
+
721
+
When to use `Cascading`:
722
+
723
+
-**For file-specific rule** - When you need different rules for different file patterns or directories.
724
+
-**For progressive configuration** - When you want to apply base rules to all files and then add/override rules for specific subsets.
725
+
-**For environment-specific settings** - When test files, source files, and config files need different rule sets.
726
+
-**For directory-based configuration** - When different project directories require different linting approaches.
727
+
-**For rule severity adjustment** - When you want to change rule severity (`error`/`warn`/`off`) for specific file patterns.
728
+
-**For language option variations** - When different files need different ECMAScript versions or parser options.
729
+
709
730
### Configuration Naming Conventions
710
731
711
732
The `name` property is optional, but it is recommended to provide a name for each configuration object, especially when you are creating shared configurations. The name is used in error messages and the config inspector to help identify which configuration object is being used.
0 commit comments