@yoo-digital/oxlint-config-base 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +78 -2
- package/oxlint.config.d.mts +5 -0
- package/oxlint.config.mjs +43 -0
- package/package.json +88 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 YOO AG
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,79 @@
|
|
|
1
|
-
#
|
|
1
|
+
# YOO Oxlint Configuration for TypeScript Projects
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@yoo-digital/oxlint-config-base)
|
|
4
|
+
|
|
5
|
+
Contains the settings and rules used for TypeScript projects within YOO.
|
|
6
|
+
It is publicly available via the npm registry.
|
|
7
|
+
|
|
8
|
+
## Purpose
|
|
9
|
+
|
|
10
|
+
The exported `oxlint.config.mjs` file contains an [Oxlint](https://oxc.rs/docs/guide/usage/linter/) config based on the rules recommended by Oxlint.
|
|
11
|
+
This configuration is compatible with our [coding guidelines](https://yooapps.jira.com/wiki/spaces/FD/pages/1239187573/Coding+Guidelines).
|
|
12
|
+
|
|
13
|
+
This set of rules is framework agnostic. It only contains rules for pure TypeScript. This allows it to be extended
|
|
14
|
+
for React and Next.js projects.
|
|
15
|
+
Extensions for these frameworks can be found in their respective packages:
|
|
16
|
+
|
|
17
|
+
- [React](https://www.npmjs.com/package/@yoo-digital/oxlint-config-react)
|
|
18
|
+
- [Next.js](https://www.npmjs.com/package/@yoo-digital/oxlint-config-nextjs)
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
In order to use the Oxlint configuration file in your project, you will have to install
|
|
23
|
+
its dependencies (including peer-dependencies). The following command should work
|
|
24
|
+
for both _npm_ and _yarn_. It will detect the proper client.
|
|
25
|
+
|
|
26
|
+
```text
|
|
27
|
+
npx install-peerdeps --dev @yoo-digital/oxlint-config-base
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
After installing the packages, you can create an [Oxlint configuration file](https://oxc.rs/docs/guide/usage/linter/config.html)
|
|
31
|
+
named `oxlint.config.mts` in the root of your project and add the following lines:
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
import yooOxlintConfigBase from '@yoo-digital/oxlint-config-base';
|
|
35
|
+
import { defineConfig } from 'oxlint';
|
|
36
|
+
|
|
37
|
+
export default defineConfig({
|
|
38
|
+
extends: [yooOxlintConfigBase],
|
|
39
|
+
// your own rules
|
|
40
|
+
});
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Then run `oxlint` (or `oxlint ./src`) to lint your project.
|
|
44
|
+
|
|
45
|
+
The configuration enables type-aware linting (`options.typeAware`), which uses `oxlint-tsgolint`.
|
|
46
|
+
|
|
47
|
+
You can apply your own set of rules on top of that, but do not turn off any of the rules, except it is an obstacle and making your life harder.
|
|
48
|
+
|
|
49
|
+
## Rules
|
|
50
|
+
|
|
51
|
+
This configuration is based on the defaults recommended by Oxlint: all rules of the `correctness` category are enabled as errors
|
|
52
|
+
for Oxlint's default plugins (`typescript`, `unicorn`, `oxc`) and the `import` plugin.
|
|
53
|
+
Type-aware rules of that category are enabled through `oxlint-tsgolint`.
|
|
54
|
+
|
|
55
|
+
On top of that, the following rules are adjusted:
|
|
56
|
+
|
|
57
|
+
| Rule | Setting |
|
|
58
|
+
| ------------------------------------------ | ------------------------------------------------------------ |
|
|
59
|
+
| `no-unused-vars` | error, names prefixed with `_` are ignored |
|
|
60
|
+
| `no-shadow` | error |
|
|
61
|
+
| `max-depth` | warn, max. 3 |
|
|
62
|
+
| `max-lines-per-function` | warn, max. 50 (blank lines and comments excluded) |
|
|
63
|
+
| `no-console` | warn |
|
|
64
|
+
| `typescript/consistent-type-imports` | error, fixed as inline type imports (`import { a, type B }`) |
|
|
65
|
+
| `typescript/explicit-function-return-type` | error |
|
|
66
|
+
| `typescript/no-empty-object-type` | warn |
|
|
67
|
+
| `typescript/no-explicit-any` | error |
|
|
68
|
+
|
|
69
|
+
In tests and stories (`**/.storybook/**`, `**/stories/**`, `**/*.stories.*`, `**/*.test.*`, `**/*.spec.*`),
|
|
70
|
+
`max-lines-per-function` and `typescript/no-explicit-any` are disabled.
|
|
71
|
+
|
|
72
|
+
## Development
|
|
73
|
+
|
|
74
|
+
**Important**: This configuration should only share the base Oxlint configuration for TypeScript projects.
|
|
75
|
+
It should not contain any rules that are specific to a framework, such as React or Next.js.
|
|
76
|
+
|
|
77
|
+
Before creating a pull request or publishing changes, make sure you tested your changes.
|
|
78
|
+
Within this mono-repository you will find example applications in the `examples` directory.
|
|
79
|
+
Run `pnpm lint` in these directories to test your changes.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
import { defineConfig } from 'oxlint';
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
plugins: ['typescript', 'unicorn', 'oxc', 'import'],
|
|
6
|
+
categories: {
|
|
7
|
+
correctness: 'error',
|
|
8
|
+
},
|
|
9
|
+
options: {
|
|
10
|
+
typeAware: true,
|
|
11
|
+
},
|
|
12
|
+
rules: {
|
|
13
|
+
// Code quality rules
|
|
14
|
+
'max-depth': ['warn', 3],
|
|
15
|
+
'max-lines-per-function': ['warn', { max: 50, skipBlankLines: true, skipComments: true }],
|
|
16
|
+
'no-console': 'warn',
|
|
17
|
+
'no-shadow': 'error',
|
|
18
|
+
'no-unused-vars': [
|
|
19
|
+
'error',
|
|
20
|
+
{
|
|
21
|
+
argsIgnorePattern: '^_',
|
|
22
|
+
caughtErrorsIgnorePattern: '^_',
|
|
23
|
+
destructuredArrayIgnorePattern: '^_',
|
|
24
|
+
varsIgnorePattern: '^_',
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
|
|
28
|
+
// TypeScript rules
|
|
29
|
+
'typescript/consistent-type-imports': ['error', { fixStyle: 'inline-type-imports' }],
|
|
30
|
+
'typescript/explicit-function-return-type': 'error',
|
|
31
|
+
'typescript/no-empty-object-type': 'warn',
|
|
32
|
+
'typescript/no-explicit-any': 'error',
|
|
33
|
+
},
|
|
34
|
+
overrides: [
|
|
35
|
+
{
|
|
36
|
+
files: ['**/.storybook/**', '**/stories/**', '**/*.stories.*', '**/*.test.*', '**/*.spec.*'],
|
|
37
|
+
rules: {
|
|
38
|
+
'max-lines-per-function': 'off',
|
|
39
|
+
'typescript/no-explicit-any': 'off',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,91 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yoo-digital/oxlint-config-base",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"description": "Oxlint configuration file containing rules for TypeScript projects",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [
|
|
10
|
+
"TypeScript",
|
|
11
|
+
"Oxlint"
|
|
12
|
+
],
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git@github.com:yoo-digital/config.git",
|
|
16
|
+
"directory": "packages/oxlint-config-base"
|
|
17
|
+
},
|
|
18
|
+
"author": {
|
|
19
|
+
"name": "YOO AG",
|
|
20
|
+
"email": "info@yoo.digital",
|
|
21
|
+
"url": "https://www.yoo.digital/"
|
|
22
|
+
},
|
|
23
|
+
"contributors": [
|
|
24
|
+
{
|
|
25
|
+
"name": "Björn Bühler",
|
|
26
|
+
"email": "bjoern.buehler@yoo.digital"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"name": "Cédric Madörin",
|
|
30
|
+
"email": "cedric.madoerin@yoo.digital"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"name": "Emanuel Marsicovetere",
|
|
34
|
+
"email": "emanuel.marsicovetere@yoo.digital"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": "Hervé Brunner",
|
|
38
|
+
"email": "herve.brunner@yoo.digital"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"name": "Kelvin Louis",
|
|
42
|
+
"email": "kelvin.louis@yoo.digital"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"name": "Robin Hahne",
|
|
46
|
+
"email": "robin.hahne@yoo.digital"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"name": "Sacha Schmid",
|
|
50
|
+
"email": "sacha.schmid@yoo.digital"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"name": "Tobias Maier",
|
|
54
|
+
"email": "tobias.maier@yoo.digital"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"name": "Tobias Wahl",
|
|
58
|
+
"email": "tobias.wahl@yoo.digital"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"name": "Yanick Recher",
|
|
62
|
+
"email": "yanick.recher@yoo.digital"
|
|
63
|
+
}
|
|
64
|
+
],
|
|
65
|
+
"exports": {
|
|
66
|
+
".": {
|
|
67
|
+
"types": "./oxlint.config.d.mts",
|
|
68
|
+
"import": "./oxlint.config.mjs"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"types": "./oxlint.config.d.mts",
|
|
72
|
+
"files": [
|
|
73
|
+
"LICENSE",
|
|
74
|
+
"README.md",
|
|
75
|
+
"oxlint.config.d.mts",
|
|
76
|
+
"oxlint.config.mjs"
|
|
77
|
+
],
|
|
78
|
+
"engines": {
|
|
79
|
+
"node": ">=24",
|
|
80
|
+
"pnpm": ">=11"
|
|
81
|
+
},
|
|
82
|
+
"devDependencies": {
|
|
83
|
+
"oxlint": "~1.91.0",
|
|
84
|
+
"oxlint-tsgolint": "~7.0.2005",
|
|
85
|
+
"typescript": "~6.0.3"
|
|
86
|
+
},
|
|
87
|
+
"peerDependencies": {
|
|
88
|
+
"oxlint": "^1.91.0",
|
|
89
|
+
"oxlint-tsgolint": "^7.0.2005"
|
|
90
|
+
}
|
|
6
91
|
}
|