@qvaroo/configs 1.0.0 → 1.0.2
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 +48 -15
- package/index.d.ts +5 -0
- package/index.js +6 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @qvaroo/configs
|
|
2
2
|
|
|
3
|
-
> **Centralized
|
|
3
|
+
> **Centralized Qvaroo coding standards for TypeScript frontend projects.**
|
|
4
4
|
>
|
|
5
5
|
> This library acts as the **single source of truth** for all coding, architecture, and tooling standards. All rule violations **fail CI/CD pipelines**, removing human discretion from standards enforcement.
|
|
6
6
|
|
|
7
|
-
[](https://www.npmjs.com/package/@qvaroo/configs)
|
|
8
8
|
[](https://opensource.org/licenses/MIT)
|
|
9
9
|
|
|
10
10
|
---
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
## 📦 Installation
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
|
-
npm install --save-dev @
|
|
15
|
+
npm install --save-dev @qvaroo/configs
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
### Peer Dependencies
|
|
@@ -34,7 +34,7 @@ Create `.eslintrc.js` in your project root:
|
|
|
34
34
|
**For React/Next.js projects:**
|
|
35
35
|
```javascript
|
|
36
36
|
module.exports = {
|
|
37
|
-
extends: ['./node_modules/@
|
|
37
|
+
extends: ['./node_modules/@qvaroo/configs/eslint/react.js'],
|
|
38
38
|
parserOptions: {
|
|
39
39
|
project: './tsconfig.json',
|
|
40
40
|
tsconfigRootDir: __dirname,
|
|
@@ -45,7 +45,7 @@ module.exports = {
|
|
|
45
45
|
**For Node.js/Backend projects:**
|
|
46
46
|
```javascript
|
|
47
47
|
module.exports = {
|
|
48
|
-
extends: ['./node_modules/@
|
|
48
|
+
extends: ['./node_modules/@qvaroo/configs/eslint/node.js'],
|
|
49
49
|
parserOptions: {
|
|
50
50
|
project: './tsconfig.json',
|
|
51
51
|
tsconfigRootDir: __dirname,
|
|
@@ -56,7 +56,7 @@ module.exports = {
|
|
|
56
56
|
**For base TypeScript projects:**
|
|
57
57
|
```javascript
|
|
58
58
|
module.exports = {
|
|
59
|
-
extends: ['./node_modules/@
|
|
59
|
+
extends: ['./node_modules/@qvaroo/configs/eslint/index.js'],
|
|
60
60
|
parserOptions: {
|
|
61
61
|
project: './tsconfig.json',
|
|
62
62
|
tsconfigRootDir: __dirname,
|
|
@@ -69,7 +69,7 @@ module.exports = {
|
|
|
69
69
|
Create `prettier.config.js`:
|
|
70
70
|
|
|
71
71
|
```javascript
|
|
72
|
-
module.exports = require('@
|
|
72
|
+
module.exports = require('@qvaroo/configs/prettier');
|
|
73
73
|
```
|
|
74
74
|
|
|
75
75
|
### 3. TypeScript Configuration
|
|
@@ -79,7 +79,7 @@ Create `tsconfig.json`:
|
|
|
79
79
|
**For React projects:**
|
|
80
80
|
```json
|
|
81
81
|
{
|
|
82
|
-
"extends": "@
|
|
82
|
+
"extends": "@qvaroo/configs/typescript/react",
|
|
83
83
|
"compilerOptions": {
|
|
84
84
|
"baseUrl": "."
|
|
85
85
|
},
|
|
@@ -91,7 +91,7 @@ Create `tsconfig.json`:
|
|
|
91
91
|
**For Node.js projects:**
|
|
92
92
|
```json
|
|
93
93
|
{
|
|
94
|
-
"extends": "@
|
|
94
|
+
"extends": "@qvaroo/configs/typescript/node",
|
|
95
95
|
"compilerOptions": {
|
|
96
96
|
"baseUrl": "."
|
|
97
97
|
},
|
|
@@ -170,6 +170,39 @@ src/
|
|
|
170
170
|
|
|
171
171
|
---
|
|
172
172
|
|
|
173
|
+
## ⛔️ Local Enforcement (Pre-commit Hooks)
|
|
174
|
+
|
|
175
|
+
To ensure developers fix errors **before** they commit, set up [Husky](https://typicode.github.io/husky/).
|
|
176
|
+
|
|
177
|
+
1. **Install Husky & Lint-staged**:
|
|
178
|
+
```bash
|
|
179
|
+
npm install --save-dev husky lint-staged
|
|
180
|
+
npx husky init
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
2. **Configure Pre-commit Hook**:
|
|
184
|
+
Update `.husky/pre-commit` to run lint-staged:
|
|
185
|
+
```bash
|
|
186
|
+
npx lint-staged
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
3. **Update `package.json`**:
|
|
190
|
+
Add the configuration to check only changed files:
|
|
191
|
+
```json
|
|
192
|
+
{
|
|
193
|
+
"lint-staged": {
|
|
194
|
+
"src/**/*.{ts,tsx,js}": [
|
|
195
|
+
"eslint --fix",
|
|
196
|
+
"prettier --write"
|
|
197
|
+
]
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
> Now, if a developer tries to commit code with errors, **git will reject the commit** until fixed.
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
173
206
|
## 🔧 CI/CD Integration
|
|
174
207
|
|
|
175
208
|
### GitHub Actions
|
|
@@ -309,7 +342,7 @@ Override specific rules in your project's `.eslintrc.js`:
|
|
|
309
342
|
|
|
310
343
|
```javascript
|
|
311
344
|
module.exports = {
|
|
312
|
-
extends: ['./node_modules/@
|
|
345
|
+
extends: ['./node_modules/@qvaroo/configs/eslint/react.js'],
|
|
313
346
|
rules: {
|
|
314
347
|
// Relax for specific project needs
|
|
315
348
|
'max-lines-per-function': ['error', { max: 60 }],
|
|
@@ -330,12 +363,12 @@ Variable names are checked for spelling. Add project-specific terms:
|
|
|
330
363
|
|
|
331
364
|
```javascript
|
|
332
365
|
module.exports = {
|
|
333
|
-
extends: ['./node_modules/@
|
|
366
|
+
extends: ['./node_modules/@qvaroo/configs/eslint'],
|
|
334
367
|
rules: {
|
|
335
368
|
'spellcheck/spell-checker': ['warn', {
|
|
336
369
|
skipWords: [
|
|
337
370
|
// Add your domain terms
|
|
338
|
-
'
|
|
371
|
+
'qvaroo',
|
|
339
372
|
'oauth',
|
|
340
373
|
'saml',
|
|
341
374
|
],
|
|
@@ -363,7 +396,7 @@ module.exports = {
|
|
|
363
396
|
## 📁 Package Contents
|
|
364
397
|
|
|
365
398
|
```
|
|
366
|
-
@
|
|
399
|
+
@qvaroo/configs/
|
|
367
400
|
├── eslint/
|
|
368
401
|
│ ├── index.js # Base ESLint config
|
|
369
402
|
│ ├── react.js # React/Next.js config
|
|
@@ -388,4 +421,4 @@ module.exports = {
|
|
|
388
421
|
|
|
389
422
|
## 📄 License
|
|
390
423
|
|
|
391
|
-
MIT ©
|
|
424
|
+
MIT © Qvaroo DevOps Team
|
package/index.d.ts
CHANGED
|
@@ -2,3 +2,8 @@ export declare const eslint: import('eslint').Linter.Config;
|
|
|
2
2
|
export declare const eslintReact: import('eslint').Linter.Config;
|
|
3
3
|
export declare const eslintNode: import('eslint').Linter.Config;
|
|
4
4
|
export declare const prettier: import('prettier').Config;
|
|
5
|
+
|
|
6
|
+
export declare const namingConventions: Record<string, any>;
|
|
7
|
+
export declare const codeQuality: Record<string, any>;
|
|
8
|
+
export declare const architecture: Record<string, any>;
|
|
9
|
+
export declare const spellcheck: Record<string, any>;
|
package/index.js
CHANGED
|
@@ -8,4 +8,10 @@ module.exports = {
|
|
|
8
8
|
eslintReact: require('./eslint/react'),
|
|
9
9
|
eslintNode: require('./eslint/node'),
|
|
10
10
|
prettier: require('./prettier'),
|
|
11
|
+
|
|
12
|
+
// Individual Rule Sets
|
|
13
|
+
namingConventions: require('./eslint/rules/naming-conventions'),
|
|
14
|
+
codeQuality: require('./eslint/rules/code-quality'),
|
|
15
|
+
architecture: require('./eslint/rules/architecture'),
|
|
16
|
+
spellcheck: require('./eslint/rules/spellcheck'),
|
|
11
17
|
};
|
package/package.json
CHANGED