@mkaradeniz/eslint-config 4.7.0 → 5.0.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 CHANGED
@@ -3,7 +3,6 @@ import eslintPluginImportX from 'eslint-plugin-import-x';
3
3
  import eslintPluginOnlyWarn from 'eslint-plugin-only-warn';
4
4
  import eslintPluginPerfectionist from 'eslint-plugin-perfectionist';
5
5
  import eslintPluginPreferArrowFunctions from 'eslint-plugin-prefer-arrow-functions';
6
- import eslintPluginReactCompiler from 'eslint-plugin-react-compiler';
7
6
  import eslintPluginUnicorn from 'eslint-plugin-unicorn';
8
7
  import eslintPluginUnusedImports from 'eslint-plugin-unused-imports';
9
8
  import globals from 'globals';
@@ -96,10 +95,6 @@ export const baseConfig = [
96
95
  * https://github.com/JamieMason/eslint-plugin-prefer-arrow-functions
97
96
  */
98
97
  'prefer-arrow-functions': eslintPluginPreferArrowFunctions,
99
- /**
100
- * https://github.com/react-compiler/eslint-plugin-react-compiler
101
- */
102
- 'react-compiler': eslintPluginReactCompiler,
103
98
  /**
104
99
  * https://github.com/sindresorhus/eslint-plugin-unicorn
105
100
  */
package/package.json CHANGED
@@ -1,13 +1,12 @@
1
1
  {
2
2
  "name": "@mkaradeniz/eslint-config",
3
- "version": "4.7.0",
3
+ "version": "5.0.0",
4
4
  "private": false,
5
5
  "files": [
6
6
  "base.mjs",
7
7
  "web.mjs",
8
8
  "next.mjs",
9
9
  "react.mjs",
10
- "react19.mjs",
11
10
  "turbo.mjs",
12
11
  "eslint.config.mjs",
13
12
  "rules/"
@@ -36,7 +35,8 @@
36
35
  "eslint-plugin-react": "^7.37.5",
37
36
  "eslint-plugin-react-compiler": "19.1.0-rc.2",
38
37
  "eslint-plugin-react-hooks": "^7.0.1",
39
- "eslint-plugin-turbo": "2.8.3",
38
+ "eslint-plugin-react-you-might-not-need-an-effect": "^0.9.0",
39
+ "eslint-plugin-turbo": "^2.8.9",
40
40
  "eslint-plugin-unicorn": "^62.0.0",
41
41
  "eslint-plugin-unused-imports": "^4.4.1",
42
42
  "globals": "^17.3.0",
package/react.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import eslintPluginJsxA11y from 'eslint-plugin-jsx-a11y';
2
2
  import eslintPluginReact from 'eslint-plugin-react';
3
+ import eslintPluginReactCompiler from 'eslint-plugin-react-compiler';
3
4
  import eslintPluginReactHooks from 'eslint-plugin-react-hooks';
4
-
5
- import eslintPluginStylistic from '@stylistic/eslint-plugin';
5
+ import eslintPluginReactYMNNAE from 'eslint-plugin-react-you-might-not-need-an-effect';
6
6
 
7
7
  import { baseConfig } from './base.mjs';
8
8
  import { reactRules } from './rules/reactRules.mjs';
@@ -17,10 +17,11 @@ export const reactConfig = [
17
17
  },
18
18
  },
19
19
  plugins: {
20
- '@stylistic': eslintPluginStylistic,
21
20
  'jsx-a11y': eslintPluginJsxA11y,
22
21
  react: eslintPluginReact,
22
+ 'react-compiler': eslintPluginReactCompiler,
23
23
  'react-hooks': eslintPluginReactHooks,
24
+ 'react-you-might-not-need-an-effect': eslintPluginReactYMNNAE,
24
25
  },
25
26
  settings: {
26
27
  react: { version: 'detect' },
@@ -21,8 +21,5 @@ export const nextRules = {
21
21
  '@next/next/no-title-in-document-head': ['warn'],
22
22
  '@next/next/no-typos': ['warn'],
23
23
  '@next/next/no-unwanted-polyfillio': ['warn'],
24
-
25
- // React 19 compiler rules
26
- 'react-compiler/react-compiler': ['warn'],
27
24
  },
28
25
  };
@@ -1,5 +1,10 @@
1
+ import { baseRules } from './baseRules.mjs';
2
+
3
+ const [baseNoRestrictedSyntaxSeverity, ...baseNoRestrictedSyntaxSelectors] = baseRules.rules['no-restricted-syntax'];
4
+
1
5
  export const reactRules = {
2
6
  rules: {
7
+ // NOTE: This overrides base `no-restricted-imports`. If base ever adds its own, merge like we do with `no-restricted-syntax`.
3
8
  'no-restricted-imports': [
4
9
  'warn',
5
10
  {
@@ -7,7 +12,7 @@ export const reactRules = {
7
12
  {
8
13
  importNames: [
9
14
  'createContext',
10
- 'fordwardRef',
15
+ 'forwardRef',
11
16
  'startTransition',
12
17
  'use',
13
18
  'useCallback',
@@ -27,12 +32,20 @@ export const reactRules = {
27
32
  'useTransition',
28
33
  ],
29
34
  message:
30
- "React built-in hooks & functions should not be important directly. `Import React from 'react'` and then use `React.useBuiltInHook()` || `React.function()`.",
35
+ "React built-in hooks & functions should not be imported directly. `import React from 'react'` and then use `React.useBuiltInHook()` || `React.function()`.",
31
36
  name: 'react',
32
37
  },
33
38
  ],
34
39
  },
35
40
  ],
41
+ 'no-restricted-syntax': [
42
+ baseNoRestrictedSyntaxSeverity,
43
+ ...baseNoRestrictedSyntaxSelectors,
44
+ {
45
+ message: 'Use the cn() utility instead of template literals for className.',
46
+ selector: "JSXAttribute[name.name='className'] > JSXExpressionContainer > TemplateLiteral",
47
+ },
48
+ ],
36
49
  'react/button-has-type': 'off',
37
50
  'react/display-name': ['warn'],
38
51
  'react/function-component-definition': ['warn', { namedComponents: 'arrow-function', unnamedComponents: 'arrow-function' }],
@@ -47,24 +60,20 @@ export const reactRules = {
47
60
  'react/jsx-no-target-blank': ['warn', { allowReferrer: true, forms: false, links: true }],
48
61
  'react/jsx-no-undef': ['warn'],
49
62
  'react/jsx-no-useless-fragment': ['warn', { allowExpressions: true }],
50
- 'react/jsx-pascal-case': ['warn'],
63
+ 'react/jsx-pascal-case': ['off'],
51
64
  'react/jsx-sort-props': ['off'],
52
- 'react/jsx-uses-react': ['warn'],
53
- 'react/jsx-uses-vars': ['warn'],
54
65
  'react/no-array-index-key': ['warn'],
55
66
  'react/no-danger-with-children': ['warn'],
56
67
  'react/no-deprecated': ['warn'],
57
- 'react/no-direct-mutation-state': ['warn'],
58
- 'react/no-find-dom-node': ['warn'],
59
- 'react/no-is-mounted': ['warn'],
60
68
  'react/no-render-return-value': ['warn'],
61
- 'react/no-string-refs': ['warn'],
62
69
  'react/no-unescaped-entities': ['warn'],
63
70
  'react/no-unknown-property': ['warn'],
64
71
  'react/no-unstable-nested-components': ['warn'],
65
- 'react/require-render-return': ['warn'],
66
72
  'react/self-closing-comp': ['warn'],
67
73
 
74
+ // react-compiler
75
+ 'react-compiler/react-compiler': ['warn'],
76
+
68
77
  // react-hooks
69
78
  'react-hooks/exhaustive-deps': ['warn'],
70
79
  'react-hooks/rules-of-hooks': ['warn'],
@@ -141,5 +150,16 @@ export const reactRules = {
141
150
  'jsx-a11y/role-supports-aria-props': ['warn'],
142
151
  'jsx-a11y/scope': ['warn'],
143
152
  'jsx-a11y/tabindex-no-positive': ['warn'],
153
+
154
+ // react-you-might-not-need-an-effect
155
+ 'react-you-might-not-need-an-effect/no-adjust-state-on-prop-change': ['warn'],
156
+ 'react-you-might-not-need-an-effect/no-chain-state-updates': ['warn'],
157
+ 'react-you-might-not-need-an-effect/no-derived-state': ['warn'],
158
+ 'react-you-might-not-need-an-effect/no-empty-effect': ['warn'],
159
+ 'react-you-might-not-need-an-effect/no-event-handler': ['warn'],
160
+ 'react-you-might-not-need-an-effect/no-initialize-state': ['warn'],
161
+ 'react-you-might-not-need-an-effect/no-pass-data-to-parent': ['warn'],
162
+ 'react-you-might-not-need-an-effect/no-pass-live-state-to-parent': ['warn'],
163
+ 'react-you-might-not-need-an-effect/no-reset-all-state-on-prop-change': ['warn'],
144
164
  },
145
165
  };
package/web.mjs CHANGED
@@ -1,4 +1,3 @@
1
- import { nextConfig } from './next.mjs';
2
- import { react19Config } from './react19.mjs';
1
+ import { reactConfig } from './react.mjs';
3
2
 
4
- export const webConfig = [...nextConfig, ...react19Config];
3
+ export const webConfig = [...reactConfig];
package/react19.mjs DELETED
@@ -1,12 +0,0 @@
1
- import eslintPluginReactCompiler from 'eslint-plugin-react-compiler';
2
-
3
- import { react19Rules } from './rules/react19Rules.mjs';
4
-
5
- export const react19Config = [
6
- {
7
- plugins: {
8
- 'react-compiler': eslintPluginReactCompiler,
9
- },
10
- },
11
- { ...react19Rules },
12
- ];
@@ -1,5 +0,0 @@
1
- export const react19Rules = {
2
- rules: {
3
- 'react-compiler/react-compiler': ['warn'],
4
- },
5
- };