@kununu/eslint-config 5.3.0-beta-5 → 5.3.0-beta-7

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.
Files changed (2) hide show
  1. package/index.js +11 -3
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -203,6 +203,14 @@ const baseRules = {
203
203
 
204
204
  // https://react.dev/blog/2024/04/25/react-19-upgrade-guide#removed-proptypes-and-defaultprops
205
205
  'react/require-default-props': 0,
206
+
207
+ 'no-restricted-syntax': ['error', {
208
+ selector: 'ReturnStatement > LogicalExpression[operator="&&"]',
209
+ message: 'Prefer early returns over logical expressions in return statements. Use if (condition) return value; instead.'
210
+ }],
211
+
212
+ // Use our custom rule from the plugin if available
213
+ 'kununu/prefer-early-return': 'error',
206
214
  };
207
215
 
208
216
  module.exports = {
@@ -222,7 +230,7 @@ module.exports = {
222
230
  '@babel',
223
231
  'lodash',
224
232
  'sort-destructure-keys',
225
- '@shopify',
233
+ 'kununu' // Add our custom plugin
226
234
  ],
227
235
 
228
236
  env: {
@@ -234,7 +242,7 @@ module.exports = {
234
242
 
235
243
  rules: {
236
244
  ...baseRules,
237
- '@shopify/prefer-early-return': 'error',
245
+ '@shopify/prefer-early-return': ['error', { maximumStatements: 1 }],
238
246
  },
239
247
 
240
248
  overrides: [{
@@ -273,7 +281,7 @@ module.exports = {
273
281
  '**/stories.tsx',
274
282
  ],
275
283
  }],
276
- '@shopify/prefer-early-return': 'error',
284
+ '@shopify/prefer-early-return': ['error', { maximumStatements: 1 }],
277
285
  },
278
286
  overrides: [
279
287
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kununu/eslint-config",
3
- "version": "5.3.0-beta-5",
3
+ "version": "5.3.0-beta-7",
4
4
  "description": "kununu's ESLint config",
5
5
  "main": "index.js",
6
6
  "repository": "kununu/eslint-config",