@@ -799,10 +799,12 @@ Notes:
799
799
` solid/reactivity ` has been public for exactly one year (!) at the time of writing, and after lots
800
800
of feedback, testing, and changes, I've noticed a few problems with its first implementation:
801
801
802
- - ** Hard to change.** All of the data structure, analysis, and reporting code is colocated in a
803
- single file with all the cases for detecting signals, props, and tracked scopes based on Solid
804
- APIs. There's a few edge cases where detection code is mixed with analysis code. This makes it
805
- hard for contributors to make PRs and hard for others to be able to maintain it.
802
+ - ** Hard to make big changes.** All of the data structure, analysis, and reporting code is colocated
803
+ in a single file with all the cases for detecting signals, props, and tracked scopes based on
804
+ Solid APIs. There's a few edge cases where detection code is mixed with analysis code. This makes
805
+ it hard for contributors and maintainers to make sweeping generalizations about how the rule works
806
+ or make significant changes in its behavior. (That's not to say it's hard to make changes at
807
+ all—PRs are still welcome!)
806
808
- ** Limited to variables.** The analysis code relies heavily on ESLint's ` ScopeManager ` and scope
807
809
utilities, and therefore it can only deal with variable references, not implicitly reactive
808
810
expressions.
@@ -815,42 +817,22 @@ of feedback, testing, and changes, I've noticed a few problems with its first im
815
817
initialization before usage in source order. That's not a requirement I feel comfortable putting on
816
818
plugin authors, or really even myself in a few months.
817
819
818
- So, I've decided to partially rewrite the rule with a plugin architecture to alleviate these issues.
819
- Both the core detection code and any plugins to alter detection will use the same API.
820
+ So, I've decided to partially rewrite the rule with a modular architecture to alleviate these issues.
821
+ Both the core detection code and any dependency-specific detections will use the same API.
820
822
821
823
### Ease of change and extensibility: Plugins (Customizations)
822
824
823
- ` solid/reactivity ` , itself part of an ESLint plugin, will support plugins of its own.
825
+ ` solid/reactivity ` , itself part of an ESLint plugin, will move to a more modular, plugin-like architecture.
826
+ The ` reactivity/modules ` folder will hold files for core ` solid-js ` reactivity detection as well as
827
+ detection for specific dependencies (like ` solid-primitives ` , ` solid-start ` , etc.). All of these modules
828
+ will use the same API exposed in a requirable file. A ` reactivity/modules/index.ts ` file will manage
829
+ metadata and lazy module loading.
824
830
825
- ` eslint-plugin-solid ` will expose a CLI command ` eslint-plugin-solid ` that searches
826
- ` package.json ` files in the current working directory and its ` node_modules ` for a
827
- ` "solid/reactivity" ` key at the top level (raw string search first for perf). This key will be expected to
828
- contain a relative path to a CommonJS or native ESM file, accessible from requiring a subpath of the
829
- module. For example:
831
+ When configuring ` solid/reactivity ` , users will be able to choose which dependency-specific modules
832
+ will be included, or fall back to the default which scans either the current file's imports or the
833
+ ` package.json ` (not sure yet) to automatically load the correct modules and no others.
830
834
831
- ``` ts
832
- const packageJson = { " solid/reactivity" : " ./reactivity-plugin.js" };
833
- require .resolve (` ${packageJson .name }/${packageJson [" solid/reactivity" ]} ` );
834
- // path to reactivity plugin
835
- ```
836
-
837
- The command will not run any code in ` node_modules ` ; it will just print out an example ESLint config for
838
- the ` solid/reactivity ` rule, configured to load all plugins found. For example:
839
-
840
- ``` json
841
- "solid/reactivity" : [1 , {
842
- "plugins" : [" ./node_modules/some-module-with-plugin/solid-reactivity-plugin.cjs" ]
843
- }]
844
- ```
845
-
846
- This code can be inspected to ensure it matches expections, or edited to add additional paths to
847
- more plugins. You can manually configure a particular path as a plugin without running the CLI at
848
- all. At runtime, any plugins configured will be loaded and run alongside the base rules. Custom
849
- hooks (` use* ` /` create* ` ) from imported from these packages will not be treated permissively, others
850
- will.
851
-
852
- > ` eslint-plugin-solid ` will ** not** automatically load plugins. They must be preconfigured in an
853
- > ESLint config file.
835
+ Modules will be associated with semver versions to handle breaking changes.
854
836
855
837
### Expression Support
856
838
0 commit comments