Skip to content

Commit

Permalink
feat(eslint-config-airlight-base): add biome config
Browse files Browse the repository at this point in the history
  • Loading branch information
dalisoft committed Jul 7, 2024
1 parent 2c34a14 commit 0d072b8
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 6 deletions.
2 changes: 1 addition & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default [
},
rules: {
'@typescript-eslint/no-var-requires': 'off',
complexity: ['error', { max: 4 }],
complexity: ['error', { max: 7 }],
'max-lines-per-function': [
'error',

Expand Down
17 changes: 16 additions & 1 deletion packages/eslint-config-base/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
ESLint configure for base focused on code quality, security and performance on top of
[eslint-config-airbnb-typescript/base](https://github.com/iamturns/eslint-config-airbnb-typescript).

Now compatible with `oxlint` configuration
Now compatible with `oxlint` and `biome` configuration

## Installation

Expand Down Expand Up @@ -63,6 +63,21 @@ export default [
oxlint -c ./node_modules/eslint-config-airlight-base/oxlintrc.json
```

### biome

> If you are using **eslint + biome** combo, see [here and follow guide](https://github.com/SrBrahma/eslint-config-biome)
```json title="biome.json"
{
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
"extends": ["eslint-config-airlight-base/biome.json"]
}
```

```bash
biome check . --write
```

## Rules

We customized following rules.
Expand Down
7 changes: 7 additions & 0 deletions packages/eslint-config-base/biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
"linter": {
"enabled": true,
"rules": {}
}
}
1 change: 1 addition & 0 deletions packages/eslint-config-base/eslint.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('./flat.cjs');
1 change: 0 additions & 1 deletion packages/eslint-config-base/flat.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ module.exports = tseslint.config(
...globals.es2020
}
},
// @ts-expect-error It should be shared for consistenty
rules: {
...airbnbRules,
...rules
Expand Down
6 changes: 4 additions & 2 deletions packages/eslint-config-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"./flat": "./flat.cjs",
"./legacy": "./legacy.cjs",
"./oxlintrc.json": "./oxlintrc.json",
"./biome.json": "./biome.json",
"./settings.cjs": "./settings.cjs",
"./overrides/*": "./overrides/*"
},
Expand All @@ -21,10 +22,11 @@
"flat.cjs",
"legacy.cjs",
"settings.cjs",
"oxlintrc.json"
"oxlintrc.json",
"biome.json"
],
"scripts": {
"prepublishOnly": "node scripts/*.cjs"
"prepublishOnly": "node scripts/*.cjs && biome migrate eslint --write --include-inspired --include-nursery"
},
"engines": {
"node": ">=18.20.3"
Expand Down
4 changes: 3 additions & 1 deletion packages/eslint-config-base/rules.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-expect-error Cannot find namespace 'SharedConfig'
/** @type {Partial<Record<string, SharedConfig.RuleEntry>>} */
module.exports = {
'@eslint-community/eslint-comments/no-unused-disable': 'error',
'@typescript-eslint/naming-convention': [
Expand Down Expand Up @@ -68,7 +70,7 @@ module.exports = {
offsetTernaryExpressions: true
}
],
complexity: ['error', { max: 5 }],
complexity: ['error', { max: 7 }],
'max-depth': ['error', { max: 3 }],
'max-nested-callbacks': ['error', { max: 3 }],
'max-lines-per-function': [
Expand Down

0 comments on commit 0d072b8

Please sign in to comment.