@yoo-digital/oxlint-config-react 0.0.0-stage → 0.1.1-canary.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 +62 -2
- package/oxlint.config.d.mts +5 -0
- package/oxlint.config.mjs +14 -0
- package/package.json +90 -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,63 @@
|
|
|
1
|
-
#
|
|
1
|
+
# YOO Oxlint Configuration for React Projects
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@yoo-digital/oxlint-config-react)
|
|
4
|
+
|
|
5
|
+
Contains the settings and rules used for React projects based on TypeScript 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 extends the [YOO Base Oxlint config](https://www.npmjs.com/package/@yoo-digital/oxlint-config-base) and is aligned
|
|
12
|
+
with our [coding guidelines](https://yooapps.jira.com/wiki/spaces/FD/pages/1239187573/Coding+Guidelines).
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
In order to use the Oxlint configuration file in your project, you will have to install
|
|
17
|
+
its dependencies (including peer-dependencies). The following command should work
|
|
18
|
+
for both _npm_ and _yarn_. It will detect the proper client.
|
|
19
|
+
|
|
20
|
+
```text
|
|
21
|
+
npx install-peerdeps --dev @yoo-digital/oxlint-config-react
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
After installing the packages, you can create an [Oxlint configuration file](https://oxc.rs/docs/guide/usage/linter/config.html)
|
|
25
|
+
named `oxlint.config.mts` in the root of your project and add the following lines:
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
import yooOxlintConfigReact from '@yoo-digital/oxlint-config-react';
|
|
29
|
+
import { defineConfig } from 'oxlint';
|
|
30
|
+
|
|
31
|
+
export default defineConfig({
|
|
32
|
+
extends: [yooOxlintConfigReact],
|
|
33
|
+
// your own rules
|
|
34
|
+
});
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Then run `oxlint` (or `oxlint ./src`) to lint your project.
|
|
38
|
+
|
|
39
|
+
The configuration enables type-aware linting (`options.typeAware`), which uses `oxlint-tsgolint`.
|
|
40
|
+
|
|
41
|
+
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.
|
|
42
|
+
|
|
43
|
+
## Rules
|
|
44
|
+
|
|
45
|
+
This configuration extends the base configuration with Oxlint's native `react` and `jsx-a11y` plugins,
|
|
46
|
+
using their rules of the `correctness` category.
|
|
47
|
+
|
|
48
|
+
On top of that, the following rules are adjusted:
|
|
49
|
+
|
|
50
|
+
| Rule | Setting |
|
|
51
|
+
| ------------------------------- | -------------------------------------------------------------------------------------------- |
|
|
52
|
+
| `react/rules-of-hooks` | error |
|
|
53
|
+
| `react/jsx-key` | error, also checks that `key` is placed before spread props and that keys are not duplicated |
|
|
54
|
+
| `react/jsx-no-useless-fragment` | warn |
|
|
55
|
+
| `react/no-array-index-key` | warn |
|
|
56
|
+
|
|
57
|
+
## Development
|
|
58
|
+
|
|
59
|
+
**Important**: This configuration should only contain rules concerning React.js.
|
|
60
|
+
|
|
61
|
+
Before creating a pull request or publishing changes, make sure you tested your changes.
|
|
62
|
+
Within this mono-repository you will find an example React application in the `examples/react-app` directory and a Next.js application in the `examples/nextjs-app` directory.
|
|
63
|
+
Run `pnpm lint` in these directories to test your changes.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
import baseConfig from '@yoo-digital/oxlint-config-base';
|
|
3
|
+
import { defineConfig } from 'oxlint';
|
|
4
|
+
|
|
5
|
+
export default defineConfig({
|
|
6
|
+
extends: [baseConfig],
|
|
7
|
+
plugins: ['react', 'jsx-a11y'],
|
|
8
|
+
rules: {
|
|
9
|
+
'react/jsx-key': ['error', { checkKeyMustBeforeSpread: true, warnOnDuplicates: true }],
|
|
10
|
+
'react/jsx-no-useless-fragment': 'warn',
|
|
11
|
+
'react/no-array-index-key': 'warn',
|
|
12
|
+
'react/rules-of-hooks': 'error',
|
|
13
|
+
},
|
|
14
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,93 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yoo-digital/oxlint-config-react",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"description": "Oxlint configuration file containing rules for React projects using TypeScript",
|
|
4
|
+
"version": "0.1.1-canary.0",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [
|
|
10
|
+
"TypeScript",
|
|
11
|
+
"React",
|
|
12
|
+
"Oxlint"
|
|
13
|
+
],
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git@github.com:yoo-digital/config.git",
|
|
17
|
+
"directory": "packages/oxlint-config-react"
|
|
18
|
+
},
|
|
19
|
+
"author": {
|
|
20
|
+
"name": "YOO AG",
|
|
21
|
+
"email": "info@yoo.digital",
|
|
22
|
+
"url": "https://www.yoo.digital/"
|
|
23
|
+
},
|
|
24
|
+
"contributors": [
|
|
25
|
+
{
|
|
26
|
+
"name": "Björn Bühler",
|
|
27
|
+
"email": "bjoern.buehler@yoo.digital"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"name": "Cédric Madörin",
|
|
31
|
+
"email": "cedric.madoerin@yoo.digital"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"name": "Emanuel Marsicovetere",
|
|
35
|
+
"email": "emanuel.marsicovetere@yoo.digital"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"name": "Hervé Brunner",
|
|
39
|
+
"email": "herve.brunner@yoo.digital"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"name": "Kelvin Louis",
|
|
43
|
+
"email": "kelvin.louis@yoo.digital"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"name": "Robin Hahne",
|
|
47
|
+
"email": "robin.hahne@yoo.digital"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"name": "Sacha Schmid",
|
|
51
|
+
"email": "sacha.schmid@yoo.digital"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"name": "Tobias Maier",
|
|
55
|
+
"email": "tobias.maier@yoo.digital"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"name": "Tobias Wahl",
|
|
59
|
+
"email": "tobias.wahl@yoo.digital"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"name": "Yanick Recher",
|
|
63
|
+
"email": "yanick.recher@yoo.digital"
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
"exports": {
|
|
67
|
+
".": {
|
|
68
|
+
"types": "./oxlint.config.d.mts",
|
|
69
|
+
"import": "./oxlint.config.mjs"
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"types": "./oxlint.config.d.mts",
|
|
73
|
+
"files": [
|
|
74
|
+
"LICENSE",
|
|
75
|
+
"README.md",
|
|
76
|
+
"oxlint.config.d.mts",
|
|
77
|
+
"oxlint.config.mjs"
|
|
78
|
+
],
|
|
79
|
+
"engines": {
|
|
80
|
+
"node": ">=24",
|
|
81
|
+
"pnpm": ">=11"
|
|
82
|
+
},
|
|
83
|
+
"dependencies": {
|
|
84
|
+
"@yoo-digital/oxlint-config-base": "~0.1.1-canary.0"
|
|
85
|
+
},
|
|
86
|
+
"devDependencies": {
|
|
87
|
+
"oxlint": "~1.91.0",
|
|
88
|
+
"typescript": "~6.0.3"
|
|
89
|
+
},
|
|
90
|
+
"peerDependencies": {
|
|
91
|
+
"oxlint": "^1.91.0"
|
|
92
|
+
}
|
|
6
93
|
}
|