@cocopalm/oxc-linter-config 0.1.0 → 0.2.1

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/README.ko.md CHANGED
@@ -26,11 +26,11 @@ touch oxlint.config.ts
26
26
  // oxlint.config.ts
27
27
 
28
28
  import { defineConfig } from 'oxlint'
29
- import commonConfig from '@cocopalm/oxc-linter-config/common'
29
+ import baseConfig from '@cocopalm/oxc-linter-config/base'
30
30
  import reactConfig from '@cocopalm/oxc-linter-config/react'
31
31
 
32
32
  export default defineConfig({
33
- extends: [commonConfig, reactConfig],
33
+ extends: [baseConfig, reactConfig],
34
34
  })
35
35
  ```
36
36
 
@@ -66,11 +66,11 @@ export default defineConfig({
66
66
  // oxlint.config.ts
67
67
 
68
68
  import { defineConfig } from 'oxlint'
69
- import commonConfig from '@cocopalm/oxc-linter-config/common'
69
+ import baseConfig from '@cocopalm/oxc-linter-config/base'
70
70
  import reactConfig from '@cocopalm/oxc-linter-config/react'
71
71
 
72
72
  export default defineConfig({
73
- extends: [commonConfig, reactConfig],
73
+ extends: [baseConfig, reactConfig],
74
74
  overrides: [
75
75
  {
76
76
  files: ['**/*.{ts,tsx}'],
@@ -88,10 +88,10 @@ export default defineConfig({
88
88
 
89
89
  ```ts
90
90
  import { defineConfig } from 'oxlint'
91
- import commonConfig from '@cocopalm/oxc-linter-config/common'
91
+ import baseConfig from '@cocopalm/oxc-linter-config/base'
92
92
 
93
93
  export default defineConfig({
94
- extends: [commonConfig],
94
+ extends: [baseConfig],
95
95
  })
96
96
  ```
97
97
 
@@ -99,23 +99,42 @@ export default defineConfig({
99
99
 
100
100
  ```ts
101
101
  import { defineConfig } from 'oxlint'
102
- import commonConfig from '@cocopalm/oxc-linter-config/common'
102
+ import baseConfig from '@cocopalm/oxc-linter-config/base'
103
103
  import reactConfig from '@cocopalm/oxc-linter-config/react'
104
104
 
105
105
  export default defineConfig({
106
- extends: [commonConfig, reactConfig],
106
+ extends: [baseConfig, reactConfig],
107
107
  })
108
108
  ```
109
109
 
110
- 3. **Node.js 프로젝트**
110
+ 3. **React Compiler를 사용하는 React 프로젝트**
111
+
112
+ > **참고:** `/react-compiler` 설정을 사용하려면 `eslint-plugin-react-hooks` 패키지가 필요합니다:
113
+ >
114
+ > ```bash
115
+ > pnpm add -D eslint-plugin-react-hooks
116
+ > ```
111
117
 
112
118
  ```ts
113
119
  import { defineConfig } from 'oxlint'
114
- import commonConfig from '@cocopalm/oxc-linter-config/common'
120
+ import baseConfig from '@cocopalm/oxc-linter-config/base'
121
+ import reactConfig from '@cocopalm/oxc-linter-config/react'
122
+ import reactCompilerConfig from '@cocopalm/oxc-linter-config/react-compiler'
123
+
124
+ export default defineConfig({
125
+ extends: [baseConfig, reactConfig, reactCompilerConfig],
126
+ })
127
+ ```
128
+
129
+ 4. **Node.js 프로젝트**
130
+
131
+ ```ts
132
+ import { defineConfig } from 'oxlint'
133
+ import baseConfig from '@cocopalm/oxc-linter-config/base'
115
134
  import nodeConfig from '@cocopalm/oxc-linter-config/node'
116
135
 
117
136
  export default defineConfig({
118
- extends: [commonConfig, nodeConfig],
137
+ extends: [baseConfig, nodeConfig],
119
138
  })
120
139
  ```
121
140
 
@@ -145,6 +164,3 @@ export default defineConfig({
145
164
  - [eslint-core](./docs/eslint-core.md)
146
165
  - [eslint-react](./docs/eslint-react.md)
147
166
 
148
- 2. `react compiler` 관련 규칙들은 아직 oxc linter react plugin에서 지원하지 않기 때문에 적용되어있지 않습니다.
149
-
150
- - [eslint-plugin-react-hooks](https://www.npmjs.com/package/eslint-plugin-react-hooks)
package/README.md CHANGED
@@ -26,11 +26,11 @@ Import the configs and combine them using `defineConfig`.
26
26
  // oxlint.config.ts
27
27
 
28
28
  import { defineConfig } from 'oxlint'
29
- import commonConfig from '@cocopalm/oxc-linter-config/common'
29
+ import baseConfig from '@cocopalm/oxc-linter-config/base'
30
30
  import reactConfig from '@cocopalm/oxc-linter-config/react'
31
31
 
32
32
  export default defineConfig({
33
- extends: [commonConfig, reactConfig],
33
+ extends: [baseConfig, reactConfig],
34
34
  })
35
35
  ```
36
36
 
@@ -66,11 +66,11 @@ Add lint scripts to your `package.json`.
66
66
  // oxlint.config.ts
67
67
 
68
68
  import { defineConfig } from 'oxlint'
69
- import commonConfig from '@cocopalm/oxc-linter-config/common'
69
+ import baseConfig from '@cocopalm/oxc-linter-config/base'
70
70
  import reactConfig from '@cocopalm/oxc-linter-config/react'
71
71
 
72
72
  export default defineConfig({
73
- extends: [commonConfig, reactConfig],
73
+ extends: [baseConfig, reactConfig],
74
74
  overrides: [
75
75
  {
76
76
  files: ['**/*.{ts,tsx}'],
@@ -88,10 +88,10 @@ export default defineConfig({
88
88
 
89
89
  ```ts
90
90
  import { defineConfig } from 'oxlint'
91
- import commonConfig from '@cocopalm/oxc-linter-config/common'
91
+ import baseConfig from '@cocopalm/oxc-linter-config/base'
92
92
 
93
93
  export default defineConfig({
94
- extends: [commonConfig],
94
+ extends: [baseConfig],
95
95
  })
96
96
  ```
97
97
 
@@ -99,23 +99,42 @@ export default defineConfig({
99
99
 
100
100
  ```ts
101
101
  import { defineConfig } from 'oxlint'
102
- import commonConfig from '@cocopalm/oxc-linter-config/common'
102
+ import baseConfig from '@cocopalm/oxc-linter-config/base'
103
103
  import reactConfig from '@cocopalm/oxc-linter-config/react'
104
104
 
105
105
  export default defineConfig({
106
- extends: [commonConfig, reactConfig],
106
+ extends: [baseConfig, reactConfig],
107
107
  })
108
108
  ```
109
109
 
110
- 3. **Node.js projects**
110
+ 3. **React projects with React Compiler**
111
+
112
+ > **Note:** Using the `/react-compiler` config requires `eslint-plugin-react-hooks` to be installed:
113
+ >
114
+ > ```bash
115
+ > pnpm add -D eslint-plugin-react-hooks
116
+ > ```
111
117
 
112
118
  ```ts
113
119
  import { defineConfig } from 'oxlint'
114
- import commonConfig from '@cocopalm/oxc-linter-config/common'
120
+ import baseConfig from '@cocopalm/oxc-linter-config/base'
121
+ import reactConfig from '@cocopalm/oxc-linter-config/react'
122
+ import reactCompilerConfig from '@cocopalm/oxc-linter-config/react-compiler'
123
+
124
+ export default defineConfig({
125
+ extends: [baseConfig, reactConfig, reactCompilerConfig],
126
+ })
127
+ ```
128
+
129
+ 4. **Node.js projects**
130
+
131
+ ```ts
132
+ import { defineConfig } from 'oxlint'
133
+ import baseConfig from '@cocopalm/oxc-linter-config/base'
115
134
  import nodeConfig from '@cocopalm/oxc-linter-config/node'
116
135
 
117
136
  export default defineConfig({
118
- extends: [commonConfig, nodeConfig],
137
+ extends: [baseConfig, nodeConfig],
119
138
  })
120
139
  ```
121
140
 
@@ -145,6 +164,3 @@ To check the progress, please refer to the following issue.
145
164
  - [eslint-core](./docs/eslint-core.md)
146
165
  - [eslint-react](./docs/eslint-react.md)
147
166
 
148
- 2. `react compiler` related rules are not applied because the oxc linter react plugin does not yet support them.
149
-
150
- - [eslint-plugin-react-hooks](https://www.npmjs.com/package/eslint-plugin-react-hooks)
@@ -1,4 +1,4 @@
1
- //#region src/common.d.ts
1
+ //#region src/base.d.ts
2
2
  declare const _default: {
3
3
  plugins: ("eslint" | "promise")[];
4
4
  rules: {
@@ -1,6 +1,6 @@
1
1
  import { defineConfig } from "oxlint";
2
- //#region src/common.ts
3
- var common_default = defineConfig({
2
+ //#region src/base.ts
3
+ var base_default = defineConfig({
4
4
  plugins: ["eslint", "promise"],
5
5
  rules: {
6
6
  "eslint/no-unused-vars": ["error", {
@@ -84,4 +84,4 @@ var common_default = defineConfig({
84
84
  ]
85
85
  });
86
86
  //#endregion
87
- export { common_default as default };
87
+ export { base_default as default };
@@ -0,0 +1,23 @@
1
+ //#region src/react-compiler.d.ts
2
+ declare const _default: {
3
+ jsPlugins: string[];
4
+ rules: {
5
+ 'react-hooks/config': "error";
6
+ 'react-hooks/error-boundaries': "error";
7
+ 'react-hooks/component-hook-factories': "error";
8
+ 'react-hooks/gating': "error";
9
+ 'react-hooks/globals': "error";
10
+ 'react-hooks/immutability': "error";
11
+ 'react-hooks/preserve-manual-memoization': "error";
12
+ 'react-hooks/purity': "error";
13
+ 'react-hooks/refs': "error";
14
+ 'react-hooks/set-state-in-effect': "error";
15
+ 'react-hooks/set-state-in-render': "error";
16
+ 'react-hooks/static-components': "error";
17
+ 'react-hooks/unsupported-syntax': "warn";
18
+ 'react-hooks/use-memo': "error";
19
+ 'react-hooks/incompatible-library': "warn";
20
+ };
21
+ };
22
+ //#endregion
23
+ export { _default as default };
@@ -0,0 +1,24 @@
1
+ import { defineConfig } from "oxlint";
2
+ //#region src/react-compiler.ts
3
+ var react_compiler_default = defineConfig({
4
+ jsPlugins: ["eslint-plugin-react-hooks"],
5
+ rules: {
6
+ "react-hooks/config": "error",
7
+ "react-hooks/error-boundaries": "error",
8
+ "react-hooks/component-hook-factories": "error",
9
+ "react-hooks/gating": "error",
10
+ "react-hooks/globals": "error",
11
+ "react-hooks/immutability": "error",
12
+ "react-hooks/preserve-manual-memoization": "error",
13
+ "react-hooks/purity": "error",
14
+ "react-hooks/refs": "error",
15
+ "react-hooks/set-state-in-effect": "error",
16
+ "react-hooks/set-state-in-render": "error",
17
+ "react-hooks/static-components": "error",
18
+ "react-hooks/unsupported-syntax": "warn",
19
+ "react-hooks/use-memo": "error",
20
+ "react-hooks/incompatible-library": "warn"
21
+ }
22
+ });
23
+ //#endregion
24
+ export { react_compiler_default as default };
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@cocopalm/oxc-linter-config",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
4
  "description": "oxc linter configuration",
5
5
  "author": "puffcocos",
6
6
  "license": "MIT",
7
7
  "type": "module",
8
- "main": "./dist/common.mjs",
8
+ "main": "./dist/base.mjs",
9
9
  "exports": {
10
- "./common": {
11
- "import": "./dist/common.mjs",
12
- "types": "./dist/common.d.mts"
10
+ "./base": {
11
+ "import": "./dist/base.mjs",
12
+ "types": "./dist/base.d.mts"
13
13
  },
14
14
  "./react": {
15
15
  "import": "./dist/react.mjs",
@@ -18,6 +18,10 @@
18
18
  "./node": {
19
19
  "import": "./dist/node.mjs",
20
20
  "types": "./dist/node.d.mts"
21
+ },
22
+ "./react-compiler": {
23
+ "import": "./dist/react-compiler.mjs",
24
+ "types": "./dist/react-compiler.d.mts"
21
25
  }
22
26
  },
23
27
  "files": [
@@ -42,7 +46,13 @@
42
46
  "typescript": "^6.0.2"
43
47
  },
44
48
  "peerDependencies": {
45
- "oxlint": "^1.57.0"
49
+ "oxlint": "^1.57.0",
50
+ "eslint-plugin-react-hooks": "^6.0.0"
51
+ },
52
+ "peerDependenciesMeta": {
53
+ "eslint-plugin-react-hooks": {
54
+ "optional": true
55
+ }
46
56
  },
47
57
  "scripts": {
48
58
  "build": "tsdown"