@maprox/lint-config 1.6.1 → 1.7.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/README.md CHANGED
@@ -4,6 +4,36 @@ Shared ESLint flat configs for maprox (and related) projects, plus an experiment
4
4
 
5
5
  Formerly published as `@sunsay/eslint-config` on the Forgejo npm registry; use `@maprox/lint-config` going forward (same presets).
6
6
 
7
+ ## Migration
8
+
9
+ ### 1.7.0 — function complexity limits (error)
10
+
11
+ Base / portable (and thus `./vue`, `./node`, `./astro`) now enforces:
12
+
13
+ | Rule | Limit |
14
+ |------|------:|
15
+ | `complexity` | 10 |
16
+ | `max-params` | 4 |
17
+ | `max-depth` | 3 |
18
+ | `max-lines-per-function` | 30 (`skipBlankLines` + `skipComments`) |
19
+ | `max-statements` | 20 |
20
+
21
+ Expect lint failures on large CLI-style handlers and nested branching. Prefer smaller functions / early returns. Hotspot override (last resort):
22
+
23
+ ```js
24
+ import maprox from '@maprox/lint-config'
25
+
26
+ export default [
27
+ ...maprox,
28
+ {
29
+ files: ['**/commands/invent.ts'],
30
+ rules: {
31
+ 'max-lines-per-function': 'off',
32
+ 'max-statements': 'off',
33
+ },
34
+ },
35
+ ]
36
+ ```
7
37
 
8
38
  ## Install
9
39
 
@@ -117,7 +147,7 @@ Vue stays on the ESLint `./vue` preset for now.
117
147
 
118
148
  ## What is included
119
149
 
120
- - **Base / portable:** `@stylistic`, import order (`import-x` + `import-newlines`), TS strictness, type-aware rules for `*.ts`, relative-import ban, `@typescript-eslint/no-shadow` (core `no-shadow` off), `curly` / `no-console`, etc. Enums are PascalCase with `UPPER_CASE` members. Boolean variables and parameters are PascalCase with a prefix of `is`, `should`, `has`, `can`, `did`, or `will` (`isReady`, `hasError`). Needs a usable `tsconfig.json` (`project: true`).
150
+ - **Base / portable:** `@stylistic`, import order (`import-x` + `import-newlines`), TS strictness, type-aware rules for `*.ts`, relative-import ban, `@typescript-eslint/no-shadow` (core `no-shadow` off), `curly` / `no-console`, complexity metrics (`complexity` ≤10, `max-params` ≤4, `max-depth` ≤3, `max-lines-per-function` ≤30, `max-statements` ≤20), etc. Enums are PascalCase with `UPPER_CASE` members. Boolean variables and parameters are PascalCase with a prefix of `is`, `should`, `has`, `can`, `did`, or `will` (`isReady`, `hasError`). Needs a usable `tsconfig.json` (`project: true`).
121
151
  - **Vue:** `createConfigForNuxt` + portable layer + Vue SFC-only rules; type-aware rules also cover `.vue` `<script>` (`extraFileExtensions`).
122
152
  - **Astro / Node:** extend base with their parsers/globals.
123
153
  - **Tailwind (opt-in `./tailwind`):** `eslint-plugin-tailwindcss@4` `classnames-order` + required `cssConfigPath`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maprox/lint-config",
3
- "version": "1.6.1",
3
+ "version": "1.7.0",
4
4
  "description": "Shared ESLint flat configs (base, vue, astro, node, opt-in tailwind) + oxlint skeleton",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -113,6 +113,14 @@ export const portableOverrides = [
113
113
  'no-constant-condition': ['error', { checkLoops: 'none' }],
114
114
  'no-lonely-if': 'error',
115
115
  'no-useless-constructor': 'off',
116
+ complexity: ['error', 10],
117
+ 'max-params': ['error', 4],
118
+ 'max-depth': ['error', 3],
119
+ 'max-lines-per-function': [
120
+ 'error',
121
+ { max: 30, skipBlankLines: true, skipComments: true },
122
+ ],
123
+ 'max-statements': ['error', 20],
116
124
  'nonblock-statement-body-position': ['error', 'below'],
117
125
  'space-before-function-paren': [
118
126
  'error',