Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add a plugin system #402

Open
wants to merge 104 commits into
base: main
Choose a base branch
from
Open

feat: add a plugin system #402

wants to merge 104 commits into from

Conversation

boneskull
Copy link
Owner

@boneskull boneskull commented Oct 10, 2023

This adds a plugin system so we can separate things like rules (and eventually package manager implementations from the main codebase), and others can write custom plugins providing the same.

All rules have moved into the @midnight-smoker/plugin-default-rules package.

Limitations

Plugins currently cannot interact with each other nor declare dependencies on other plugins. Eventually I imagine someone might want to, say, override a rule.

Plugins cannot yet add package managers.

TODO

  • List of plugins to load must be user-specified. Probably unwise to attempt automatic discovery (or make it opt-in). This will necessarily invoke multiple passes through options validation.
  • Rules created by 3rd party plugins must be scoped to the plugin name.
  • Need to assert the plugin name matches the package name.
  • Docs
    • Plugin guide
    • Usage guide
    • Getting started guide
    • Rules reference
    • CLI reference
    • Config reference
  • Anything else in the milestone

Future

  • Custom script execution should be moved into a plugin, which means
  • Plugins should be allowed to define command-line options
  • And need to expose better hooks. Currently, Smoker is a vanilla EventEmitter, which is problematic if listeners are async.

@boneskull
Copy link
Owner Author

boneskull commented Oct 10, 2023

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @boneskull and the rest of your teammates on Graphite Graphite

Base automatically changed from monorepo to main October 10, 2023 02:08
@boneskull boneskull force-pushed the plugin-support branch 2 times, most recently from 181aead to d55ad27 Compare October 11, 2023 00:08
@boneskull boneskull self-assigned this Oct 11, 2023
@boneskull boneskull force-pushed the plugin-support branch 2 times, most recently from a5ad1ef to 1758954 Compare October 11, 2023 07:00
@boneskull boneskull marked this pull request as ready for review October 11, 2023 07:12
@boneskull boneskull changed the base branch from main to docsify October 11, 2023 21:40
@boneskull boneskull added the enhancement New feature or request label Oct 11, 2023
Base automatically changed from docsify to main October 11, 2023 21:58
@boneskull boneskull force-pushed the plugin-support branch 11 times, most recently from 4bd3120 to b9a5fd8 Compare October 13, 2023 04:27
- the onus of getting a version from a dist-tag or range is now the responsibility of the package manager
- remove `safePath`
- remove `Errors` from `PluginAPI`
- fix many tests
- ignore shebangs in adhoc scripts
- re-enable `n/no-path-concat`
- rename a dir
- extract "common" errors into their own files
- add unit tests for `guessPackageManager()`
also remove a duplicate schema/type
Copy link

socket-security bot commented Mar 14, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@stylistic/eslint-plugin@1.5.4 Transitive: environment, eval, filesystem, shell, unsafe +96 13.7 MB antfu
npm/@swc/core@1.3.107 environment, filesystem, shell +12 401 MB kdy1
npm/@tsconfig/node18@18.2.2 None 0 2.5 kB typescript-deploys
npm/@types/html-escaper@3.0.2 None 0 2.77 kB types
npm/@types/json-stable-stringify@1.0.35 None 0 4.67 kB types
npm/@types/lodash@4.14.202 None 0 862 kB types
npm/@types/node@20.11.27 None 0 2.01 MB types
npm/@types/stringify-object@3.3.1 None 0 5.88 kB types
npm/@types/wallabyjs@0.0.15 Transitive: environment +20 6.68 MB types
npm/@types/yargs@17.0.32 None +1 68.8 kB types
npm/async-mitt@0.0.0 None 0 48.6 kB itoxiq
npm/cli-table3@0.6.3 Transitive: environment +1 91.3 kB speedytwenty
npm/eslint-plugin-jsonc@2.13.0 environment, filesystem Transitive: eval, shell, unsafe +75 10.3 MB ota-meshi
npm/html-escaper@3.0.3 None 0 15.6 kB webreflection
npm/json-stable-stringify@1.0.2 None +1 43.1 kB ljharb
npm/memfs@4.6.0 None +3 7.97 MB streamich
npm/mitt@3.0.1 None 0 26.4 kB developit
npm/prettier-plugin-astro@0.12.3 environment Transitive: filesystem, unsafe +2 13.6 MB fredkschott
npm/rehype-autolink-headings@7.1.0 None +5 108 kB wooorm
npm/rehype@13.0.1 None +28 1.94 MB wooorm
npm/remark-code-import@1.2.0 None +5 96.9 kB kevin940726
npm/typescript@5.4.2 None 0 32.4 MB typescript-bot

🚮 Removed packages: npm/@types/node@20.10.5, npm/@types/yargs@17.0.25, npm/corepack@0.21.0, npm/eslint-config-prettier@8.10.0, npm/eslint-config-semistandard@17.0.0, npm/eslint-config-standard@17.1.0, npm/eslint-plugin-import@2.29.1, npm/eslint-plugin-promise@6.1.1, npm/rewiremock@3.14.5, npm/semver@7.5.4, npm/shx@0.3.4, npm/sinon@16.1.3, npm/snap-shot-it@7.9.10, npm/source-map-support@0.5.21, npm/strict-event-emitter-types@2.0.0, npm/strip-ansi@5.2.0, npm/ts-node@10.9.2, npm/typedoc-plugin-zod@1.1.0, npm/typedoc@0.25.4, npm/typescript@5.2.2, npm/unexpected-eventemitter@2.4.0, npm/unexpected-sinon@11.1.0, npm/unexpected@13.2.1, npm/which@4.0.0, npm/yargs@17.7.2, npm/zod-to-json-schema@3.22.2, npm/zod-validation-error@2.1.0, npm/zod@3.22.4

View full report↗︎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant