Skip to content

Commit a79c37b

Browse files
committed
feat: 🏗️ add biome linter and formatter + add linter GH action
1 parent 54a9ab8 commit a79c37b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+2698
-2675
lines changed

.github/workflows/lint.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Code quality
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
quality:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v4
13+
14+
- name: Setup Node.js
15+
uses: actions/setup-node@v4
16+
with:
17+
node-version: 20
18+
cache: "npm"
19+
20+
- name: Install dependencies
21+
run: npm ci
22+
working-directory: ./crowdsec-docs/
23+
24+
- name: Setup Biome
25+
uses: biomejs/setup-biome@v2
26+
with:
27+
version: latest
28+
29+
- name: Run Biome
30+
run: biome ci .

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ Online version of this documentation is available here: https://doc.crowdsec.net
66

77
The documentation is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.
88

9+
## Pre-requisites
10+
11+
- Node.js (version 20 or later)
12+
- npm (Node package manager)
13+
- VSCode with recommended extensions installed (see `.vscode/extensions.json`)
14+
915
## Installation
1016

1117
```console
@@ -28,3 +34,12 @@ npm run build
2834

2935
This command generates static content into the `build` directory and can be served using any static contents hosting service.
3036
you can also use the `npm run serve` command to test the build locally.
37+
38+
## Linting and Formatting
39+
40+
This project uses [Biomes](https://biomejs.dev/) for linting and formatting. You can run the following commands:
41+
42+
```console
43+
npm run lint
44+
npm run format
45+
```

biome.json

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/2.0.6/schema.json",
3+
"vcs": { "enabled": false, "clientKind": "git", "useIgnoreFile": false },
4+
"files": {
5+
"ignoreUnknown": false,
6+
"includes": ["crowdsec-docs/**/*.ts", "crowdsec-docs/**/*.tsx", "!**/node_modules/**", "!crowdsec-docs/plugins/**"]
7+
},
8+
"formatter": {
9+
"enabled": true,
10+
"formatWithErrors": false,
11+
"indentStyle": "tab",
12+
"indentWidth": 4,
13+
"lineEnding": "lf",
14+
"lineWidth": 140,
15+
"attributePosition": "auto",
16+
"bracketSameLine": false,
17+
"bracketSpacing": true,
18+
"expand": "auto",
19+
"useEditorconfig": true
20+
},
21+
"linter": {
22+
"enabled": true,
23+
"rules": {
24+
"recommended": true,
25+
"style": {
26+
"useImportType": "off"
27+
}
28+
}
29+
},
30+
"javascript": {
31+
"formatter": {
32+
"jsxQuoteStyle": "double",
33+
"quoteProperties": "asNeeded",
34+
"trailingCommas": "es5",
35+
"semicolons": "asNeeded",
36+
"arrowParentheses": "always",
37+
"bracketSameLine": false,
38+
"quoteStyle": "double",
39+
"attributePosition": "auto",
40+
"bracketSpacing": true
41+
}
42+
},
43+
"html": { "formatter": { "selfCloseVoidElements": "always" } },
44+
"assist": {
45+
"enabled": true,
46+
"actions": { "source": { "organizeImports": "on" } }
47+
}
48+
}

crowdsec-docs/.prettierrc

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)