@korioinc/next-configs 2.0.44 → 2.0.45
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.md +77 -43
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
# @korioinc/next-configs
|
|
2
2
|
|
|
3
|
-
Shared
|
|
3
|
+
Shared ESLint, Prettier, and TypeScript presets for Korio Next.js packages and
|
|
4
|
+
apps.
|
|
5
|
+
|
|
6
|
+
The package ships plain config files through package exports. There is no build
|
|
7
|
+
step for consumers.
|
|
4
8
|
|
|
5
9
|
## Installation
|
|
6
10
|
|
|
@@ -8,47 +12,82 @@ Shared configuration presets for ESLint, Prettier, and TypeScript in Next.js pro
|
|
|
8
12
|
pnpm add -D @korioinc/next-configs
|
|
9
13
|
```
|
|
10
14
|
|
|
11
|
-
|
|
15
|
+
Install the peer tools used by the presets you consume. See the package's
|
|
16
|
+
`peerDependencies` for the exact supported ranges.
|
|
17
|
+
|
|
18
|
+
## Public entrypoints
|
|
19
|
+
|
|
20
|
+
| Entrypoint | File | Purpose |
|
|
21
|
+
| --------------------------------------------- | -------------------------- | ---------------------------------- |
|
|
22
|
+
| `@korioinc/next-configs/eslint` | `eslint/next.mjs` | Default Next.js ESLint flat config |
|
|
23
|
+
| `@korioinc/next-configs/eslint/base` | `eslint/base.mjs` | Base TypeScript/JavaScript config |
|
|
24
|
+
| `@korioinc/next-configs/eslint/next` | `eslint/next.mjs` | Next.js app config |
|
|
25
|
+
| `@korioinc/next-configs/eslint/library` | `eslint/library.mjs` | Non-React library config |
|
|
26
|
+
| `@korioinc/next-configs/eslint/react-library` | `eslint/react-library.mjs` | React library config |
|
|
27
|
+
| `@korioinc/next-configs/prettier` | `prettier/index.mjs` | Prettier config |
|
|
28
|
+
| `@korioinc/next-configs/tsconfig/*` | `tsconfig/*.json` | TypeScript config presets |
|
|
29
|
+
|
|
30
|
+
## ESLint
|
|
12
31
|
|
|
13
|
-
|
|
14
|
-
- **Prettier Config**: Consistent code formatting with Tailwind CSS support
|
|
15
|
-
- **TypeScript Configs**: Optimized tsconfig presets for different project types
|
|
32
|
+
Create `eslint.config.mjs`:
|
|
16
33
|
|
|
17
|
-
|
|
34
|
+
```javascript
|
|
35
|
+
import config from '@korioinc/next-configs/eslint';
|
|
18
36
|
|
|
19
|
-
|
|
37
|
+
export default [...config];
|
|
38
|
+
```
|
|
20
39
|
|
|
21
|
-
|
|
40
|
+
Choose a more specific preset when needed:
|
|
22
41
|
|
|
23
42
|
```javascript
|
|
24
|
-
import
|
|
43
|
+
import config from '@korioinc/next-configs/eslint/react-library';
|
|
25
44
|
|
|
26
|
-
export default
|
|
45
|
+
export default [...config];
|
|
27
46
|
```
|
|
28
47
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
- `@
|
|
48
|
+
### ESLint presets
|
|
49
|
+
|
|
50
|
+
| Preset | Use for | Includes |
|
|
51
|
+
| ---------------------- | ----------------------------------- | ------------------------------------------------------------------------------------------------- |
|
|
52
|
+
| `eslint/base` | Shared non-Next baseline | `@eslint/js`, `typescript-eslint`, `eslint-config-prettier`, Turbo env var rule |
|
|
53
|
+
| `eslint/next` | Next.js apps | Next core web vitals, Next TypeScript rules, import/promise/prettier/unused-imports, Valtio rules |
|
|
54
|
+
| `eslint/library` | Node or shared TypeScript libraries | Base rules plus import, promise, prettier, and Valtio rules |
|
|
55
|
+
| `eslint/react-library` | React component libraries | Library rules plus React and React Hooks rules |
|
|
56
|
+
|
|
57
|
+
The current ESLint configs are flat config arrays for ESLint `>=10`. Several
|
|
58
|
+
presets import plugins directly, including `eslint-plugin-import`,
|
|
59
|
+
`eslint-plugin-promise`, `eslint-plugin-prettier`, `eslint-plugin-turbo`,
|
|
60
|
+
`eslint-plugin-unused-imports`, `eslint-plugin-valtio`, and the React plugins
|
|
61
|
+
for React presets.
|
|
34
62
|
|
|
35
|
-
|
|
63
|
+
## Prettier
|
|
36
64
|
|
|
37
|
-
Create
|
|
65
|
+
Create `prettier.config.mjs`:
|
|
38
66
|
|
|
39
67
|
```javascript
|
|
40
|
-
import
|
|
68
|
+
import config from '@korioinc/next-configs/prettier';
|
|
41
69
|
|
|
42
|
-
export default
|
|
70
|
+
export default config;
|
|
43
71
|
```
|
|
44
72
|
|
|
45
|
-
|
|
46
|
-
- Import sorting with `@trivago/prettier-plugin-sort-imports`
|
|
47
|
-
- Tailwind CSS class sorting with `prettier-plugin-tailwindcss`
|
|
73
|
+
The shared config uses:
|
|
48
74
|
|
|
49
|
-
|
|
75
|
+
- single quotes
|
|
76
|
+
- semicolons
|
|
77
|
+
- `printWidth: 120`
|
|
78
|
+
- trailing commas
|
|
79
|
+
- `@trivago/prettier-plugin-sort-imports`
|
|
80
|
+
- `prettier-plugin-tailwindcss`
|
|
50
81
|
|
|
51
|
-
|
|
82
|
+
The default import order is:
|
|
83
|
+
|
|
84
|
+
```javascript
|
|
85
|
+
['^react$', '^next(/.*)?$', 'next-themes', '@/*', '<THIRD_PARTY_MODULES>'];
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## TypeScript
|
|
89
|
+
|
|
90
|
+
Extend a preset from `tsconfig.json`:
|
|
52
91
|
|
|
53
92
|
```json
|
|
54
93
|
{
|
|
@@ -56,30 +95,25 @@ Extend from our presets in your `tsconfig.json`:
|
|
|
56
95
|
}
|
|
57
96
|
```
|
|
58
97
|
|
|
59
|
-
Available presets:
|
|
60
|
-
- `/tsconfig/base.json` - Base TypeScript configuration
|
|
61
|
-
- `/tsconfig/nextjs.json` - Next.js applications
|
|
62
|
-
- `/tsconfig/library.json` - Node.js libraries
|
|
63
|
-
- `/tsconfig/react-library.json` - React component libraries
|
|
98
|
+
Available TypeScript presets:
|
|
64
99
|
|
|
65
|
-
|
|
100
|
+
| Preset | Use for | Notes |
|
|
101
|
+
| ------------------------ | ---------------------- | ------------------------------------------------------------------------------------------------- |
|
|
102
|
+
| `tsconfig/base` | Shared strict baseline | `NodeNext`, declarations enabled, strict mode, ES2022 target |
|
|
103
|
+
| `tsconfig/nextjs` | Next.js apps | Extends base, uses `moduleResolution: "Bundler"`, `jsx: "react-jsx"`, `noEmit: true`, Next plugin |
|
|
104
|
+
| `tsconfig/react-library` | React libraries | Extends base, uses bundler resolution and React JSX |
|
|
66
105
|
|
|
67
|
-
|
|
106
|
+
There is no `tsconfig/library.json` preset in the current package.
|
|
68
107
|
|
|
69
|
-
|
|
70
|
-
- `typescript` >=5.9.0
|
|
71
|
-
- `prettier` >=3.0.0
|
|
108
|
+
## Key peer requirements
|
|
72
109
|
|
|
73
|
-
|
|
74
|
-
-
|
|
75
|
-
-
|
|
76
|
-
-
|
|
77
|
-
- `
|
|
110
|
+
- ESLint `>=10.0.0`
|
|
111
|
+
- TypeScript `>=5.9.0`
|
|
112
|
+
- Prettier `>=3.0.0`
|
|
113
|
+
- Next.js ESLint tooling `>=16.2.6` for the Next preset
|
|
114
|
+
- React ESLint plugins for `eslint/react-library`
|
|
115
|
+
- Prettier import sorting and Tailwind plugins for the Prettier preset
|
|
78
116
|
|
|
79
117
|
## License
|
|
80
118
|
|
|
81
119
|
MIT
|
|
82
|
-
|
|
83
|
-
## Contributing
|
|
84
|
-
|
|
85
|
-
Contributions are welcome! Please feel free to submit a Pull Request.
|