@korioinc/next-configs 1.0.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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Korio Inc.
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 ADDED
@@ -0,0 +1,85 @@
1
+ # @korioinc/next-configs
2
+
3
+ Shared configuration presets for ESLint, Prettier, and TypeScript in Next.js projects.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pnpm add -D @korioinc/next-configs
9
+ ```
10
+
11
+ ## Features
12
+
13
+ - **ESLint Configs**: Pre-configured ESLint rules for Next.js, libraries, and React libraries
14
+ - **Prettier Config**: Consistent code formatting with Tailwind CSS support
15
+ - **TypeScript Configs**: Optimized tsconfig presets for different project types
16
+
17
+ ## Usage
18
+
19
+ ### ESLint Configuration
20
+
21
+ Create an `eslint.config.mjs` file:
22
+
23
+ ```javascript
24
+ import nextConfig from '@korioinc/next-configs/eslint/next';
25
+
26
+ export default nextConfig;
27
+ ```
28
+
29
+ Available presets:
30
+ - `@korioinc/next-configs/eslint/base` - Base configuration
31
+ - `@korioinc/next-configs/eslint/next` - Next.js applications
32
+ - `@korioinc/next-configs/eslint/library` - Node.js libraries
33
+ - `@korioinc/next-configs/eslint/react-library` - React component libraries
34
+
35
+ ### Prettier Configuration
36
+
37
+ Create a `prettier.config.mjs` file:
38
+
39
+ ```javascript
40
+ import prettierConfig from '@korioinc/next-configs/prettier';
41
+
42
+ export default prettierConfig;
43
+ ```
44
+
45
+ Features included:
46
+ - Import sorting with `@trivago/prettier-plugin-sort-imports`
47
+ - Tailwind CSS class sorting with `prettier-plugin-tailwindcss`
48
+
49
+ ### TypeScript Configuration
50
+
51
+ Extend from our presets in your `tsconfig.json`:
52
+
53
+ ```json
54
+ {
55
+ "extends": "@korioinc/next-configs/tsconfig/nextjs"
56
+ }
57
+ ```
58
+
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
64
+
65
+ ## Peer Dependencies
66
+
67
+ This package requires the following peer dependencies:
68
+
69
+ - `eslint` >=9.0.0
70
+ - `typescript` >=5.9.0
71
+ - `prettier` >=3.0.0
72
+
73
+ For full functionality, you may also need:
74
+ - `@next/eslint-plugin-next` >=15.0.0
75
+ - `@typescript-eslint/eslint-plugin` >=8.41.0
76
+ - `eslint-plugin-react` >=7.37.0
77
+ - `prettier-plugin-tailwindcss` >=0.6.0
78
+
79
+ ## License
80
+
81
+ MIT
82
+
83
+ ## Contributing
84
+
85
+ Contributions are welcome! Please feel free to submit a Pull Request.
@@ -0,0 +1,29 @@
1
+ import js from '@eslint/js';
2
+
3
+ import eslintConfigPrettier from 'eslint-config-prettier';
4
+ import turboPlugin from 'eslint-plugin-turbo';
5
+ import tseslint from 'typescript-eslint';
6
+
7
+ /**
8
+ * Base (non-Next) ESLint config
9
+ * Mirrors the previous packages/eslint-config/base.js (without any onlyWarn option).
10
+ * @type {import('eslint').Linter.Config[]}
11
+ */
12
+ export const config = [
13
+ js.configs.recommended,
14
+ eslintConfigPrettier,
15
+ ...tseslint.configs.recommended,
16
+ {
17
+ plugins: {
18
+ turbo: turboPlugin,
19
+ },
20
+ rules: {
21
+ 'turbo/no-undeclared-env-vars': 'warn',
22
+ },
23
+ },
24
+ {
25
+ ignores: ['dist/**'],
26
+ },
27
+ ];
28
+
29
+ export default config;
@@ -0,0 +1,79 @@
1
+ import pluginJs from '@eslint/js';
2
+ import typescriptEslint from '@typescript-eslint/eslint-plugin';
3
+ import typescriptParser from '@typescript-eslint/parser';
4
+
5
+ import { config as baseConfig } from './base.mjs';
6
+ import eslintConfigPrettier from 'eslint-config-prettier';
7
+ import importPlugin from 'eslint-plugin-import';
8
+ import prettier from 'eslint-plugin-prettier';
9
+ import pluginPromise from 'eslint-plugin-promise';
10
+ import valtio from 'eslint-plugin-valtio';
11
+ import globals from 'globals';
12
+ import tseslint from 'typescript-eslint';
13
+
14
+ /** @type {import('eslint').Linter.Config[]} */
15
+ const config = [
16
+ // Reuse base rules
17
+ ...baseConfig,
18
+ {
19
+ files: ['**/*.{js,mjs,cjs,ts,jsx,tsx}'],
20
+ },
21
+ {
22
+ languageOptions: {
23
+ ecmaVersion: 'latest',
24
+ globals: {
25
+ ...globals.browser,
26
+ ...globals.node,
27
+ ...globals.serviceworker,
28
+ },
29
+ sourceType: 'module',
30
+ parser: typescriptParser,
31
+ },
32
+ },
33
+ pluginJs.configs.recommended, // ? https://github.com/eslint/eslint
34
+ importPlugin.flatConfigs.recommended, // ? https://github.com/import-js/eslint-plugin-import
35
+ ...tseslint.configs.recommended, // ? https://github.com/typescript-eslint/typescript-eslint
36
+ pluginPromise.configs['flat/recommended'], // ? https://github.com/eslint-community/eslint-plugin-promise
37
+ eslintConfigPrettier, // ? https://github.com/prettier/eslint-config-prettier
38
+ {
39
+ rules: {
40
+ 'no-unused-vars': 'off',
41
+ 'newline-before-return': 'error',
42
+ '@typescript-eslint/no-unused-vars': 'off',
43
+ '@typescript-eslint/no-unused-expressions': 'off',
44
+ 'import/no-unresolved': 'off',
45
+ 'import/no-named-as-default': 'off',
46
+ },
47
+ },
48
+ // valtio
49
+ valtio.configs['flat/recommended'],
50
+ {
51
+ rules: {
52
+ 'valtio/state-snapshot-rule': ['warn'],
53
+ 'valtio/avoid-this-in-proxy': ['warn'],
54
+ },
55
+ },
56
+ // ! ===================== DISCLAIMER =====================
57
+ // ! There is no official solution available for new ESLint 9 flat config structure for NextJS
58
+ // ! The solution is taken from the community and may not be the best practice, use it at your own risk
59
+ // ? Ref: https://github.com/vercel/next.js/discussions/49337?sort=top#discussioncomment-5998603
60
+ // ! ======================================================
61
+ {
62
+ plugins: {
63
+ prettier,
64
+ '@typescript-eslint': typescriptEslint,
65
+ },
66
+ rules: {
67
+ // Prettier
68
+ 'prettier/prettier': 'error',
69
+
70
+ // General
71
+ 'no-console': 'off',
72
+ },
73
+ },
74
+ {
75
+ ignores: ['dist/**', 'node_modules/**'],
76
+ },
77
+ ];
78
+
79
+ export default config;
@@ -0,0 +1,100 @@
1
+ import pluginJs from '@eslint/js';
2
+ import nextPlugin from '@next/eslint-plugin-next';
3
+ import typescriptEslint from '@typescript-eslint/eslint-plugin';
4
+ import typescriptParser from '@typescript-eslint/parser';
5
+
6
+ import { config as baseConfig } from './base.mjs';
7
+ import eslintConfigPrettier from 'eslint-config-prettier';
8
+ import importPlugin from 'eslint-plugin-import';
9
+ import prettier from 'eslint-plugin-prettier';
10
+ import pluginPromise from 'eslint-plugin-promise';
11
+ import pluginReact from 'eslint-plugin-react';
12
+ import valtio from 'eslint-plugin-valtio';
13
+ import globals from 'globals';
14
+ import tseslint from 'typescript-eslint';
15
+
16
+ /** @type {import('eslint').Linter.Config[]} */
17
+ const config = [
18
+ // Reuse base rules
19
+ ...baseConfig,
20
+ {
21
+ files: ['**/*.{js,mjs,cjs,ts,jsx,tsx}'],
22
+ },
23
+ {
24
+ languageOptions: {
25
+ ecmaVersion: 'latest',
26
+ globals: {
27
+ ...globals.browser,
28
+ ...globals.node,
29
+ ...globals.serviceworker,
30
+ },
31
+ sourceType: 'module',
32
+ parser: typescriptParser,
33
+ },
34
+ },
35
+ {
36
+ settings: {
37
+ react: {
38
+ version: 'detect',
39
+ },
40
+ },
41
+ },
42
+ pluginJs.configs.recommended, // ? https://github.com/eslint/eslint
43
+ importPlugin.flatConfigs.recommended, // ? https://github.com/import-js/eslint-plugin-import
44
+ ...tseslint.configs.recommended, // ? https://github.com/typescript-eslint/typescript-eslint
45
+ pluginPromise.configs['flat/recommended'], // ? https://github.com/eslint-community/eslint-plugin-promise
46
+ pluginReact.configs.flat.recommended, // ? https://github.com/jsx-eslint/eslint-plugin-react
47
+ pluginReact.configs.flat['jsx-runtime'], // ? https://github.com/jsx-eslint/eslint-plugin-react
48
+ eslintConfigPrettier, // ? https://github.com/prettier/eslint-config-prettier
49
+ {
50
+ rules: {
51
+ 'no-unused-vars': 'off',
52
+ 'react/react-in-jsx-scope': 'off',
53
+ 'react-hooks/exhaustive-deps': 'off',
54
+ 'react/display-name': 'off',
55
+ 'react/prop-types': 'off',
56
+ 'newline-before-return': 'error',
57
+ '@typescript-eslint/no-unused-vars': 'off',
58
+ '@typescript-eslint/no-unused-expressions': 'off',
59
+ 'import/no-unresolved': 'off',
60
+ 'import/no-named-as-default': 'off',
61
+ 'react/no-unescaped-entities': 'off',
62
+ },
63
+ },
64
+ // valtio
65
+ valtio.configs['flat/recommended'],
66
+ {
67
+ rules: {
68
+ 'valtio/state-snapshot-rule': ['warn'],
69
+ 'valtio/avoid-this-in-proxy': ['warn'],
70
+ },
71
+ },
72
+ // ! ===================== DISCLAIMER =====================
73
+ // ! There is no official solution available for new ESLint 9 flat config structure for NextJS
74
+ // ! The solution is taken from the community and may not be the best practice, use it at your own risk
75
+ // ? Ref: https://github.com/vercel/next.js/discussions/49337?sort=top#discussioncomment-5998603
76
+ // ! ======================================================
77
+ {
78
+ plugins: {
79
+ '@next/next': nextPlugin,
80
+ prettier,
81
+ '@typescript-eslint': typescriptEslint,
82
+ },
83
+ rules: {
84
+ ...nextPlugin.configs.recommended.rules,
85
+ ...nextPlugin.configs['core-web-vitals'].rules,
86
+ '@next/next/no-img-element': 'off',
87
+
88
+ // Prettier
89
+ 'prettier/prettier': 'error',
90
+
91
+ // General
92
+ 'no-console': 'off',
93
+ },
94
+ },
95
+ {
96
+ ignores: ['.next/*', 'dist/**'],
97
+ },
98
+ ];
99
+
100
+ export default config;
@@ -0,0 +1,94 @@
1
+ import pluginJs from '@eslint/js';
2
+ import typescriptEslint from '@typescript-eslint/eslint-plugin';
3
+ import typescriptParser from '@typescript-eslint/parser';
4
+
5
+ import { config as baseConfig } from './base.mjs';
6
+ import eslintConfigPrettier from 'eslint-config-prettier';
7
+ import importPlugin from 'eslint-plugin-import';
8
+ import prettier from 'eslint-plugin-prettier';
9
+ import pluginPromise from 'eslint-plugin-promise';
10
+ import pluginReact from 'eslint-plugin-react';
11
+ import valtio from 'eslint-plugin-valtio';
12
+ import globals from 'globals';
13
+ import tseslint from 'typescript-eslint';
14
+
15
+ /** @type {import('eslint').Linter.Config[]} */
16
+ const config = [
17
+ // Reuse base rules
18
+ ...baseConfig,
19
+ {
20
+ files: ['**/*.{js,mjs,cjs,ts,jsx,tsx}'],
21
+ },
22
+ {
23
+ languageOptions: {
24
+ ecmaVersion: 'latest',
25
+ globals: {
26
+ ...globals.browser,
27
+ ...globals.node,
28
+ ...globals.serviceworker,
29
+ },
30
+ sourceType: 'module',
31
+ parser: typescriptParser,
32
+ },
33
+ },
34
+ {
35
+ settings: {
36
+ react: {
37
+ version: 'detect',
38
+ },
39
+ },
40
+ },
41
+ pluginJs.configs.recommended, // ? https://github.com/eslint/eslint
42
+ importPlugin.flatConfigs.recommended, // ? https://github.com/import-js/eslint-plugin-import
43
+ ...tseslint.configs.recommended, // ? https://github.com/typescript-eslint/typescript-eslint
44
+ pluginPromise.configs['flat/recommended'], // ? https://github.com/eslint-community/eslint-plugin-promise
45
+ pluginReact.configs.flat.recommended, // ? https://github.com/jsx-eslint/eslint-plugin-react
46
+ pluginReact.configs.flat['jsx-runtime'], // ? https://github.com/jsx-eslint/eslint-plugin-react
47
+ eslintConfigPrettier, // ? https://github.com/prettier/eslint-config-prettier
48
+ {
49
+ rules: {
50
+ 'no-unused-vars': 'off',
51
+ 'react/react-in-jsx-scope': 'off',
52
+ 'react-hooks/exhaustive-deps': 'off',
53
+ 'react/display-name': 'off',
54
+ 'react/prop-types': 'off',
55
+ 'newline-before-return': 'error',
56
+ '@typescript-eslint/no-unused-vars': 'off',
57
+ '@typescript-eslint/no-unused-expressions': 'off',
58
+ 'import/no-unresolved': 'off',
59
+ 'import/no-named-as-default': 'off',
60
+ 'react/no-unescaped-entities': 'off',
61
+ },
62
+ },
63
+ // valtio
64
+ valtio.configs['flat/recommended'],
65
+ {
66
+ rules: {
67
+ 'valtio/state-snapshot-rule': ['warn'],
68
+ 'valtio/avoid-this-in-proxy': ['warn'],
69
+ },
70
+ },
71
+ // ! ===================== DISCLAIMER =====================
72
+ // ! There is no official solution available for new ESLint 9 flat config structure for NextJS
73
+ // ! The solution is taken from the community and may not be the best practice, use it at your own risk
74
+ // ? Ref: https://github.com/vercel/next.js/discussions/49337?sort=top#discussioncomment-5998603
75
+ // ! ======================================================
76
+ {
77
+ plugins: {
78
+ prettier,
79
+ '@typescript-eslint': typescriptEslint,
80
+ },
81
+ rules: {
82
+ // Prettier
83
+ 'prettier/prettier': 'error',
84
+
85
+ // General
86
+ 'no-console': 'off',
87
+ },
88
+ },
89
+ {
90
+ ignores: ['dist/**', 'node_modules/**'],
91
+ },
92
+ ];
93
+
94
+ export default config;
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@korioinc/next-configs",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "scripts": {
6
+ "lint": "eslint . --max-warnings 0"
7
+ },
8
+ "exports": {
9
+ "./eslint": "./eslint/next.mjs",
10
+ "./eslint/base": "./eslint/base.mjs",
11
+ "./eslint/next": "./eslint/next.mjs",
12
+ "./eslint/library": "./eslint/library.mjs",
13
+ "./eslint/react-library": "./eslint/react-library.mjs",
14
+ "./prettier": "./prettier/index.mjs",
15
+ "./tsconfig/*": "./tsconfig/*.json"
16
+ },
17
+ "files": [
18
+ "eslint",
19
+ "prettier",
20
+ "tsconfig",
21
+ "README.md",
22
+ "LICENSE"
23
+ ],
24
+ "publishConfig": {
25
+ "access": "public",
26
+ "registry": "https://registry.npmjs.org/"
27
+ },
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "git+https://github.com/korioinc/korio-nextjs-kit.git",
31
+ "directory": "packages/configs"
32
+ },
33
+ "author": "Korio Inc.",
34
+ "license": "MIT",
35
+ "peerDependencies": {
36
+ "globals": ">=16.0.0",
37
+ "eslint": ">=9.0.0",
38
+ "@eslint/js": ">=9.0.0",
39
+ "@next/eslint-plugin-next": ">=15.0.0",
40
+ "@typescript-eslint/eslint-plugin": ">=8.41.0",
41
+ "@typescript-eslint/parser": ">=8.41.0",
42
+ "eslint-config-prettier": ">=10.0.0",
43
+ "eslint-plugin-import": ">=2.32.0",
44
+ "eslint-plugin-prettier": ">=5.5.0",
45
+ "eslint-plugin-promise": ">=7.2.0",
46
+ "eslint-plugin-react": ">=7.37.0",
47
+ "eslint-plugin-react-hooks": ">=5.2.0",
48
+ "eslint-plugin-turbo": ">=2.5.0",
49
+ "typescript": ">=5.9.0",
50
+ "typescript-eslint": ">=8.41.0",
51
+ "prettier": ">=3.0.0",
52
+ "@trivago/prettier-plugin-sort-imports": ">=5.0.0",
53
+ "prettier-plugin-tailwindcss": ">=0.6.0"
54
+ }
55
+ }
@@ -0,0 +1,22 @@
1
+ export default {
2
+ arrowParens: 'always',
3
+ bracketSpacing: true,
4
+ htmlWhitespaceSensitivity: 'css',
5
+ insertPragma: false,
6
+ bracketSameLine: true,
7
+ jsxSingleQuote: true,
8
+ printWidth: 120,
9
+ proseWrap: 'preserve',
10
+ quoteProps: 'as-needed',
11
+ requirePragma: false,
12
+ semi: true,
13
+ singleQuote: true,
14
+ tabWidth: 2,
15
+ trailingComma: 'all',
16
+ useTabs: false,
17
+ endOfLine: 'auto',
18
+ plugins: ['@trivago/prettier-plugin-sort-imports', 'prettier-plugin-tailwindcss'],
19
+ importOrder: ['^react$', '^next(/.*)?$', 'next-themes', '@/*', '<THIRD_PARTY_MODULES>'],
20
+ importOrderSeparation: true,
21
+ importOrderSortSpecifiers: true,
22
+ };
@@ -0,0 +1,19 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "compilerOptions": {
4
+ "declaration": true,
5
+ "declarationMap": true,
6
+ "esModuleInterop": true,
7
+ "incremental": false,
8
+ "isolatedModules": true,
9
+ "lib": ["es2022", "DOM", "DOM.Iterable"],
10
+ "module": "NodeNext",
11
+ "moduleDetection": "force",
12
+ "moduleResolution": "NodeNext",
13
+ "noUncheckedIndexedAccess": true,
14
+ "resolveJsonModule": true,
15
+ "skipLibCheck": true,
16
+ "strict": true,
17
+ "target": "ES2022"
18
+ }
19
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "extends": "./base.json",
4
+ "compilerOptions": {
5
+ "plugins": [{ "name": "next" }],
6
+ "module": "ESNext",
7
+ "moduleResolution": "Bundler",
8
+ "allowJs": true,
9
+ "jsx": "preserve",
10
+ "noEmit": true,
11
+ "noUncheckedIndexedAccess": false
12
+ }
13
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "extends": "./base.json",
4
+ "compilerOptions": {
5
+ "jsx": "react-jsx",
6
+ "module": "ESNext",
7
+ "moduleResolution": "Bundler"
8
+ }
9
+ }