@qvaroo/configs 1.0.4 → 1.0.6

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 CHANGED
@@ -27,39 +27,59 @@ npm install --save-dev eslint prettier typescript
27
27
 
28
28
  ## 🚀 Quick Setup
29
29
 
30
- ### 1. ESLint Configuration
30
+ ### 1. ESLint Configuration (New Flat Config)
31
+ Create `eslint.config.mjs` in your project root:
31
32
 
32
- Create `.eslintrc.js` in your project root:
33
-
34
- **For React/Next.js projects:**
35
33
  ```javascript
36
- module.exports = {
37
- extends: ['./node_modules/@qvaroo/configs/eslint/react.js'],
38
- parserOptions: {
39
- project: './tsconfig.json',
40
- tsconfigRootDir: __dirname,
41
- },
42
- };
34
+ import { createRequire } from 'module';
35
+ const require = createRequire(import.meta.url);
36
+
37
+ // 1. Plugins (must be explicitly imported and registered in Flat Config)
38
+ const spellcheckPlugin = require('eslint-plugin-spellcheck');
39
+ const sonarjsPlugin = require('eslint-plugin-sonarjs');
40
+
41
+ // 2. Qvaroo Configs
42
+ const {
43
+ namingConventions,
44
+ codeQuality,
45
+ spellcheck
46
+ } = require('@qvaroo/configs');
47
+
48
+ export default [
49
+ {
50
+ files: ['**/*.{ts,tsx}'],
51
+
52
+ // 3. Register Plugins
53
+ plugins: {
54
+ 'spellcheck': spellcheckPlugin,
55
+ 'sonarjs': sonarjsPlugin
56
+ },
57
+
58
+ // 4. Apply Rules
59
+ rules: {
60
+ ...namingConventions,
61
+ ...codeQuality,
62
+ ...spellcheck
63
+ },
64
+
65
+ // 5. TypeScript Parser Config (Required for type-aware rules)
66
+ languageOptions: {
67
+ parserOptions: {
68
+ project: true,
69
+ tsconfigRootDir: import.meta.dirname,
70
+ },
71
+ },
72
+ },
73
+ ];
43
74
  ```
44
75
 
45
- **For Node.js/Backend projects:**
46
- ```javascript
47
- module.exports = {
48
- extends: ['./node_modules/@qvaroo/configs/eslint/node.js'],
49
- parserOptions: {
50
- project: './tsconfig.json',
51
- tsconfigRootDir: __dirname,
52
- },
53
- };
54
- ```
55
-
56
- **For base TypeScript projects:**
76
+ ** Legacy Config (.eslintrc.js):**
77
+ If you are still using the legacy config system:
57
78
  ```javascript
58
79
  module.exports = {
59
80
  extends: ['./node_modules/@qvaroo/configs/eslint/index.js'],
60
81
  parserOptions: {
61
82
  project: './tsconfig.json',
62
- tsconfigRootDir: __dirname,
63
83
  },
64
84
  };
65
85
  ```
@@ -137,38 +157,7 @@ Create `tsconfig.json`:
137
157
 
138
158
  ---
139
159
 
140
- ## 🏗️ Folder Structure Enforcement
141
160
 
142
- Required project structure:
143
-
144
- ```
145
- src/
146
- ├── api/ # API clients & endpoints
147
- ├── components/ # Reusable UI components
148
- ├── services/ # Business logic layer
149
- ├── events/ # Event handlers & emitters
150
- ├── animations/ # Animation definitions
151
- ├── styles/ # Global styles & themes
152
- ├── hooks/ # Custom React hooks
153
- ├── views/ # Page-level components (presentation only)
154
- ├── types/ # TypeScript interfaces & types
155
- ├── constants/ # Application constants
156
- └── utils/ # Utility functions
157
- ```
158
-
159
- ### Boundary Rules
160
-
161
- | Layer | Can Import From |
162
- |-------|-----------------|
163
- | `views` | components, styles, hooks, animations, constants |
164
- | `components` | components, styles, hooks, utils, types, animations |
165
- | `hooks` | services, api, types, utils |
166
- | `services` | api, types, utils, constants |
167
- | `api` | types, utils, constants |
168
-
169
- > ⚠️ **Views cannot import from `api` or `services` directly!** Use hooks instead.
170
-
171
- ---
172
161
 
173
162
  ## ⛔️ Local Enforcement (Pre-commit Hooks)
174
163
 
@@ -404,7 +393,6 @@ module.exports = {
404
393
  │ └── rules/
405
394
  │ ├── naming-conventions.js
406
395
  │ ├── code-quality.js
407
- │ ├── architecture.js
408
396
  │ └── spellcheck.js
409
397
  ├── prettier/
410
398
  │ └── index.js # Prettier config
package/eslint/index.js CHANGED
@@ -10,7 +10,6 @@
10
10
 
11
11
  const namingConventionRules = require('./rules/naming-conventions');
12
12
  const codeQualityRules = require('./rules/code-quality');
13
- const architectureRules = require('./rules/architecture');
14
13
  const spellcheckRules = require('./rules/spellcheck');
15
14
 
16
15
  /** @type {import('eslint').Linter.Config} */
@@ -81,10 +80,7 @@ module.exports = {
81
80
  // ═══════════════════════════════════════════════════════════════════════
82
81
  ...codeQualityRules,
83
82
 
84
- // ═══════════════════════════════════════════════════════════════════════
85
- // ARCHITECTURE - Folder boundaries and separation of concerns
86
- // ═══════════════════════════════════════════════════════════════════════
87
- ...architectureRules,
83
+
88
84
 
89
85
  // ═══════════════════════════════════════════════════════════════════════
90
86
  // SPELLCHECK - Variable name clarity
package/index.d.ts CHANGED
@@ -5,5 +5,4 @@ export declare const prettier: import('prettier').Config;
5
5
 
6
6
  export declare const namingConventions: Record<string, any>;
7
7
  export declare const codeQuality: Record<string, any>;
8
- export declare const architecture: Record<string, any>;
9
8
  export declare const spellcheck: Record<string, any>;
package/index.js CHANGED
@@ -12,6 +12,5 @@ module.exports = {
12
12
  // Individual Rule Sets
13
13
  namingConventions: require('./eslint/rules/naming-conventions'),
14
14
  codeQuality: require('./eslint/rules/code-quality'),
15
- architecture: require('./eslint/rules/architecture'),
16
15
  spellcheck: require('./eslint/rules/spellcheck'),
17
16
  };
package/index.mjs CHANGED
@@ -7,7 +7,6 @@ export const {
7
7
  prettier,
8
8
  namingConventions,
9
9
  codeQuality,
10
- architecture,
11
10
  spellcheck
12
11
  } = cjs;
13
12
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qvaroo/configs",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "Centralized Qvaroo coding standards, ESLint, Prettier, and TypeScript configurations for TypeScript frontend projects",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -1,152 +0,0 @@
1
- /**
2
- * Architecture Rules
3
- *
4
- * Enforces folder structure and separation of concerns:
5
- * - /api, /components, /services, /events, /animations, /styles
6
- * - Presentation-only views: No business logic or API calls
7
- * - Boundary enforcement between layers
8
- */
9
-
10
- module.exports = {
11
- // ═══════════════════════════════════════════════════════════════════════
12
- // BOUNDARY RULES - Folder separation enforcement
13
- // ═══════════════════════════════════════════════════════════════════════
14
-
15
- 'boundaries/element-types': [
16
- 'error',
17
- {
18
- default: 'disallow',
19
- rules: [
20
- // Components can import from: styles, types, utils, hooks, components, animations
21
- {
22
- from: 'components',
23
- allow: ['components', 'styles', 'types', 'utils', 'hooks', 'animations', 'constants'],
24
- },
25
-
26
- // Views can import from: components, styles, types, hooks (NO services, NO api)
27
- {
28
- from: 'views',
29
- allow: ['components', 'styles', 'types', 'hooks', 'animations', 'constants'],
30
- disallow: ['api', 'services'], // Presentation-only views
31
- },
32
-
33
- // Services can import from: api, types, utils, constants
34
- {
35
- from: 'services',
36
- allow: ['api', 'types', 'utils', 'constants', 'services'],
37
- },
38
-
39
- // API layer can only import from: types, utils, constants
40
- {
41
- from: 'api',
42
- allow: ['types', 'utils', 'constants'],
43
- },
44
-
45
- // Hooks can import from: services, api, types, utils
46
- {
47
- from: 'hooks',
48
- allow: ['services', 'api', 'types', 'utils', 'constants', 'hooks'],
49
- },
50
-
51
- // Events can import from: types, utils
52
- {
53
- from: 'events',
54
- allow: ['types', 'utils', 'constants'],
55
- },
56
-
57
- // Animations can import from: types, utils, styles
58
- {
59
- from: 'animations',
60
- allow: ['types', 'utils', 'styles', 'constants'],
61
- },
62
-
63
- // Styles: standalone, no business imports
64
- {
65
- from: 'styles',
66
- allow: ['styles', 'constants'],
67
- },
68
-
69
- // Utils: standalone, no circular dependencies
70
- {
71
- from: 'utils',
72
- allow: ['types', 'constants'],
73
- },
74
-
75
- // Types: standalone
76
- {
77
- from: 'types',
78
- allow: ['types'],
79
- },
80
-
81
- // Constants: standalone
82
- {
83
- from: 'constants',
84
- allow: ['types'],
85
- },
86
- ],
87
- },
88
- ],
89
-
90
- // ═══════════════════════════════════════════════════════════════════════
91
- // IMPORT BOUNDARIES - Prevent circular dependencies
92
- // ═══════════════════════════════════════════════════════════════════════
93
-
94
- 'import/no-cycle': ['error', { maxDepth: 3 }],
95
-
96
- 'import/no-restricted-paths': [
97
- 'error',
98
- {
99
- zones: [
100
- // Views cannot import directly from API
101
- {
102
- target: './src/views',
103
- from: './src/api',
104
- message: 'Views must not import from API directly. Use hooks or services instead.',
105
- },
106
- // Views cannot import directly from Services
107
- {
108
- target: './src/views',
109
- from: './src/services',
110
- message: 'Views must not import from services directly. Use hooks instead.',
111
- },
112
- // Components cannot import from views (prevent circular)
113
- {
114
- target: './src/components',
115
- from: './src/views',
116
- message: 'Components cannot import from views. This creates circular dependencies.',
117
- },
118
- // Styles cannot import business logic
119
- {
120
- target: './src/styles',
121
- from: './src/api',
122
- message: 'Styles must not contain business logic or API dependencies.',
123
- },
124
- {
125
- target: './src/styles',
126
- from: './src/services',
127
- message: 'Styles must not contain business logic or service dependencies.',
128
- },
129
- ],
130
- },
131
- ],
132
-
133
- // ═══════════════════════════════════════════════════════════════════════
134
- // FILE NAMING PATTERNS
135
- // ═══════════════════════════════════════════════════════════════════════
136
-
137
- // Enforce consistent file naming
138
- 'unicorn/filename-case': [
139
- 'error',
140
- {
141
- cases: {
142
- kebabCase: true, // Regular files: my-component.ts
143
- pascalCase: true, // React components: MyComponent.tsx
144
- },
145
- ignore: [
146
- '^README\\.md$',
147
- '^CHANGELOG\\.md$',
148
- '^LICENSE$',
149
- ],
150
- },
151
- ],
152
- };