Skip to content

Commit

Permalink
Add development guidelines/documentation for eslint-plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
sarayourfriend committed Jul 21, 2023
1 parent 3e5796d commit 82717e1
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
13 changes: 13 additions & 0 deletions documentation/packages/eslint_plugin/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
18 changes: 18 additions & 0 deletions documentation/packages/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
4 changes: 4 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

0 comments on commit 82717e1

Please sign in to comment.