@mkaradeniz/eslint-config 4.0.9 → 4.0.11
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 +3 -6
- package/package.json +1 -1
- package/rules/nextRules.mjs +0 -52
package/base.mjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { dirname } from 'node:path';
|
|
2
1
|
import { fileURLToPath } from 'node:url';
|
|
3
2
|
import eslintPluginComments from '@eslint-community/eslint-plugin-eslint-comments';
|
|
4
3
|
import { includeIgnoreFile } from '@eslint/compat';
|
|
@@ -24,9 +23,8 @@ try {
|
|
|
24
23
|
// Silently continue without .gitignore
|
|
25
24
|
}
|
|
26
25
|
|
|
27
|
-
//
|
|
28
|
-
|
|
29
|
-
const __dirname = dirname(__filename);
|
|
26
|
+
// Use process.cwd() to get the current working directory where ESLint is being run
|
|
27
|
+
// This ensures tsconfig.json is resolved relative to the project, not the ESLint config package
|
|
30
28
|
|
|
31
29
|
export const baseConfig = [
|
|
32
30
|
{ ...baseRules },
|
|
@@ -57,8 +55,7 @@ export const baseConfig = [
|
|
|
57
55
|
},
|
|
58
56
|
parser: tseslint.parser,
|
|
59
57
|
parserOptions: {
|
|
60
|
-
project:
|
|
61
|
-
tsconfigRootDir: __dirname,
|
|
58
|
+
project: ['./tsconfig.json', './**/tsconfig.json'],
|
|
62
59
|
},
|
|
63
60
|
sourceType: 'module',
|
|
64
61
|
},
|
package/package.json
CHANGED
package/rules/nextRules.mjs
CHANGED
|
@@ -22,58 +22,6 @@ export const nextRules = {
|
|
|
22
22
|
'@next/next/no-typos': ['warn'],
|
|
23
23
|
'@next/next/no-unwanted-polyfillio': ['warn'],
|
|
24
24
|
|
|
25
|
-
// Project-specific import restrictions
|
|
26
|
-
'no-restricted-imports': [
|
|
27
|
-
'warn',
|
|
28
|
-
{
|
|
29
|
-
paths: [
|
|
30
|
-
{
|
|
31
|
-
name: 'next-intl',
|
|
32
|
-
importNames: ['getMessages', 'useMessages'],
|
|
33
|
-
message: 'Always prefer `getTranslations` over `getMessages` and `useTranslations` over `useMessages`.',
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
name: 'next/image',
|
|
37
|
-
message: '`<Image />` from `next/image` should not be used directly. Use `<Image />` from `@/components/Image/Image` instead.',
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
name: 'next/link',
|
|
41
|
-
message: '`<Link />` from `next/link` should not be used directly. Use `<Link />` from `@/components/Link/Link` instead.',
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
name: 'next/navigation',
|
|
45
|
-
importNames: ['useRouter', 'redirect', 'usePathname', 'Link'],
|
|
46
|
-
message:
|
|
47
|
-
'`useRouter`, `redirect`, `usePathname` `Link` should not be used directly. Use `useRouter`, `redirect`, `usePathname` from `@/i18n/navigation` and `Link` from `@/components/Link/Link` instead.',
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
name: 'next/router',
|
|
51
|
-
importNames: ['useRouter', 'redirect', 'usePathname', 'Link'],
|
|
52
|
-
message: '`useRouter` should not be used directly. Use `useRouter` from `@/i18n/navigation` instead.',
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
name: 'react',
|
|
56
|
-
importNames: ['forwardRef'],
|
|
57
|
-
message: '`forwardRef` is deprectated in React 19 and is not necessary anymore.',
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
name: 'react',
|
|
61
|
-
importNames: ['useCallback', 'useMemo'],
|
|
62
|
-
message: '`useCallback` and `useMemo` are not necessary anymore when using the React compiler.',
|
|
63
|
-
},
|
|
64
|
-
],
|
|
65
|
-
},
|
|
66
|
-
],
|
|
67
|
-
|
|
68
|
-
// Project-specific JSX restrictions
|
|
69
|
-
'no-restricted-syntax': [
|
|
70
|
-
'warn',
|
|
71
|
-
{
|
|
72
|
-
selector: 'JSXOpeningElement[name.name="a"]',
|
|
73
|
-
message: 'Do not use <a> tags. Please use the <Link> component from `@/components/Link/Link` instead.',
|
|
74
|
-
},
|
|
75
|
-
],
|
|
76
|
-
|
|
77
25
|
// React 19 compiler rules
|
|
78
26
|
'react-compiler/react-compiler': ['warn'],
|
|
79
27
|
},
|