@mkaradeniz/eslint-config 4.7.0 → 4.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mkaradeniz/eslint-config",
3
- "version": "4.7.0",
3
+ "version": "4.8.0",
4
4
  "private": false,
5
5
  "files": [
6
6
  "base.mjs",
@@ -36,7 +36,8 @@
36
36
  "eslint-plugin-react": "^7.37.5",
37
37
  "eslint-plugin-react-compiler": "19.1.0-rc.2",
38
38
  "eslint-plugin-react-hooks": "^7.0.1",
39
- "eslint-plugin-turbo": "2.8.3",
39
+ "eslint-plugin-react-you-might-not-need-an-effect": "^0.9.0",
40
+ "eslint-plugin-turbo": "2.8.9",
40
41
  "eslint-plugin-unicorn": "^62.0.0",
41
42
  "eslint-plugin-unused-imports": "^4.4.1",
42
43
  "globals": "^17.3.0",
package/react.mjs CHANGED
@@ -1,6 +1,7 @@
1
1
  import eslintPluginJsxA11y from 'eslint-plugin-jsx-a11y';
2
2
  import eslintPluginReact from 'eslint-plugin-react';
3
3
  import eslintPluginReactHooks from 'eslint-plugin-react-hooks';
4
+ import eslintPluginReactYMNNAE from 'eslint-plugin-react-you-might-not-need-an-effect';
4
5
 
5
6
  import eslintPluginStylistic from '@stylistic/eslint-plugin';
6
7
 
@@ -21,6 +22,7 @@ export const reactConfig = [
21
22
  'jsx-a11y': eslintPluginJsxA11y,
22
23
  react: eslintPluginReact,
23
24
  'react-hooks': eslintPluginReactHooks,
25
+ 'react-you-might-not-need-an-effect': eslintPluginReactYMNNAE,
24
26
  },
25
27
  settings: {
26
28
  react: { version: 'detect' },
@@ -33,6 +33,13 @@ export const reactRules = {
33
33
  ],
34
34
  },
35
35
  ],
36
+ 'no-restricted-syntax': [
37
+ 'error',
38
+ {
39
+ message: 'Use the cn() utility instead of template literals for className.',
40
+ selector: "JSXAttribute[name.name='className'] > JSXExpressionContainer > TemplateLiteral",
41
+ },
42
+ ],
36
43
  'react/button-has-type': 'off',
37
44
  'react/display-name': ['warn'],
38
45
  'react/function-component-definition': ['warn', { namedComponents: 'arrow-function', unnamedComponents: 'arrow-function' }],
@@ -141,5 +148,16 @@ export const reactRules = {
141
148
  'jsx-a11y/role-supports-aria-props': ['warn'],
142
149
  'jsx-a11y/scope': ['warn'],
143
150
  'jsx-a11y/tabindex-no-positive': ['warn'],
151
+
152
+ // react-you-might-not-need-an-effect
153
+ 'react-you-might-not-need-an-effect/no-adjust-state-on-prop-change': ['warn'],
154
+ 'react-you-might-not-need-an-effect/no-chain-state-updates': ['warn'],
155
+ 'react-you-might-not-need-an-effect/no-derived-state': ['warn'],
156
+ 'react-you-might-not-need-an-effect/no-empty-effect': ['warn'],
157
+ 'react-you-might-not-need-an-effect/no-event-handler': ['warn'],
158
+ 'react-you-might-not-need-an-effect/no-initialize-state': ['warn'],
159
+ 'react-you-might-not-need-an-effect/no-pass-data-to-parent': ['warn'],
160
+ 'react-you-might-not-need-an-effect/no-pass-live-state-to-parent': ['warn'],
161
+ 'react-you-might-not-need-an-effect/no-reset-all-state-on-prop-change': ['warn'],
144
162
  },
145
163
  };