@kivacore/rules 0.0.0 → 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 +234 -1
  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 +96 -3
@@ -0,0 +1,368 @@
1
+ import eslintParser from '@typescript-eslint/parser';
2
+ import typescriptPlugin from '@typescript-eslint/eslint-plugin';
3
+ import stylisticPlugin from '@stylistic/eslint-plugin';
4
+ import unusedPlugin from 'eslint-plugin-unused-imports';
5
+ import importXPlugin from 'eslint-plugin-import-x';
6
+ import globals from 'globals';
7
+ const customized = stylisticPlugin.configs.customize({
8
+ indent: 2,
9
+ quotes: 'single',
10
+ semi: true,
11
+ jsx: true,
12
+ arrowParens: true,
13
+ braceStyle: '1tbs',
14
+ blockSpacing: true,
15
+ quoteProps: 'as-needed',
16
+ commaDangle: 'always-multiline'
17
+ });
18
+ export const baseConfig = [
19
+ {
20
+ ignores: [
21
+ '**/dist/**',
22
+ '**/node_modules/**',
23
+ '**/*.d.ts',
24
+ '**/build/**',
25
+ '**/coverage/**',
26
+ '**/.history/**',
27
+ '**/.turbo/**',
28
+ '**/scripts/**'
29
+ ]
30
+ },
31
+ {
32
+ files: ['**/*.{ts,tsx,mjs,js,jsx}'],
33
+ languageOptions: {
34
+ parser: eslintParser,
35
+ parserOptions: {
36
+ ecmaVersion: 'latest',
37
+ sourceType: 'module',
38
+ ecmaFeatures: {
39
+ jsx: true
40
+ }
41
+ },
42
+ globals: {
43
+ ...globals.browser,
44
+ __DEV__: 'readonly'
45
+ }
46
+ },
47
+ plugins: {
48
+ '@stylistic': stylisticPlugin,
49
+ '@typescript-eslint': typescriptPlugin,
50
+ 'unused-imports': unusedPlugin,
51
+ 'import-x': importXPlugin
52
+ },
53
+ settings: {
54
+ 'import-x/extensions': [
55
+ '.js',
56
+ '.jsx',
57
+ '.ts',
58
+ '.tsx',
59
+ '.mjs',
60
+ '.mts',
61
+ '.cts',
62
+ '.cjs'
63
+ ],
64
+ 'import-x/resolver': {
65
+ node: {
66
+ extensions: [
67
+ '.js',
68
+ '.jsx',
69
+ '.ts',
70
+ '.tsx',
71
+ '.mjs',
72
+ '.mts',
73
+ '.cts',
74
+ '.cjs'
75
+ ]
76
+ }
77
+ }
78
+ },
79
+ rules: {
80
+ // ─── Stylistic (base from customize) ───
81
+ ...customized.rules,
82
+ // ─── Disable eslint-plugin-import rules (we use import-x in baseConfig) ───
83
+ 'import/no-unresolved': 'off',
84
+ 'import/named': 'off',
85
+ 'import/namespace': 'off',
86
+ 'import/default': 'off',
87
+ 'import/export': 'off',
88
+ 'import/no-named-as-default': 'off',
89
+ 'import/no-named-as-default-member': 'off',
90
+ 'import/no-duplicates': 'off',
91
+ 'import/first': 'off',
92
+ 'import/order': 'off',
93
+ // ─── Stylistic overrides ───
94
+ '@stylistic/indent': [
95
+ 'error',
96
+ 2,
97
+ {
98
+ SwitchCase: 1,
99
+ VariableDeclarator: 'first',
100
+ FunctionDeclaration: { parameters: 'first' },
101
+ FunctionExpression: { parameters: 'first' },
102
+ CallExpression: { arguments: 'first' },
103
+ StaticBlock: { body: 1 },
104
+ MemberExpression: 1,
105
+ outerIIFEBody: 0,
106
+ ArrayExpression: 1,
107
+ ObjectExpression: 1,
108
+ offsetTernaryExpressions: true
109
+ }
110
+ ],
111
+ '@stylistic/comma-dangle': ['error', 'never'],
112
+ '@stylistic/lines-between-class-members': [
113
+ 'error',
114
+ 'always',
115
+ { exceptAfterSingleLine: false }
116
+ ],
117
+ '@stylistic/jsx-closing-bracket-location': ['error', 'after-props'],
118
+ '@stylistic/jsx-indent-props': ['error', 2],
119
+ '@stylistic/jsx-quotes': ['error', 'prefer-double'],
120
+ '@stylistic/jsx-closing-tag-location': 'error',
121
+ '@stylistic/jsx-curly-brace-presence': ['error', { props: 'never', children: 'never' }],
122
+ '@stylistic/jsx-curly-spacing': ['error', { when: 'never', children: true }],
123
+ '@stylistic/jsx-equals-spacing': ['error', 'never'],
124
+ '@stylistic/jsx-first-prop-new-line': ['error', 'multiline-multiprop'],
125
+ '@stylistic/jsx-max-props-per-line': ['error', { maximum: 1, when: 'multiline' }],
126
+ '@stylistic/jsx-newline': 'off',
127
+ '@stylistic/jsx-one-expression-per-line': 'off',
128
+ '@stylistic/jsx-self-closing-comp': ['error', { component: true, html: true }],
129
+ '@stylistic/jsx-sort-props': 'off',
130
+ '@stylistic/jsx-tag-spacing': [
131
+ 'error',
132
+ {
133
+ closingSlash: 'never',
134
+ beforeSelfClosing: 'always',
135
+ afterOpening: 'never',
136
+ beforeClosing: 'never'
137
+ }
138
+ ],
139
+ '@stylistic/jsx-wrap-multilines': 'off',
140
+ '@stylistic/jsx-curly-newline': ['error', { multiline: 'consistent', singleline: 'forbid' }],
141
+ '@stylistic/no-multi-spaces': [
142
+ 'error',
143
+ {
144
+ ignoreEOLComments: false,
145
+ includeTabs: true,
146
+ exceptions: {
147
+ Property: true,
148
+ BinaryExpression: true,
149
+ VariableDeclarator: false,
150
+ ImportDeclaration: false
151
+ }
152
+ }
153
+ ],
154
+ '@stylistic/linebreak-style': ['error', 'unix'],
155
+ '@stylistic/max-len': [
156
+ 'error',
157
+ {
158
+ code: 200,
159
+ tabWidth: 2,
160
+ ignoreUrls: true,
161
+ ignoreComments: true,
162
+ ignoreRegExpLiterals: true,
163
+ ignoreStrings: true,
164
+ ignoreTemplateLiterals: true
165
+ }
166
+ ],
167
+ '@stylistic/member-delimiter-style': [
168
+ 'error',
169
+ {
170
+ multiline: { delimiter: 'semi', requireLast: true },
171
+ singleline: { delimiter: 'semi', requireLast: false }
172
+ }
173
+ ],
174
+ '@stylistic/no-multiple-empty-lines': ['error', { max: 1, maxEOF: 0 }],
175
+ '@stylistic/no-trailing-spaces': 'error',
176
+ '@stylistic/padding-line-between-statements': [
177
+ 'error',
178
+ { blankLine: 'always', prev: '*', next: 'return' },
179
+ { blankLine: 'always', prev: [
180
+ 'const',
181
+ 'let',
182
+ 'var'
183
+ ], next: '*' },
184
+ { blankLine: 'any', prev: [
185
+ 'const',
186
+ 'let',
187
+ 'var'
188
+ ], next: [
189
+ 'const',
190
+ 'let',
191
+ 'var'
192
+ ] },
193
+ { blankLine: 'always', prev: 'directive', next: '*' },
194
+ { blankLine: 'any', prev: 'directive', next: 'directive' },
195
+ { blankLine: 'always', prev: ['case', 'default'], next: '*' }
196
+ ],
197
+ '@stylistic/array-bracket-newline': ['error', { multiline: true, minItems: 4 }],
198
+ '@stylistic/array-bracket-spacing': [
199
+ 'error',
200
+ 'never',
201
+ { singleValue: false, arraysInArrays: false, objectsInArrays: false }
202
+ ],
203
+ '@stylistic/array-element-newline': ['error', { consistent: false, multiline: true, minItems: 4 }],
204
+ '@stylistic/arrow-parens': [
205
+ 'error',
206
+ 'as-needed',
207
+ { requireForBlockBody: true }
208
+ ],
209
+ '@stylistic/block-spacing': 'error',
210
+ '@stylistic/brace-style': [
211
+ 'error',
212
+ '1tbs',
213
+ { allowSingleLine: true }
214
+ ],
215
+ '@stylistic/comma-spacing': ['error', { before: false, after: true }],
216
+ '@stylistic/comma-style': ['error', 'last'],
217
+ '@stylistic/computed-property-spacing': ['error', 'never'],
218
+ '@stylistic/function-call-spacing': ['error', 'never'],
219
+ '@stylistic/function-paren-newline': ['error', 'multiline-arguments'],
220
+ '@stylistic/implicit-arrow-linebreak': ['error', 'beside'],
221
+ '@stylistic/quote-props': ['error', 'as-needed'],
222
+ '@stylistic/quotes': [
223
+ 'error',
224
+ 'single',
225
+ { avoidEscape: true, allowTemplateLiterals: 'always' }
226
+ ],
227
+ '@stylistic/semi': ['error', 'always'],
228
+ '@stylistic/semi-spacing': ['error', { before: false, after: true }],
229
+ '@stylistic/object-curly-newline': ['error', { consistent: true, minProperties: 4 }],
230
+ '@stylistic/object-curly-spacing': [
231
+ 'error',
232
+ 'always',
233
+ { objectsInObjects: true, arraysInObjects: true }
234
+ ],
235
+ '@stylistic/space-before-blocks': 'error',
236
+ '@stylistic/multiline-ternary': ['error', 'never'],
237
+ '@stylistic/multiline-comment-style': ['error', 'starred-block'],
238
+ '@stylistic/space-before-function-paren': [
239
+ 'error',
240
+ {
241
+ anonymous: 'always',
242
+ named: 'never',
243
+ asyncArrow: 'always'
244
+ }
245
+ ],
246
+ '@stylistic/space-in-parens': ['error', 'never'],
247
+ '@stylistic/space-infix-ops': 'error',
248
+ '@stylistic/space-unary-ops': ['error', { words: true, nonwords: false }],
249
+ '@stylistic/template-curly-spacing': 'error',
250
+ '@stylistic/arrow-spacing': ['error', { before: true, after: true }],
251
+ '@stylistic/type-annotation-spacing': 'error',
252
+ '@stylistic/eol-last': ['error', 'always'],
253
+ '@stylistic/key-spacing': ['error', { beforeColon: false }],
254
+ '@stylistic/jsx-pascal-case': 'error',
255
+ '@stylistic/jsx-function-call-newline': ['error', 'multiline'],
256
+ // ─── TypeScript rules ───
257
+ '@typescript-eslint/no-non-null-assertion': 'warn',
258
+ '@typescript-eslint/no-empty-interface': 'warn',
259
+ '@typescript-eslint/ban-ts-comment': 'warn',
260
+ '@typescript-eslint/consistent-type-imports': [
261
+ 'error',
262
+ {
263
+ prefer: 'type-imports',
264
+ disallowTypeAnnotations: true
265
+ }
266
+ ],
267
+ '@typescript-eslint/no-unused-vars': [
268
+ 'error',
269
+ {
270
+ vars: 'all',
271
+ varsIgnorePattern: '^_',
272
+ args: 'after-used',
273
+ argsIgnorePattern: '^_',
274
+ caughtErrorsIgnorePattern: '^_',
275
+ ignoreRestSiblings: true
276
+ }
277
+ ],
278
+ // ─── Unused imports ───
279
+ 'unused-imports/no-unused-imports': 'error',
280
+ 'unused-imports/no-unused-vars': [
281
+ 'error',
282
+ {
283
+ vars: 'all',
284
+ varsIgnorePattern: '^_|^T[A-Z]',
285
+ args: 'after-used',
286
+ argsIgnorePattern: '^_',
287
+ caughtErrorsIgnorePattern: '^_'
288
+ }
289
+ ],
290
+ // ─── Import ordering ───
291
+ 'import-x/order': [
292
+ 'error',
293
+ {
294
+ groups: [
295
+ 'type',
296
+ 'builtin',
297
+ 'external',
298
+ 'internal',
299
+ ['sibling', 'parent']
300
+ ],
301
+ 'newlines-between': 'always-and-inside-groups',
302
+ pathGroups: [{ pattern: 'react', group: 'type', position: 'before' }, { pattern: 'react', group: 'builtin', position: 'before' }],
303
+ pathGroupsExcludedImportTypes: ['react']
304
+ }
305
+ ],
306
+ 'import-x/consistent-type-specifier-style': ['error', 'prefer-inline'],
307
+ 'import-x/no-duplicates': ['error', { 'prefer-inline': true }],
308
+ 'import-x/no-anonymous-default-export': [
309
+ 'error',
310
+ {
311
+ allowAnonymousClass: false,
312
+ allowAnonymousFunction: true,
313
+ allowArray: true,
314
+ allowArrowFunction: true,
315
+ allowCallExpression: true,
316
+ allowLiteral: false,
317
+ allowObject: true
318
+ }
319
+ ],
320
+ 'import-x/no-dynamic-require': 'error',
321
+ 'import-x/prefer-default-export': 'off',
322
+ // ─── General rules ───
323
+ 'no-console': ['warn', { allow: ['warn', 'info'] }],
324
+ 'no-debugger': 'error',
325
+ 'no-alert': 'error',
326
+ 'prefer-const': 'error',
327
+ 'no-var': 'error',
328
+ 'object-shorthand': 'error',
329
+ 'prefer-template': 'error',
330
+ 'prefer-destructuring': ['error', { object: true, array: false }],
331
+ 'prefer-rest-params': 'error',
332
+ 'prefer-spread': 'error',
333
+ 'prefer-arrow-callback': 'error',
334
+ 'arrow-body-style': 'off',
335
+ 'no-duplicate-imports': ['error', { allowSeparateTypeImports: true }],
336
+ 'no-useless-constructor': 'error',
337
+ 'no-useless-rename': 'error',
338
+ 'no-iterator': 'error',
339
+ 'no-restricted-syntax': [
340
+ 'error',
341
+ {
342
+ selector: 'ForInStatement',
343
+ message: 'for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.'
344
+ },
345
+ {
346
+ selector: 'WithStatement',
347
+ message: '`with` is disallowed in strict mode because it makes code impossible to predict and optimize.'
348
+ },
349
+ {
350
+ selector: 'CallExpression[callee.object.name=\'React\'][callee.property.name=/^use/]',
351
+ message: 'Use named imports: `import { useCallback } from \'react\'` not `React.useCallback()`.'
352
+ },
353
+ {
354
+ selector: 'CallExpression[callee.object.name=\'React\'][callee.property.name=/^(memo|forwardRef|createContext|lazy|startTransition)$/]',
355
+ message: 'Use named imports: `import { memo } from \'react\'` not `React.memo()`.'
356
+ },
357
+ {
358
+ selector: 'TSTypeReference > TSQualifiedName[left.name=\'React\']',
359
+ message: 'Use named imports: `import { type ReactNode } from \'react\'` not `React.ReactNode`.'
360
+ },
361
+ {
362
+ selector: 'MemberExpression[object.name=\'React\']',
363
+ message: 'Use named imports from \'react\' instead of `React.*` namespace access.'
364
+ }
365
+ ]
366
+ }
367
+ }
368
+ ];
@@ -0,0 +1,3 @@
1
+ import { type Linter } from 'eslint';
2
+ export declare const electronConfig: Linter.Config[];
3
+ //# sourceMappingURL=electron.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"electron.d.ts","sourceRoot":"","sources":["../../src/eslint/electron.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAC;AAKlD,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAyCzC,CAAC"}
@@ -0,0 +1,44 @@
1
+ import nodePlugin from 'eslint-plugin-n';
2
+ import reactHooksPlugin from 'eslint-plugin-react-hooks';
3
+ export const electronConfig = [
4
+ // Main process (Node.js) rules
5
+ {
6
+ files: ['electron/**/*.{ts,js,mjs}'],
7
+ languageOptions: {
8
+ globals: {
9
+ __dirname: 'readonly',
10
+ __filename: 'readonly',
11
+ process: 'readonly',
12
+ Buffer: 'readonly',
13
+ console: 'readonly',
14
+ setTimeout: 'readonly',
15
+ clearTimeout: 'readonly',
16
+ setInterval: 'readonly',
17
+ clearInterval: 'readonly'
18
+ }
19
+ },
20
+ plugins: {
21
+ n: nodePlugin
22
+ },
23
+ rules: {
24
+ 'n/no-missing-import': 'off',
25
+ 'n/no-unsupported-features/es-syntax': 'off'
26
+ }
27
+ },
28
+ // Renderer process (React) rules
29
+ {
30
+ files: ['src/**/*.{ts,tsx,js,jsx}'],
31
+ ignores: [
32
+ '**/dist-electron/**',
33
+ '**/release/**',
34
+ '**/out/**'
35
+ ],
36
+ plugins: {
37
+ 'react-hooks': reactHooksPlugin
38
+ },
39
+ rules: {
40
+ 'react-hooks/rules-of-hooks': 'error',
41
+ 'react-hooks/exhaustive-deps': 'error'
42
+ }
43
+ }
44
+ ];
@@ -0,0 +1,9 @@
1
+ export { baseConfig } from './base.js';
2
+ export { reactConfig } from './react.js';
3
+ export { reactNativeConfig } from './react-native.js';
4
+ export { nextjsConfig } from './nextjs.js';
5
+ export { aiConfig } from './ai.js';
6
+ export { vueConfig } from './vue.js';
7
+ export { astroConfig } from './astro.js';
8
+ export { electronConfig } from './electron.js';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/eslint/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,8 @@
1
+ export { baseConfig } from './base.js';
2
+ export { reactConfig } from './react.js';
3
+ export { reactNativeConfig } from './react-native.js';
4
+ export { nextjsConfig } from './nextjs.js';
5
+ export { aiConfig } from './ai.js';
6
+ export { vueConfig } from './vue.js';
7
+ export { astroConfig } from './astro.js';
8
+ export { electronConfig } from './electron.js';
@@ -0,0 +1,3 @@
1
+ import { type Linter } from 'eslint';
2
+ export declare const nextjsConfig: Linter.Config[];
3
+ //# sourceMappingURL=nextjs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nextjs.d.ts","sourceRoot":"","sources":["../../src/eslint/nextjs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAC;AAMlD,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAwBvC,CAAC"}
@@ -0,0 +1,26 @@
1
+ import nextPlugin from '@next/eslint-plugin-next';
2
+ import { reactConfig } from './react.js';
3
+ export const nextjsConfig = [
4
+ ...reactConfig,
5
+ {
6
+ ignores: [
7
+ '**/.next/**',
8
+ '**/.open-next/**',
9
+ '**/next-env.d.ts',
10
+ '**/src/components/ui/**'
11
+ ]
12
+ },
13
+ {
14
+ files: ['**/*.{ts,tsx,js,jsx}'],
15
+ plugins: {
16
+ '@next/next': nextPlugin
17
+ },
18
+ rules: {
19
+ // ─── Next.js recommended + core-web-vitals ───
20
+ ...nextPlugin.configs.recommended.rules,
21
+ ...nextPlugin.configs['core-web-vitals'].rules,
22
+ // ─── React Refresh ───
23
+ 'react-refresh/only-export-components': ['warn', { allowConstantExport: true }]
24
+ }
25
+ }
26
+ ];
@@ -0,0 +1,3 @@
1
+ import { type Linter } from 'eslint';
2
+ export declare const reactNativeConfig: Linter.Config[];
3
+ //# sourceMappingURL=react-native.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react-native.d.ts","sourceRoot":"","sources":["../../src/eslint/react-native.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAC;AAKlD,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAgB5C,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { reactNativeRules } from './rules/index.js';
2
+ import { reactConfig } from './react.js';
3
+ export const reactNativeConfig = [
4
+ ...reactConfig,
5
+ {
6
+ files: ['**/*.{ts,tsx,js,jsx}'],
7
+ plugins: {
8
+ 'react-native': { rules: reactNativeRules }
9
+ },
10
+ rules: {
11
+ 'react-native/no-unused-styles': 'error',
12
+ 'react-native/split-platform-components': 'warn',
13
+ 'react-native/no-inline-styles': 'off',
14
+ 'react-native/no-color-literals': 'off',
15
+ 'react-native/no-raw-text': 'off',
16
+ 'react-native/no-single-element-style-arrays': 'warn'
17
+ }
18
+ }
19
+ ];
@@ -0,0 +1,3 @@
1
+ import { type Linter } from 'eslint';
2
+ export declare const reactConfig: Linter.Config[];
3
+ //# sourceMappingURL=react.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../src/eslint/react.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAC;AAOlD,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAiBtC,CAAC"}
@@ -0,0 +1,20 @@
1
+ import eslintReact from '@eslint-react/eslint-plugin';
2
+ import reactHooksPlugin from 'eslint-plugin-react-hooks';
3
+ const recommended = eslintReact.configs['recommended-typescript'];
4
+ export const reactConfig = [
5
+ {
6
+ files: ['**/*.{ts,tsx,js,jsx}'],
7
+ ...recommended,
8
+ plugins: {
9
+ ...recommended.plugins,
10
+ 'react-hooks': reactHooksPlugin
11
+ },
12
+ rules: {
13
+ ...recommended.rules,
14
+ // ─── React Hooks rules ───
15
+ 'react-hooks/rules-of-hooks': 'error',
16
+ 'react-hooks/exhaustive-deps': 'error',
17
+ '@eslint-react/dom-no-unsafe-iframe-sandbox': 'off'
18
+ }
19
+ }
20
+ ];
@@ -0,0 +1,3 @@
1
+ import { type Rule } from 'eslint';
2
+ export declare const reactNativeRules: Record<string, Rule.RuleModule>;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/eslint/rules/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,QAAQ,CAAC;AASnC,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,CAO5D,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { noColorLiterals } from './react-native-no-color-literals.js';
2
+ import { noInlineStyles } from './react-native-no-inline-styles.js';
3
+ import { noRawText } from './react-native-no-raw-text.js';
4
+ import { noSingleElementStyleArrays } from './react-native-no-single-element-style-arrays.js';
5
+ import { noUnusedStyles } from './react-native-no-unused-styles.js';
6
+ import { splitPlatformComponents } from './react-native-split-platform-components.js';
7
+ export const reactNativeRules = {
8
+ 'no-unused-styles': noUnusedStyles,
9
+ 'split-platform-components': splitPlatformComponents,
10
+ 'no-inline-styles': noInlineStyles,
11
+ 'no-color-literals': noColorLiterals,
12
+ 'no-raw-text': noRawText,
13
+ 'no-single-element-style-arrays': noSingleElementStyleArrays
14
+ };
@@ -0,0 +1,3 @@
1
+ import { type Rule } from 'eslint';
2
+ export declare const noColorLiterals: Rule.RuleModule;
3
+ //# sourceMappingURL=react-native-no-color-literals.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react-native-no-color-literals.d.ts","sourceRoot":"","sources":["../../../src/eslint/rules/react-native-no-color-literals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,QAAQ,CAAC;AA0BnC,eAAO,MAAM,eAAe,EAAE,IAAI,CAAC,UAqElC,CAAC"}
@@ -0,0 +1,84 @@
1
+ const COLOR_PROPERTIES = new Set([
2
+ 'color',
3
+ 'backgroundColor',
4
+ 'borderColor',
5
+ 'borderTopColor',
6
+ 'borderBottomColor',
7
+ 'borderLeftColor',
8
+ 'borderRightColor',
9
+ 'borderStartColor',
10
+ 'borderEndColor',
11
+ 'shadowColor',
12
+ 'textShadowColor',
13
+ 'textDecorationColor',
14
+ 'tintColor',
15
+ 'overlayColor'
16
+ ]);
17
+ function isColorLiteral(node) {
18
+ if (node.type === 'Literal' && typeof node.value === 'string')
19
+ return true;
20
+ if (node.type === 'TemplateLiteral')
21
+ return true;
22
+ return false;
23
+ }
24
+ export const noColorLiterals = {
25
+ meta: {
26
+ type: 'suggestion',
27
+ docs: {
28
+ description: 'Disallow color literals in style properties, use variables or theme values instead'
29
+ },
30
+ schema: []
31
+ },
32
+ create(context) {
33
+ function checkStyleProperties(node) {
34
+ if (node.type !== 'ObjectExpression')
35
+ return;
36
+ for (const prop of node.properties) {
37
+ if (prop.type === 'Property'
38
+ && prop.key.type === 'Identifier'
39
+ && COLOR_PROPERTIES.has(prop.key.name)
40
+ && isColorLiteral(prop.value)) {
41
+ context.report({
42
+ node: prop.value,
43
+ message: `Color literal used in '${prop.key.name}'. Use a variable or theme value instead`
44
+ });
45
+ }
46
+ }
47
+ }
48
+ return {
49
+ CallExpression(node) {
50
+ if (node.callee.type !== 'MemberExpression'
51
+ || node.callee.object.type !== 'Identifier'
52
+ || node.callee.object.name !== 'StyleSheet'
53
+ || node.callee.property.type !== 'Identifier'
54
+ || node.callee.property.name !== 'create')
55
+ return;
56
+ const arg = node.arguments[0];
57
+ if (arg?.type !== 'ObjectExpression')
58
+ return;
59
+ for (const prop of arg.properties) {
60
+ if (prop.type === 'Property') {
61
+ checkStyleProperties(prop.value);
62
+ }
63
+ }
64
+ },
65
+ JSXAttribute(node) {
66
+ if (node.name?.name !== 'style')
67
+ return;
68
+ const expr = node.value?.expression;
69
+ if (!expr)
70
+ return;
71
+ if (expr.type === 'ObjectExpression') {
72
+ checkStyleProperties(expr);
73
+ }
74
+ if (expr.type === 'ArrayExpression') {
75
+ for (const element of expr.elements) {
76
+ if (element?.type === 'ObjectExpression') {
77
+ checkStyleProperties(element);
78
+ }
79
+ }
80
+ }
81
+ }
82
+ };
83
+ }
84
+ };
@@ -0,0 +1,3 @@
1
+ import { type Rule } from 'eslint';
2
+ export declare const noInlineStyles: Rule.RuleModule;
3
+ //# sourceMappingURL=react-native-no-inline-styles.d.ts.map