@vijayhardaha/dev-config 1.0.1 → 1.0.3
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 +32 -0
- package/package.json +78 -2
- package/src/commitlint/index.js +9 -7
- package/src/eslint/next.js +2 -2
- package/src/eslint/react.js +2 -2
- package/src/eslint/typescript.js +2 -2
- package/src/index.js +0 -6
- package/src/{typescript/base.json → tsconfig/index.json} +1 -16
package/README.md
CHANGED
|
@@ -18,6 +18,38 @@ Reusable development configuration package for Next.js + TypeScript projects.
|
|
|
18
18
|
npm install @vijayhardaha/dev-config --save-dev
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
+
### Install Required Packages
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install --save-dev eslint@9.39.4 @eslint/js@9.39.4 @eslint/compat @eslint/eslintrc eslint-config-prettier eslint-plugin-prettier globals prettier typescript @typescript-eslint/eslint-plugin @typescript-eslint/parser
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Install Optional Packages
|
|
28
|
+
|
|
29
|
+
#### Stylelint
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm install --save-dev stylelint stylelint-config-property-sort-order-smacss stylelint-config-standard-scss stylelint-order
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
#### React
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm install --save-dev eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-jsx-a11y eslint-plugin-import
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
#### Next.js
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npm install --save-dev @next/eslint-plugin-next eslint-config-next
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
#### Commitlint
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npm install --save-dev @commitlint/cli @commitlint/config-conventional
|
|
51
|
+
```
|
|
52
|
+
|
|
21
53
|
## Quick Start
|
|
22
54
|
|
|
23
55
|
### ESLint
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vijayhardaha/dev-config",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Reusable development configurations for Next.js + TypeScript projects",
|
|
5
5
|
"author": "Vijay Hardaha",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"./commitlint": "./src/commitlint/index.js",
|
|
25
25
|
"./stylelint": "./src/stylelint/index.js",
|
|
26
26
|
"./next-sitemap": "./src/next-sitemap/index.js",
|
|
27
|
-
"./
|
|
27
|
+
"./tsconfig": "./src/tsconfig/index.json",
|
|
28
28
|
"./jsconfig": "./src/jsconfig/index.json"
|
|
29
29
|
},
|
|
30
30
|
"files": [
|
|
@@ -75,18 +75,94 @@
|
|
|
75
75
|
"stylelint-order": "^8",
|
|
76
76
|
"typescript": "^5"
|
|
77
77
|
},
|
|
78
|
+
"peerDependenciesMeta": {
|
|
79
|
+
"@commitlint/cli": {
|
|
80
|
+
"optional": false
|
|
81
|
+
},
|
|
82
|
+
"@commitlint/config-conventional": {
|
|
83
|
+
"optional": false
|
|
84
|
+
},
|
|
85
|
+
"@eslint/compat": {
|
|
86
|
+
"optional": false
|
|
87
|
+
},
|
|
88
|
+
"@eslint/eslintrc": {
|
|
89
|
+
"optional": false
|
|
90
|
+
},
|
|
91
|
+
"@eslint/js": {
|
|
92
|
+
"optional": false
|
|
93
|
+
},
|
|
94
|
+
"@next/eslint-plugin-next": {
|
|
95
|
+
"optional": true
|
|
96
|
+
},
|
|
97
|
+
"@typescript-eslint/eslint-plugin": {
|
|
98
|
+
"optional": true
|
|
99
|
+
},
|
|
100
|
+
"@typescript-eslint/parser": {
|
|
101
|
+
"optional": true
|
|
102
|
+
},
|
|
103
|
+
"eslint": {
|
|
104
|
+
"optional": false
|
|
105
|
+
},
|
|
106
|
+
"eslint-config-next": {
|
|
107
|
+
"optional": true
|
|
108
|
+
},
|
|
109
|
+
"eslint-config-prettier": {
|
|
110
|
+
"optional": false
|
|
111
|
+
},
|
|
112
|
+
"eslint-plugin-import": {
|
|
113
|
+
"optional": true
|
|
114
|
+
},
|
|
115
|
+
"eslint-plugin-jsx-a11y": {
|
|
116
|
+
"optional": true
|
|
117
|
+
},
|
|
118
|
+
"eslint-plugin-prettier": {
|
|
119
|
+
"optional": false
|
|
120
|
+
},
|
|
121
|
+
"eslint-plugin-react": {
|
|
122
|
+
"optional": true
|
|
123
|
+
},
|
|
124
|
+
"eslint-plugin-react-hooks": {
|
|
125
|
+
"optional": true
|
|
126
|
+
},
|
|
127
|
+
"globals": {
|
|
128
|
+
"optional": false
|
|
129
|
+
},
|
|
130
|
+
"prettier": {
|
|
131
|
+
"optional": false
|
|
132
|
+
},
|
|
133
|
+
"stylelint": {
|
|
134
|
+
"optional": true
|
|
135
|
+
},
|
|
136
|
+
"stylelint-config-property-sort-order-smacss": {
|
|
137
|
+
"optional": true
|
|
138
|
+
},
|
|
139
|
+
"stylelint-config-standard-scss": {
|
|
140
|
+
"optional": true
|
|
141
|
+
},
|
|
142
|
+
"stylelint-order": {
|
|
143
|
+
"optional": true
|
|
144
|
+
},
|
|
145
|
+
"typescript": {
|
|
146
|
+
"optional": false
|
|
147
|
+
}
|
|
148
|
+
},
|
|
78
149
|
"devDependencies": {
|
|
79
150
|
"@commitlint/cli": "^20.5.0",
|
|
80
151
|
"@commitlint/config-conventional": "^20.5.0",
|
|
81
152
|
"@eslint/compat": "^2.0.3",
|
|
82
153
|
"@eslint/eslintrc": "^3.3.5",
|
|
83
154
|
"@eslint/js": "^9.39.4",
|
|
155
|
+
"@typescript-eslint/parser": "^8.57.2",
|
|
84
156
|
"eslint": "^9.39.4",
|
|
85
157
|
"eslint-config-prettier": "^10.1.8",
|
|
158
|
+
"eslint-plugin-import": "^2.32.0",
|
|
86
159
|
"eslint-plugin-prettier": "^5.5.5",
|
|
87
160
|
"globals": "^17.4.0",
|
|
88
161
|
"husky": "^9.1.7",
|
|
89
162
|
"prettier": "^3.8.1",
|
|
90
163
|
"release-it": "^19.2.4"
|
|
164
|
+
},
|
|
165
|
+
"overrides": {
|
|
166
|
+
"undici": "^7.0.0"
|
|
91
167
|
}
|
|
92
168
|
}
|
package/src/commitlint/index.js
CHANGED
|
@@ -16,16 +16,18 @@ const config = {
|
|
|
16
16
|
|
|
17
17
|
// ---- Rules ----
|
|
18
18
|
// Maximum length for the commit header (first line)
|
|
19
|
-
|
|
19
|
+
rules: {
|
|
20
|
+
'header-max-length': [2, 'always', 50],
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
// Maximum length for any line in the commit body
|
|
23
|
+
'body-max-line-length': [2, 'always', 72],
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
// Commit body must be in sentence case or lower case
|
|
26
|
+
'body-case': [2, 'always', ['sentence-case', 'lower-case']],
|
|
26
27
|
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
// Subject case is not enforced (allows flexibility)
|
|
29
|
+
'subject-case': [0],
|
|
30
|
+
},
|
|
29
31
|
};
|
|
30
32
|
|
|
31
33
|
export default config;
|
package/src/eslint/next.js
CHANGED
|
@@ -13,7 +13,7 @@ import { defineConfig } from 'eslint/config';
|
|
|
13
13
|
|
|
14
14
|
import { setup, commonIgnores, commonParser, commonRules, commonLanguageOptions, files } from './common.js';
|
|
15
15
|
|
|
16
|
-
const { compat
|
|
16
|
+
const { compat } = setup();
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* Creates an ESLint configuration object for Next.js projects with TypeScript
|
|
@@ -58,7 +58,7 @@ export const createConfig = (options = {}) => {
|
|
|
58
58
|
...commonParser,
|
|
59
59
|
// ---- Parser Options ----
|
|
60
60
|
// Configure TypeScript parser with React JSX support
|
|
61
|
-
parserOptions: { ecmaFeatures: { jsx: true }, tsconfigRootDir:
|
|
61
|
+
parserOptions: { ecmaFeatures: { jsx: true }, tsconfigRootDir: process.cwd() },
|
|
62
62
|
},
|
|
63
63
|
|
|
64
64
|
// ---- React Settings ----
|
package/src/eslint/react.js
CHANGED
|
@@ -13,7 +13,7 @@ import { defineConfig } from 'eslint/config';
|
|
|
13
13
|
|
|
14
14
|
import { setup, commonIgnores, commonParser, commonRules, commonLanguageOptions, files } from './common.js';
|
|
15
15
|
|
|
16
|
-
const { compat
|
|
16
|
+
const { compat } = setup();
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* Creates an ESLint configuration object for React projects with TypeScript
|
|
@@ -55,7 +55,7 @@ export const createConfig = (options = {}) => {
|
|
|
55
55
|
...commonParser,
|
|
56
56
|
// ---- Parser Options ----
|
|
57
57
|
// Configure TypeScript parser with React JSX support
|
|
58
|
-
parserOptions: { ecmaFeatures: { jsx: true }, tsconfigRootDir:
|
|
58
|
+
parserOptions: { ecmaFeatures: { jsx: true }, tsconfigRootDir: process.cwd() },
|
|
59
59
|
},
|
|
60
60
|
|
|
61
61
|
// ---- React Settings ----
|
package/src/eslint/typescript.js
CHANGED
|
@@ -13,7 +13,7 @@ import { defineConfig } from 'eslint/config';
|
|
|
13
13
|
|
|
14
14
|
import { setup, commonIgnores, commonParser, commonRules, commonLanguageOptions, files } from './common.js';
|
|
15
15
|
|
|
16
|
-
const { compat
|
|
16
|
+
const { compat } = setup();
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* Creates an ESLint configuration object for TypeScript projects.
|
|
@@ -50,7 +50,7 @@ export const createConfig = (options = {}) => {
|
|
|
50
50
|
...commonParser,
|
|
51
51
|
// ---- Parser Options ----
|
|
52
52
|
// Configure TypeScript parser
|
|
53
|
-
parserOptions: { tsconfigRootDir:
|
|
53
|
+
parserOptions: { tsconfigRootDir: process.cwd() },
|
|
54
54
|
},
|
|
55
55
|
|
|
56
56
|
rules: commonRules({ prettier, importOrder }),
|
package/src/index.js
CHANGED
|
@@ -55,9 +55,3 @@ export { default as nextSitemap, createSitemapConfig } from './next-sitemap/inde
|
|
|
55
55
|
* @type {import('stylelint').Config}
|
|
56
56
|
*/
|
|
57
57
|
export { default as stylelint } from './stylelint/index.js';
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* TypeScript base configuration.
|
|
61
|
-
* @type {import('typescript').CompilerOptions}
|
|
62
|
-
*/
|
|
63
|
-
export { default as typescriptBase } from './typescript/base.json';
|
|
@@ -23,20 +23,5 @@
|
|
|
23
23
|
"useDefineForClassFields": true,
|
|
24
24
|
"skipLibCheck": true,
|
|
25
25
|
"forceConsistentCasingInFileNames": true
|
|
26
|
-
}
|
|
27
|
-
"include": [
|
|
28
|
-
".next/dev/types/**/*.ts",
|
|
29
|
-
".next/types/**/*.ts",
|
|
30
|
-
"*.config.mjs",
|
|
31
|
-
"*.config.ts",
|
|
32
|
-
"*.d.ts",
|
|
33
|
-
"**/*.js",
|
|
34
|
-
"**/*.jsx",
|
|
35
|
-
"**/*.ts",
|
|
36
|
-
"**/*.tsx",
|
|
37
|
-
"**/*.mjs",
|
|
38
|
-
"**/*.cjs",
|
|
39
|
-
"next-env.d.ts"
|
|
40
|
-
],
|
|
41
|
-
"exclude": ["node_modules"]
|
|
26
|
+
}
|
|
42
27
|
}
|