@mkaradeniz/eslint-config 5.10.0 → 5.11.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/noLet.mjs ADDED
@@ -0,0 +1,26 @@
1
+ import { baseRules } from './rules/baseRules.mjs';
2
+
3
+ const noLetRestriction = {
4
+ message:
5
+ 'Prefer const + functional patterns (map/filter/reduce/ternary). Extract to a util function if needed. Only disable for: try/catch assignment, iterators/generators, for-await-of accumulation, or closures requiring mutable state (debounce, event handlers).',
6
+ selector: 'VariableDeclaration[kind="let"]',
7
+ };
8
+
9
+ /**
10
+ * Bans `let` declarations via `no-restricted-syntax`.
11
+ *
12
+ * Accepts an optional source rules object to merge with. Defaults to `baseRules`.
13
+ * Pass `reactRules` when composing with `reactConfig` or `nextConfig` to preserve their extra selectors.
14
+ *
15
+ * @example
16
+ * import { createNoLetConfig } from '@mkaradeniz/eslint-config/noLet.mjs';
17
+ * import { reactRules } from '@mkaradeniz/eslint-config/rules/reactRules.mjs';
18
+ * export default [...nextConfig, ...createNoLetConfig(reactRules)];
19
+ */
20
+ export const createNoLetConfig = (sourceRules = baseRules) => [
21
+ {
22
+ rules: {
23
+ 'no-restricted-syntax': ['warn', ...sourceRules.rules['no-restricted-syntax'].slice(1), noLetRestriction],
24
+ },
25
+ },
26
+ ];
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@mkaradeniz/eslint-config",
3
- "version": "5.10.0",
3
+ "version": "5.11.0",
4
4
  "private": false,
5
5
  "files": [
6
6
  "base.mjs",
7
7
  "web.mjs",
8
8
  "next.mjs",
9
+ "noLet.mjs",
9
10
  "react.mjs",
10
11
  "shadcn.mjs",
11
12
  "tanstackQuery.mjs",
@@ -134,11 +134,6 @@ export const baseRules = {
134
134
  message: 'Use envConfigClient or envConfigServer instead of process.env.',
135
135
  selector: 'MemberExpression[object.name="process"][property.name="env"]',
136
136
  },
137
- // {
138
- // message:
139
- // 'Prefer const + functional patterns (map/filter/reduce/ternary). Extract to a util function if needed. Only disable for: try/catch assignment, iterators/generators, for-await-of accumulation, or closures requiring mutable state (debounce, event handlers).',
140
- // selector: 'VariableDeclaration[kind="let"]',
141
- // },
142
137
  ],
143
138
  'no-return-assign': ['warn'],
144
139
  'no-script-url': ['warn'],