@mkaradeniz/eslint-config 5.4.0 → 5.6.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.
- package/base.mjs +1 -1
- package/package.json +1 -1
- package/react.mjs +9 -0
- package/rules/reactRules.mjs +12 -28
package/base.mjs
CHANGED
|
@@ -134,7 +134,7 @@ export const baseConfig = [
|
|
|
134
134
|
},
|
|
135
135
|
},
|
|
136
136
|
{
|
|
137
|
-
files: ['**/env.ts', '**/env.client.ts', '**/env.server.ts', '**/seed.ts', '**/prisma.config.ts'],
|
|
137
|
+
files: ['**/env.ts', '**/env.client.ts', '**/env.server.ts', '**/prisma/**/seed.ts', '**/prisma.config.ts'],
|
|
138
138
|
rules: {
|
|
139
139
|
'no-restricted-syntax': [
|
|
140
140
|
'warn',
|
package/package.json
CHANGED
package/react.mjs
CHANGED
|
@@ -29,4 +29,13 @@ export const reactConfig = [
|
|
|
29
29
|
},
|
|
30
30
|
|
|
31
31
|
{ ...reactRules },
|
|
32
|
+
{
|
|
33
|
+
files: ['**/env.ts', '**/env.client.ts', '**/env.server.ts', '**/prisma/**/seed.ts', '**/prisma.config.ts'],
|
|
34
|
+
rules: {
|
|
35
|
+
'no-restricted-syntax': [
|
|
36
|
+
'warn',
|
|
37
|
+
...reactRules.rules['no-restricted-syntax'].slice(1).filter(selector => !selector.selector.includes('process')),
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
},
|
|
32
41
|
];
|
package/rules/reactRules.mjs
CHANGED
|
@@ -8,34 +8,6 @@ export const reactRules = {
|
|
|
8
8
|
'no-restricted-imports': [
|
|
9
9
|
'warn',
|
|
10
10
|
{
|
|
11
|
-
paths: [
|
|
12
|
-
{
|
|
13
|
-
importNames: [
|
|
14
|
-
'createContext',
|
|
15
|
-
'forwardRef',
|
|
16
|
-
'startTransition',
|
|
17
|
-
'use',
|
|
18
|
-
'useCallback',
|
|
19
|
-
'useContext',
|
|
20
|
-
'useDebugValue',
|
|
21
|
-
'useDeferredValue',
|
|
22
|
-
'useEffect',
|
|
23
|
-
'useId',
|
|
24
|
-
'useImperativeHandle',
|
|
25
|
-
'useInsertionEffect',
|
|
26
|
-
'useLayoutEffect',
|
|
27
|
-
'useMemo',
|
|
28
|
-
'useReducer',
|
|
29
|
-
'useRef',
|
|
30
|
-
'useState',
|
|
31
|
-
'useSyncExternalStore',
|
|
32
|
-
'useTransition',
|
|
33
|
-
],
|
|
34
|
-
message:
|
|
35
|
-
"React built-in hooks & functions should not be imported directly. `import React from 'react'` and then use `React.useBuiltInHook()` || `React.function()`.",
|
|
36
|
-
name: 'react',
|
|
37
|
-
},
|
|
38
|
-
],
|
|
39
11
|
patterns: [
|
|
40
12
|
{
|
|
41
13
|
allowImportNamePattern: 'Icon$',
|
|
@@ -48,6 +20,18 @@ export const reactRules = {
|
|
|
48
20
|
'no-restricted-syntax': [
|
|
49
21
|
baseNoRestrictedSyntaxSeverity,
|
|
50
22
|
...baseNoRestrictedSyntaxSelectors,
|
|
23
|
+
{
|
|
24
|
+
message: "Use named imports instead of `import React from 'react'`. Use `import { useState } from 'react'`.",
|
|
25
|
+
selector: "ImportDeclaration[source.value='react'] ImportDefaultSpecifier",
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
message: "Use named imports instead of `import * as React from 'react'`. Use `import { useState } from 'react'`.",
|
|
29
|
+
selector: "ImportDeclaration[source.value='react'] ImportNamespaceSpecifier",
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
message: "Use named imports instead of `React.method()`. Use `import { useState } from 'react'`.",
|
|
33
|
+
selector: "MemberExpression[object.name='React']",
|
|
34
|
+
},
|
|
51
35
|
{
|
|
52
36
|
message: 'Use the cn() utility instead of template literals for className.',
|
|
53
37
|
selector: "JSXAttribute[name.name='className'] > JSXExpressionContainer > TemplateLiteral",
|