@kivacore/rules 0.0.0-stage → 0.8.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.
Files changed (57) hide show
  1. package/README.md +235 -2
  2. package/dist/biome/astro.json +28 -0
  3. package/dist/biome/base.json +34 -0
  4. package/dist/biome/cloudflare.json +69 -0
  5. package/dist/biome/electron.json +28 -0
  6. package/dist/biome/nextjs.json +41 -0
  7. package/dist/biome/react.json +41 -0
  8. package/dist/biome/vue.json +28 -0
  9. package/dist/eslint/ai.d.ts +3 -0
  10. package/dist/eslint/ai.d.ts.map +1 -0
  11. package/dist/eslint/ai.js +13 -0
  12. package/dist/eslint/astro.d.ts +3 -0
  13. package/dist/eslint/astro.d.ts.map +1 -0
  14. package/dist/eslint/astro.js +2 -0
  15. package/dist/eslint/base.d.ts +3 -0
  16. package/dist/eslint/base.d.ts.map +1 -0
  17. package/dist/eslint/base.js +368 -0
  18. package/dist/eslint/electron.d.ts +3 -0
  19. package/dist/eslint/electron.d.ts.map +1 -0
  20. package/dist/eslint/electron.js +44 -0
  21. package/dist/eslint/index.d.ts +9 -0
  22. package/dist/eslint/index.d.ts.map +1 -0
  23. package/dist/eslint/index.js +8 -0
  24. package/dist/eslint/nextjs.d.ts +3 -0
  25. package/dist/eslint/nextjs.d.ts.map +1 -0
  26. package/dist/eslint/nextjs.js +26 -0
  27. package/dist/eslint/react-native.d.ts +3 -0
  28. package/dist/eslint/react-native.d.ts.map +1 -0
  29. package/dist/eslint/react-native.js +19 -0
  30. package/dist/eslint/react.d.ts +3 -0
  31. package/dist/eslint/react.d.ts.map +1 -0
  32. package/dist/eslint/react.js +20 -0
  33. package/dist/eslint/rules/index.d.ts +3 -0
  34. package/dist/eslint/rules/index.d.ts.map +1 -0
  35. package/dist/eslint/rules/index.js +14 -0
  36. package/dist/eslint/rules/react-native-no-color-literals.d.ts +3 -0
  37. package/dist/eslint/rules/react-native-no-color-literals.d.ts.map +1 -0
  38. package/dist/eslint/rules/react-native-no-color-literals.js +84 -0
  39. package/dist/eslint/rules/react-native-no-inline-styles.d.ts +3 -0
  40. package/dist/eslint/rules/react-native-no-inline-styles.d.ts.map +1 -0
  41. package/dist/eslint/rules/react-native-no-inline-styles.js +36 -0
  42. package/dist/eslint/rules/react-native-no-raw-text.d.ts +3 -0
  43. package/dist/eslint/rules/react-native-no-raw-text.d.ts.map +1 -0
  44. package/dist/eslint/rules/react-native-no-raw-text.js +85 -0
  45. package/dist/eslint/rules/react-native-no-single-element-style-arrays.d.ts +3 -0
  46. package/dist/eslint/rules/react-native-no-single-element-style-arrays.d.ts.map +1 -0
  47. package/dist/eslint/rules/react-native-no-single-element-style-arrays.js +33 -0
  48. package/dist/eslint/rules/react-native-no-unused-styles.d.ts +3 -0
  49. package/dist/eslint/rules/react-native-no-unused-styles.d.ts.map +1 -0
  50. package/dist/eslint/rules/react-native-no-unused-styles.js +51 -0
  51. package/dist/eslint/rules/react-native-split-platform-components.d.ts +3 -0
  52. package/dist/eslint/rules/react-native-split-platform-components.d.ts.map +1 -0
  53. package/dist/eslint/rules/react-native-split-platform-components.js +66 -0
  54. package/dist/eslint/vue.d.ts +3 -0
  55. package/dist/eslint/vue.d.ts.map +1 -0
  56. package/dist/eslint/vue.js +27 -0
  57. package/package.json +100 -3
package/README.md CHANGED
@@ -1,3 +1,236 @@
1
- # Temporary Holding Version
1
+ # @kivacore/rules
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Central ESLint and Biome configurations for Docyrus projects.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pnpm add -D @kivacore/rules eslint typescript
9
+ ```
10
+
11
+ ### TypeScript 7 Compatibility
12
+
13
+ TypeScript 7's native `tsc` does not expose the compiler API used by
14
+ `@typescript-eslint` and the React ESLint rules. These tools must resolve
15
+ `typescript` to the TypeScript 6 compatibility package; disabling a parser
16
+ version warning does not provide the missing API.
17
+
18
+ For a standalone project, install the API package under the `typescript` alias
19
+ and the native compiler under a separate alias:
20
+
21
+ ```bash
22
+ pnpm add -D typescript@npm:@typescript/typescript6@^6.0.2 @typescript/native@npm:typescript@^7.0.2
23
+ ```
24
+
25
+ The native compiler still provides `tsc`; the compatibility package provides
26
+ `tsc6`. In this workspace, dependency extensions and scoped peer-removal overrides
27
+ instead supply the compatibility package to compiler API consumers while direct
28
+ `typescript` dependencies remain on version 7.
29
+
30
+ If you use Biome:
31
+
32
+ ```bash
33
+ pnpm add -D @kivacore/rules @biomejs/biome
34
+ ```
35
+
36
+ ---
37
+
38
+ ## ESLint
39
+
40
+ This package uses a **composition** approach. Each config is an independent layer — you combine the ones that fit your project.
41
+
42
+ ### Configs
43
+
44
+ | Config | Contents |
45
+ |--------|--------|
46
+ | `baseConfig` | TypeScript parser, @stylistic, import ordering, unused imports, general rules |
47
+ | `reactConfig` | React, React Hooks rules |
48
+ | `nextjsConfig` | Next.js recommended + core-web-vitals, React Refresh |
49
+ | `expoConfig` | Expo, React Native rules |
50
+ | `aiConfig` | Vercel AI SDK security rules (OWASP Agentic Top 10) |
51
+
52
+ ### Usage
53
+
54
+ All configs can be imported from a single entry point:
55
+
56
+ ```js
57
+ import { baseConfig, reactConfig, nextjsConfig, expoConfig, aiConfig } from '@kivacore/rules/eslint';
58
+ ```
59
+
60
+ Or individually:
61
+
62
+ ```js
63
+ import { baseConfig } from '@kivacore/rules/eslint/base';
64
+ import { reactConfig } from '@kivacore/rules/eslint/react';
65
+ ```
66
+
67
+ ---
68
+
69
+ ### React Project
70
+
71
+ ```js
72
+ // eslint.config.mjs
73
+ import { baseConfig, reactConfig } from '@kivacore/rules/eslint';
74
+
75
+ export default [...baseConfig, ...reactConfig];
76
+ ```
77
+
78
+ ### Next.js Project
79
+
80
+ ```js
81
+ // eslint.config.mjs
82
+ import { baseConfig, reactConfig, nextjsConfig } from '@kivacore/rules/eslint';
83
+
84
+ export default [...baseConfig, ...reactConfig, ...nextjsConfig];
85
+ ```
86
+
87
+ ### Next.js + AI Project
88
+
89
+ ```js
90
+ // eslint.config.mjs
91
+ import { baseConfig, reactConfig, nextjsConfig, aiConfig } from '@kivacore/rules/eslint';
92
+
93
+ export default [...baseConfig, ...reactConfig, ...nextjsConfig, ...aiConfig];
94
+ ```
95
+
96
+ ### Expo / React Native Project
97
+
98
+ ```js
99
+ // eslint.config.mjs
100
+ import { baseConfig, reactConfig, expoConfig } from '@kivacore/rules/eslint';
101
+
102
+ export default [
103
+ ...baseConfig,
104
+ ...reactConfig,
105
+ ...expoConfig,
106
+ {
107
+ settings: {
108
+ 'import-x/resolver': {
109
+ typescript: {
110
+ project: ['apps/*/tsconfig.json', 'packages/*/tsconfig.json']
111
+ }
112
+ }
113
+ }
114
+ }
115
+ ];
116
+ ```
117
+
118
+ ### Plain TypeScript Project
119
+
120
+ ```js
121
+ // eslint.config.mjs
122
+ import { baseConfig } from '@kivacore/rules/eslint';
123
+
124
+ export default [...baseConfig];
125
+ ```
126
+
127
+ ### Project-Specific Overrides
128
+
129
+ You can add your own rules on top of any config:
130
+
131
+ ```js
132
+ // eslint.config.mjs
133
+ import { baseConfig, reactConfig } from '@kivacore/rules/eslint';
134
+
135
+ export default [
136
+ ...baseConfig,
137
+ ...reactConfig,
138
+ {
139
+ rules: {
140
+ 'no-console': 'off',
141
+ 'react/no-array-index-key': 'off'
142
+ }
143
+ }
144
+ ];
145
+ ```
146
+
147
+ ---
148
+
149
+ ## Biome
150
+
151
+ Biome configs are used via `extends`. Choose the preset that matches your project.
152
+
153
+ ### Configs
154
+
155
+ | Config | Contents |
156
+ |--------|--------|
157
+ | `@kivacore/rules/biome/base` | Space indentation, single quotes, recommended rules |
158
+ | `@kivacore/rules/biome/cloudflare` | Tab indentation, strict rules (MCP/Workers projects) |
159
+ | `@kivacore/rules/biome/react` | Base + React ignores |
160
+ | `@kivacore/rules/biome/nextjs` | Base + Next.js ignores (.next, .open-next) |
161
+
162
+ ### Usage
163
+
164
+ ```json
165
+ // biome.json
166
+ {
167
+ "extends": ["@kivacore/rules/biome/base"]
168
+ }
169
+ ```
170
+
171
+ ### Cloudflare Workers / MCP Project
172
+
173
+ ```json
174
+ // biome.json
175
+ {
176
+ "extends": ["@kivacore/rules/biome/cloudflare"]
177
+ }
178
+ ```
179
+
180
+ ### Next.js Project (Biome)
181
+
182
+ ```json
183
+ // biome.json
184
+ {
185
+ "extends": ["@kivacore/rules/biome/nextjs"]
186
+ }
187
+ ```
188
+
189
+ ### Override
190
+
191
+ ```json
192
+ // biome.json
193
+ {
194
+ "extends": ["@kivacore/rules/biome/base"],
195
+ "linter": {
196
+ "rules": {
197
+ "suspicious": {
198
+ "noExplicitAny": "off"
199
+ }
200
+ }
201
+ }
202
+ }
203
+ ```
204
+
205
+ ---
206
+
207
+ ## Which Config For Which Project?
208
+
209
+ | Project Type | ESLint Configs | Biome Config |
210
+ |------------|-------------------|--------------|
211
+ | React (Vite, CRA) | `baseConfig` + `reactConfig` | `biome/react` |
212
+ | Next.js | `baseConfig` + `reactConfig` + `nextjsConfig` | `biome/nextjs` |
213
+ | Next.js + AI | `baseConfig` + `reactConfig` + `nextjsConfig` + `aiConfig` | `biome/nextjs` |
214
+ | Expo / React Native | `baseConfig` + `reactConfig` + `expoConfig` | — |
215
+ | Node.js / TypeScript | `baseConfig` | `biome/base` |
216
+ | Cloudflare Workers / MCP | — | `biome/cloudflare` |
217
+
218
+ ---
219
+
220
+ ## Included Plugins
221
+
222
+ The ESLint configs bring all required plugins as dependencies. You don’t need to install them separately.
223
+
224
+ | Plugin | Config |
225
+ |--------|--------|
226
+ | `@stylistic/eslint-plugin` | base |
227
+ | `@typescript-eslint/eslint-plugin` | base |
228
+ | `@typescript-eslint/parser` | base |
229
+ | `eslint-plugin-import-x` | base |
230
+ | `eslint-plugin-unused-imports` | base |
231
+ | `eslint-plugin-react` | react |
232
+ | `eslint-plugin-react-hooks` | react |
233
+ | `@next/eslint-plugin-next` | nextjs |
234
+ | `eslint-config-expo` | expo |
235
+ | `eslint-plugin-react-native` | expo |
236
+ | `eslint-plugin-vercel-ai-security` | ai |
@@ -0,0 +1,28 @@
1
+ {
2
+ "$schema": "https://biomejs.dev/schemas/2.3.14/schema.json",
3
+ "organizeImports": {
4
+ "enabled": true
5
+ },
6
+ "linter": {
7
+ "enabled": true,
8
+ "rules": {
9
+ "recommended": true
10
+ }
11
+ },
12
+ "formatter": {
13
+ "enabled": true,
14
+ "indentStyle": "space",
15
+ "indentWidth": 2,
16
+ "lineWidth": 100
17
+ },
18
+ "javascript": {
19
+ "formatter": {
20
+ "quoteStyle": "single",
21
+ "semicolons": "always",
22
+ "trailingCommas": "es5"
23
+ }
24
+ },
25
+ "files": {
26
+ "ignore": [ "dist", "node_modules", ".astro", "**/*.astro" ]
27
+ }
28
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "$schema": "https://biomejs.dev/schemas/2.3.14/schema.json",
3
+ "root": true,
4
+ "vcs": {
5
+ "enabled": true,
6
+ "clientKind": "git",
7
+ "useIgnoreFile": true
8
+ },
9
+ "files": {
10
+ "ignore": [ "dist", "node_modules", "build", "coverage", ".history" ]
11
+ },
12
+ "formatter": {
13
+ "enabled": true,
14
+ "indentStyle": "space",
15
+ "indentWidth": 2,
16
+ "lineWidth": 100
17
+ },
18
+ "javascript": {
19
+ "formatter": {
20
+ "quoteStyle": "single",
21
+ "semicolons": "always",
22
+ "trailingCommas": "es5"
23
+ }
24
+ },
25
+ "organizeImports": {
26
+ "enabled": true
27
+ },
28
+ "linter": {
29
+ "enabled": true,
30
+ "rules": {
31
+ "recommended": true
32
+ }
33
+ }
34
+ }
@@ -0,0 +1,69 @@
1
+ {
2
+ "$schema": "https://biomejs.dev/schemas/2.3.14/schema.json",
3
+ "root": true,
4
+ "vcs": {
5
+ "enabled": true,
6
+ "clientKind": "git",
7
+ "useIgnoreFile": true
8
+ },
9
+ "files": {
10
+ "includes": [ "src/**/*" ]
11
+ },
12
+ "formatter": {
13
+ "enabled": true,
14
+ "indentStyle": "tab",
15
+ "indentWidth": 2,
16
+ "lineWidth": 100
17
+ },
18
+ "javascript": {
19
+ "formatter": {
20
+ "quoteStyle": "single",
21
+ "semicolons": "always",
22
+ "trailingCommas": "es5"
23
+ }
24
+ },
25
+ "organizeImports": {
26
+ "enabled": true
27
+ },
28
+ "assist": {
29
+ "enabled": true,
30
+ "actions": {
31
+ "source": {
32
+ "useSortedKeys": "off"
33
+ }
34
+ }
35
+ },
36
+ "linter": {
37
+ "enabled": true,
38
+ "rules": {
39
+ "recommended": true,
40
+ "correctness": {
41
+ "noUnusedVariables": "error",
42
+ "noUnusedImports": "error",
43
+ "noUnreachable": "error",
44
+ "noVoidTypeReturn": "error"
45
+ },
46
+ "nursery": {
47
+ "noDeprecatedImports": "error"
48
+ },
49
+ "style": {
50
+ "noInferrableTypes": "error",
51
+ "noNonNullAssertion": "off",
52
+ "noParameterAssign": "error",
53
+ "noUnusedTemplateLiteral": "error",
54
+ "noUselessElse": "error",
55
+ "useAsConstAssertion": "error",
56
+ "useDefaultParameterLast": "error",
57
+ "useEnumInitializers": "error",
58
+ "useNumberNamespace": "error",
59
+ "useSelfClosingElements": "error",
60
+ "useSingleVarDeclarator": "error"
61
+ },
62
+ "suspicious": {
63
+ "noConfusingVoidType": "off",
64
+ "noDebugger": "off",
65
+ "noExplicitAny": "off"
66
+ }
67
+ }
68
+ }
69
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "$schema": "https://biomejs.dev/schemas/1.9.0/schema.json",
3
+ "organizeImports": {
4
+ "enabled": true
5
+ },
6
+ "linter": {
7
+ "enabled": true,
8
+ "rules": {
9
+ "recommended": true
10
+ }
11
+ },
12
+ "formatter": {
13
+ "enabled": true,
14
+ "indentStyle": "space",
15
+ "indentWidth": 2,
16
+ "lineWidth": 100
17
+ },
18
+ "javascript": {
19
+ "formatter": {
20
+ "quoteStyle": "single",
21
+ "semicolons": "always",
22
+ "trailingCommas": "es5"
23
+ }
24
+ },
25
+ "files": {
26
+ "ignore": [ "dist", "dist-electron", "release", "out", "node_modules" ]
27
+ }
28
+ }
@@ -0,0 +1,41 @@
1
+ {
2
+ "$schema": "https://biomejs.dev/schemas/2.3.14/schema.json",
3
+ "root": true,
4
+ "vcs": {
5
+ "enabled": true,
6
+ "clientKind": "git",
7
+ "useIgnoreFile": true
8
+ },
9
+ "files": {
10
+ "ignore": [ "dist", "node_modules", "build", "coverage", ".history", ".next", ".open-next" ]
11
+ },
12
+ "formatter": {
13
+ "enabled": true,
14
+ "indentStyle": "space",
15
+ "indentWidth": 2,
16
+ "lineWidth": 100
17
+ },
18
+ "javascript": {
19
+ "formatter": {
20
+ "quoteStyle": "single",
21
+ "semicolons": "always",
22
+ "trailingCommas": "es5"
23
+ }
24
+ },
25
+ "organizeImports": {
26
+ "enabled": true
27
+ },
28
+ "linter": {
29
+ "enabled": true,
30
+ "rules": {
31
+ "recommended": true,
32
+ "correctness": {
33
+ "noUnusedVariables": "error",
34
+ "noUnusedImports": "error"
35
+ },
36
+ "style": {
37
+ "useSelfClosingElements": "error"
38
+ }
39
+ }
40
+ }
41
+ }
@@ -0,0 +1,41 @@
1
+ {
2
+ "$schema": "https://biomejs.dev/schemas/2.3.14/schema.json",
3
+ "root": true,
4
+ "vcs": {
5
+ "enabled": true,
6
+ "clientKind": "git",
7
+ "useIgnoreFile": true
8
+ },
9
+ "files": {
10
+ "ignore": [ "dist", "node_modules", "build", "coverage", ".history" ]
11
+ },
12
+ "formatter": {
13
+ "enabled": true,
14
+ "indentStyle": "space",
15
+ "indentWidth": 2,
16
+ "lineWidth": 100
17
+ },
18
+ "javascript": {
19
+ "formatter": {
20
+ "quoteStyle": "single",
21
+ "semicolons": "always",
22
+ "trailingCommas": "es5"
23
+ }
24
+ },
25
+ "organizeImports": {
26
+ "enabled": true
27
+ },
28
+ "linter": {
29
+ "enabled": true,
30
+ "rules": {
31
+ "recommended": true,
32
+ "correctness": {
33
+ "noUnusedVariables": "error",
34
+ "noUnusedImports": "error"
35
+ },
36
+ "style": {
37
+ "useSelfClosingElements": "error"
38
+ }
39
+ }
40
+ }
41
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "$schema": "https://biomejs.dev/schemas/2.3.14/schema.json",
3
+ "organizeImports": {
4
+ "enabled": true
5
+ },
6
+ "linter": {
7
+ "enabled": true,
8
+ "rules": {
9
+ "recommended": true
10
+ }
11
+ },
12
+ "formatter": {
13
+ "enabled": true,
14
+ "indentStyle": "space",
15
+ "indentWidth": 2,
16
+ "lineWidth": 100
17
+ },
18
+ "javascript": {
19
+ "formatter": {
20
+ "quoteStyle": "single",
21
+ "semicolons": "always",
22
+ "trailingCommas": "es5"
23
+ }
24
+ },
25
+ "files": {
26
+ "ignore": [ "dist", "node_modules", "**/*.vue" ]
27
+ }
28
+ }
@@ -0,0 +1,3 @@
1
+ import { type Linter } from 'eslint';
2
+ export declare const aiConfig: Linter.Config[];
3
+ //# sourceMappingURL=ai.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai.d.ts","sourceRoot":"","sources":["../../src/eslint/ai.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIlD,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAWnC,CAAC"}
@@ -0,0 +1,13 @@
1
+ import vercelAiPlugin from 'eslint-plugin-vercel-ai-security';
2
+ export const aiConfig = [
3
+ {
4
+ files: ['**/*.{ts,tsx,js,jsx}'],
5
+ plugins: {
6
+ 'vercel-ai-security': vercelAiPlugin.plugin
7
+ },
8
+ rules: {
9
+ // ─── Vercel AI Security (recommended) ───
10
+ ...vercelAiPlugin.configs.recommended.rules
11
+ }
12
+ }
13
+ ];
@@ -0,0 +1,3 @@
1
+ import { type Linter } from 'eslint';
2
+ export declare const astroConfig: Linter.Config[];
3
+ //# sourceMappingURL=astro.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"astro.d.ts","sourceRoot":"","sources":["../../src/eslint/astro.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIrC,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAA4D,CAAC"}
@@ -0,0 +1,2 @@
1
+ import astroPlugin from 'eslint-plugin-astro';
2
+ export const astroConfig = [...astroPlugin.configs.recommended];
@@ -0,0 +1,3 @@
1
+ import { type Linter } from 'eslint';
2
+ export declare const baseConfig: Linter.Config[];
3
+ //# sourceMappingURL=base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/eslint/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAC;AAqBlD,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EA0WrC,CAAC"}