@codygo-ai/eslint-config-react 0.1.0-alpha
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/package.json +21 -0
- package/release-notes.md +7 -0
- package/src/index.mjs +48 -0
package/package.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@codygo-ai/eslint-config-react",
|
|
3
|
+
"version": "0.1.0-alpha",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"exports": {
|
|
6
|
+
".": "./src/index.mjs"
|
|
7
|
+
},
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"eslint-plugin-react": "^7.33.0",
|
|
10
|
+
"eslint-plugin-react-refresh": "^0.4.5",
|
|
11
|
+
"@codygo-ai/eslint-config-preact": "^0.1.0-alpha"
|
|
12
|
+
},
|
|
13
|
+
"peerDependencies": {
|
|
14
|
+
"eslint": "^9.0.0",
|
|
15
|
+
"prettier": "^3.0.0",
|
|
16
|
+
"react": "^18.0.0"
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"release": "node ../../../scripts/release.mjs"
|
|
20
|
+
}
|
|
21
|
+
}
|
package/release-notes.md
ADDED
package/src/index.mjs
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import preactConfig from '@codygo-ai/eslint-config-preact';
|
|
2
|
+
import reactPlugin from 'eslint-plugin-react';
|
|
3
|
+
import reactRefreshPlugin from 'eslint-plugin-react-refresh';
|
|
4
|
+
|
|
5
|
+
export default [
|
|
6
|
+
...preactConfig,
|
|
7
|
+
{
|
|
8
|
+
files: ['**/*.{tsx,jsx}'],
|
|
9
|
+
plugins: {
|
|
10
|
+
// Add react-refresh plugin on top of existing plugins from Preact
|
|
11
|
+
'react-refresh': reactRefreshPlugin,
|
|
12
|
+
},
|
|
13
|
+
settings: {
|
|
14
|
+
react: {
|
|
15
|
+
// Override: Remove Preact pragma settings (React uses JSX runtime)
|
|
16
|
+
version: 'detect',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
rules: {
|
|
20
|
+
// Add React-specific JSX runtime rules
|
|
21
|
+
...reactPlugin.configs['jsx-runtime'].rules,
|
|
22
|
+
// Add react-refresh rules
|
|
23
|
+
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
|
|
24
|
+
// Override: Remove Preact's class attribute exception (React uses className)
|
|
25
|
+
'react/no-unknown-property': 'error',
|
|
26
|
+
'no-restricted-imports': [
|
|
27
|
+
'error',
|
|
28
|
+
{
|
|
29
|
+
paths: [
|
|
30
|
+
{
|
|
31
|
+
name: 'react',
|
|
32
|
+
importNames: ['default'],
|
|
33
|
+
message: 'Use selective imports: import { useState } from "react"',
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
'react/prefer-stateless-function': 'error',
|
|
39
|
+
'react/jsx-pascal-case': 'error',
|
|
40
|
+
'react-hooks/rules-of-hooks': 'error',
|
|
41
|
+
'react-hooks/exhaustive-deps': 'warn',
|
|
42
|
+
'react/forbid-dom-props': [
|
|
43
|
+
'warn',
|
|
44
|
+
{ forbid: [{ propName: 'style', message: 'Use CSS classes instead of inline styles' }] },
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
];
|