Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Add development guidelines/documentation for eslint-plugin (#2691)

sarayourfriend2a4a354ae92e
diff --git a/documentation/packages/eslint_plugin/index.md b/documentation/packages/eslint_plugin/index.md
index 40a0ed870..76a8c41d1 100644
--- a/documentation/packages/eslint_plugin/index.md
+++ b/documentation/packages/eslint_plugin/index.md
@@ -9,3 +9,16 @@ Please consult each rule's page for documentation regarding the rule.
*
```
+
+## Development
+
+All ESLint plugin rules and configuration must be written in TypeScript.
+
+All rules must have unit tests added using `ESLintUtils.RuleTester` from the
+`@typescript-eslint/utils` package. Use the `@typescript-eslint/parser` as the
+`parser` option.
+
+All rules are required to have a documentation page in this documentation
+section. Rule documentation should follow the typical ESLint rule documentation,
+including samples of valid and invalid code with options clearly documented. See
+existing rule documentation for examples.
diff --git a/documentation/packages/index.md b/documentation/packages/index.md
index 8c8bc4431..c60ba5771 100644
--- a/documentation/packages/index.md
+++ b/documentation/packages/index.md
@@ -15,6 +15,21 @@ and how to add/maintain them.
Openverse does not currently have any method for publishing packages to NPM.
```
+## Running package scripts
+
+Run scripts for individual packages using `just p {package} {script}`. For
+example, to run tests for the `eslint-plugin`, run:
+
+```
+just p eslint-plugin test:unit
+```
+
+This also works for the Nuxt frontend as an alternative to `just frontend/run`:
+
+```
+just p frontend dev
+```
+
## Adding new packages
The easiest way to create a new package is to copy an existing one and modify
@@ -60,3 +75,6 @@ This can be facilitated using `npm-run-all`'s `run-p`. e.g.:
}
```
````
+
+All new packages should name their unit-test script `test:unit`. Our CI
+recursively runs `test:unit` for all pnpm workspaces to ensure tests pass.
diff --git a/justfile b/justfile
index c383721a1..dc1e16329 100644
--- a/justfile
+++ b/justfile
@@ -255,3 +255,7 @@ i:
# alias for `just frontend/run dev`
f:
just frontend/run dev
+
+# alias for `pnpm --filter {package} run {script}`
+p package script +args="":
+ pnpm --filter {{ package }} run {{ script }} {{ args }}