Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/node-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
- uses: actions/checkout@v4
- uses: ./.github/workflows/rafiki/env-setup
- run: pnpm checks
- run: pnpm lint:docs

backend:
runs-on: ubuntu-latest
Expand Down
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,48 @@ The Rafiki local environment is the best way to explore Rafiki locally. The [loc
| Run individual tests (e.g. backend) | `pnpm --filter backend test` |
| Run all tests | `pnpm -r --workspace-concurrency=1 test` |
| Format and lint code | `pnpm format` |
| Format documentation | `pnpm format:docs` |
| Lint code | `pnpm lint` |
| Lint documentation | `pnpm lint:docs` |
| Check lint and formatting | `pnpm checks` |
| Verify code formatting | `pnpm check:prettier` |
| Verify lint | `pnpm check:lint` |

### Formatting and Linting

Rafiki uses [Prettier](https://prettier.io/) for code formatting and [ESLint](https://eslint.org/) with TypeScript support for linting. All code must be properly formatted and pass linting checks before committing.

#### Formatting Code

To automatically format all code in the repository:

```sh
pnpm format
```

This command will:

- Format all files using Prettier
- Automatically fix ESLint issues where possible

#### Checking Code Quality

Before committing your changes, verify that your code passes all formatting and linting checks:

```sh
pnpm checks
```

This runs both Prettier and ESLint checks without modifying files. You can also run them individually:

- Check formatting only: `pnpm check:prettier`
- Check linting only: `pnpm check:lint`

#### Editor Integration

For the best development experience, we recommend configuring your editor to:

- Format on save using Prettier
- Show ESLint errors inline

Most modern editors have extensions/plugins available for both Prettier and ESLint.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
"scripts": {
"preinstall": "npx only-allow pnpm",
"lint": "eslint --max-warnings=0 --fix .",
"lint:docs": "pnpm -C ./packages/documentation lint",
"format": "prettier --write . && pnpm lint",
"format:docs": "prettier --write ./docs/**/*.md",
"format:docs": "pnpm -C ./packages/documentation format",
"checks": "pnpm check:prettier && pnpm check:lint",
"check:lint": "eslint --max-warnings=0 .",
"check:prettier": "prettier --check .",
Expand Down
10 changes: 10 additions & 0 deletions packages/documentation/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.github
.astro
node_modules
public
build
**/*.min.css
**/*.min.js



15 changes: 15 additions & 0 deletions packages/documentation/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"semi": false,
"singleQuote": true,
"jsxSingleQuote": true,
"trailingComma": "none",
"plugins": ["prettier-plugin-astro"],
"overrides": [
{
"files": "**/*.astro",
"options": {
"parser": "astro"
}
}
]
}
12 changes: 12 additions & 0 deletions packages/documentation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@ $ pnpm build:docs

This command generates static content into the build directory and can be served using any static contents hosting service.

### Formatting and Linting

The documentation uses [Prettier](https://prettier.io/) for formatting and [ESLint](https://eslint.org/) for linting. From the root of the repository, you can run:

```sh
# Format documentation files
$ pnpm format:docs

# Lint documentation files
$ pnpm lint:docs
```

## Editing Content

Starlight looks for `.md` or `.mdx` files in the `src/content/docs/` directory. Each file is exposed as a route based on its file name. Due to the nature of how Starlight deals with content and their generated URLs, all docs content lives in `/src/content/docs/`. For example, the home page of the documentation lives within the `/src/content/docs/` folder and is rendered at rafiki.dev, not rafiki.dev/docs.
Expand Down
30 changes: 30 additions & 0 deletions packages/documentation/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import js from '@eslint/js'
import globals from 'globals'
import tseslint from 'typescript-eslint'
import { defineConfig, globalIgnores } from 'eslint/config'
import eslintConfigPrettier from 'eslint-config-prettier/flat'
import eslintPluginAstro from 'eslint-plugin-astro'

export default defineConfig([
{
files: ['**/*.{js,mjs,cjs,ts,mts,cts}'],
plugins: { js },
extends: ['js/recommended'],
languageOptions: { globals: { ...globals.browser, ...globals.node } }
},
tseslint.configs.recommended,
eslintPluginAstro.configs.recommended,
globalIgnores(['build', '.astro', 'node_modules', 'public', '**/*.min.js']),
{
rules: {
'no-console': 'error',
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_' }
],
'@typescript-eslint/no-explicit-any': 'error',
'astro/no-set-text-directive': 'error'
}
},
eslintConfigPrettier
])
Loading
Loading