@maprox/lint-config 1.7.0 → 1.8.1
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 +7 -31
- package/package.json +5 -1
- package/src/eslint/portable.js +2 -1
package/README.md
CHANGED
|
@@ -4,36 +4,7 @@ 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
|
-
|
|
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
|
+
Breaking changes: see [`docs/MIGRATION.md`](./docs/MIGRATION.md).
|
|
37
8
|
|
|
38
9
|
## Install
|
|
39
10
|
|
|
@@ -147,7 +118,7 @@ Vue stays on the ESLint `./vue` preset for now.
|
|
|
147
118
|
|
|
148
119
|
## What is included
|
|
149
120
|
|
|
150
|
-
- **Base / portable:** `@stylistic
|
|
121
|
+
- **Base / portable:** `@stylistic` (including single quotes via `@stylistic/quotes`), 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` ≤40, `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`).
|
|
151
122
|
- **Vue:** `createConfigForNuxt` + portable layer + Vue SFC-only rules; type-aware rules also cover `.vue` `<script>` (`extraFileExtensions`).
|
|
152
123
|
- **Astro / Node:** extend base with their parsers/globals.
|
|
153
124
|
- **Tailwind (opt-in `./tailwind`):** `eslint-plugin-tailwindcss@4` `classnames-order` + required `cssConfigPath`.
|
|
@@ -169,6 +140,11 @@ Prefer either the package stylistic rules **or** Prettier at full strength — n
|
|
|
169
140
|
- `eslint-plugin-astro` (optional peer, Astro preset)
|
|
170
141
|
- `eslint-plugin-tailwindcss`, `tailwindcss` (optional peers, `./tailwind` only)
|
|
171
142
|
|
|
143
|
+
## Changelog
|
|
144
|
+
|
|
145
|
+
See [`CHANGELOG.md`](./CHANGELOG.md) for notable changes. Releases: [`docs/RELEASES.md`](./docs/RELEASES.md).
|
|
146
|
+
|
|
172
147
|
## License
|
|
173
148
|
|
|
174
149
|
MIT
|
|
150
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maprox/lint-config",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.1",
|
|
4
4
|
"description": "Shared ESLint flat configs (base, vue, astro, node, opt-in tailwind) + oxlint skeleton",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -88,10 +88,14 @@
|
|
|
88
88
|
"devDependencies": {
|
|
89
89
|
"@eslint/js": "^10.0.1",
|
|
90
90
|
"@nuxt/eslint-config": "^1.16.0",
|
|
91
|
+
"@semantic-release/commit-analyzer": "^13.0.1",
|
|
92
|
+
"@semantic-release/npm": "^13.2.0",
|
|
93
|
+
"@semantic-release/release-notes-generator": "^14.1.1",
|
|
91
94
|
"eslint": "^10.5.0",
|
|
92
95
|
"eslint-plugin-astro": "^1.7.0",
|
|
93
96
|
"eslint-plugin-tailwindcss": "^4.4.0",
|
|
94
97
|
"globals": "^17.7.0",
|
|
98
|
+
"semantic-release": "^25.0.9",
|
|
95
99
|
"tailwindcss": "^4.1.14",
|
|
96
100
|
"typescript": "^5.9.0",
|
|
97
101
|
"typescript-eslint": "^8.62.0"
|
package/src/eslint/portable.js
CHANGED
|
@@ -99,6 +99,7 @@ export const portableOverrides = [
|
|
|
99
99
|
},
|
|
100
100
|
],
|
|
101
101
|
'@stylistic/quote-props': ['error', 'as-needed'],
|
|
102
|
+
'@stylistic/quotes': ['error', 'single', { avoidEscape: true, allowTemplateLiterals: true }],
|
|
102
103
|
'import/order': [
|
|
103
104
|
'error',
|
|
104
105
|
{
|
|
@@ -118,7 +119,7 @@ export const portableOverrides = [
|
|
|
118
119
|
'max-depth': ['error', 3],
|
|
119
120
|
'max-lines-per-function': [
|
|
120
121
|
'error',
|
|
121
|
-
{ max:
|
|
122
|
+
{ max: 40, skipBlankLines: true, skipComments: true },
|
|
122
123
|
],
|
|
123
124
|
'max-statements': ['error', 20],
|
|
124
125
|
'nonblock-statement-body-position': ['error', 'below'],
|