@lifeofqui/lint-config 1.1.0 → 1.2.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
@@ -52,11 +52,12 @@ export default defineLintConfig()
52
52
 
53
53
  Optionen von `defineLintConfig`:
54
54
 
55
- | Option | Default | Zweck |
56
- | ------------------ | -------------------- | --------------------------------------------------------------------- |
57
- | `ignores` | `[]` | Zusätzliche Ignore-Globs (Nuxt-Build-Ordner sind schon drin) |
58
- | `oxlintConfigFile` | `'./.oxlintrc.json'` | Oxlint-Config des Projekts, deren Regeln ESLint abschaltet |
59
- | `configs` | `[]` | Projektspezifische Flat-Configs, werden nach den geteilten angewendet |
55
+ | Option | Default | Zweck |
56
+ | ------------------ | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
57
+ | `ignores` | `[]` | Zusätzliche Ignore-Globs (Nuxt-Build-Ordner sind schon drin) |
58
+ | `oxlintConfigFile` | `'./.oxlintrc.json'` | Oxlint-Config des Projekts, deren Regeln ESLint abschaltet |
59
+ | `gitignore` | `'.gitignore'` | Ignore-Datei (relativ zum Arbeitsverzeichnis), deren Muster ESLint überspringt, wie Oxlint und Oxfmt. Fehlt sie, passiert nichts; `false` schaltet es ab |
60
+ | `configs` | `[]` | Projektspezifische Flat-Configs, werden nach den geteilten angewendet |
60
61
 
61
62
  **Scripts** (Standard, `npm-run-all` im Projekt)
62
63
 
@@ -76,7 +77,7 @@ Optionen von `defineLintConfig`:
76
77
  ## Projektspezifische Anpassungen
77
78
 
78
79
  - **Oxlint**: eigene `rules` / `overrides` in `.oxlintrc.json` nach dem `extends`. Spätere Einträge gewinnen.
79
- - **Oxfmt**: `export default { ...base, printWidth: 120 }`
80
+ - **Oxfmt**: `export default { ...base, printWidth: 120 }`, zusätzliche Ignores mit `ignorePatterns: [...base.ignorePatterns, 'datei.json']`
80
81
  - **ESLint**: `defineLintConfig({ configs: [{ files: ['…'], rules: { … } }] })`
81
82
 
82
83
  ## Updates verteilen
@@ -88,6 +89,12 @@ Optionen von `defineLintConfig`:
88
89
 
89
90
  Semver: neue oder verschärfte Regeln und Tool-Updates mit Formatierungsänderungen → `minor`, Lockerungen und Fixes → `patch`, geänderte Datei-Struktur oder Optionen → `major`.
90
91
 
92
+ ## Stolperfalle: Inline-Handler mit mehreren Anweisungen
93
+
94
+ Oxfmt entfernt mit `semi: false` das `;` aus Vue-Handlern wie `@click="a = 1; b = 2"` und schreibt die Anweisungen untereinander. Der Vue-Compiler erkennt mehrere Anweisungen aber nur am `;` und bricht dann den **Build** ab („Error parsing JavaScript expression“). Lint und Typecheck merken davon nichts.
95
+
96
+ Deshalb keine Inline-Handler mit mehreren Anweisungen schreiben, sondern eine Funktion aufrufen (`@click="resetFilters"`). Nach einer Umstellung auf dieses Paket immer auch `npm run build` laufen lassen.
97
+
91
98
  ## Hinweis zu eslint-plugin-oxlint
92
99
 
93
100
  `eslint-plugin-oxlint` übernimmt bei `extends` keine `categories`. `defineLintConfig` liest deshalb zusätzlich die Basis-Datei direkt ein, damit ESLint alle Regeln abschaltet, die Oxlint über Kategorien abdeckt.
package/eslint.d.ts CHANGED
@@ -5,6 +5,11 @@ export interface LintConfigOptions {
5
5
  ignores?: string[]
6
6
  /** Oxlint config whose rules ESLint turns off. Defaults to `./.oxlintrc.json`. */
7
7
  oxlintConfigFile?: string
8
+ /**
9
+ * Ignore file whose patterns ESLint skips, relative to the working directory. Defaults to
10
+ * `.gitignore`; skipped silently if missing. `false` turns it off.
11
+ */
12
+ gitignore?: string | false
8
13
  /** Project-specific flat configs, applied after the shared ones. */
9
14
  configs?: Linter.Config[]
10
15
  }
package/eslint.js CHANGED
@@ -1,7 +1,10 @@
1
1
  import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript'
2
+ import { includeIgnoreFile } from 'eslint/config'
2
3
  import skipFormatting from 'eslint-config-prettier'
3
4
  import pluginOxlint from 'eslint-plugin-oxlint'
4
5
  import pluginVue from 'eslint-plugin-vue'
6
+ import { existsSync } from 'node:fs'
7
+ import { resolve } from 'node:path'
5
8
  import { fileURLToPath } from 'node:url'
6
9
 
7
10
  const baseOxlintConfigFile = fileURLToPath(new URL('./oxlintrc.json', import.meta.url))
@@ -15,14 +18,29 @@ const defaultIgnores = ['**/.output', '**/.data', '**/.nuxt', '**/.nitro', '**/.
15
18
  * @param {object} [options]
16
19
  * @param {string[]} [options.ignores] Extra ignore globs, added to the Nuxt build output dirs.
17
20
  * @param {string} [options.oxlintConfigFile] Oxlint config whose rules ESLint turns off.
21
+ * @param {string | false} [options.gitignore] Ignore file whose patterns ESLint skips, relative to the
22
+ * working directory. Skipped silently if missing; `false` turns it off.
18
23
  * @param {object[]} [options.configs] Project-specific flat configs, applied after the shared ones.
19
24
  */
20
25
  export function defineLintConfig({
21
26
  ignores = [],
22
27
  oxlintConfigFile = './.oxlintrc.json',
28
+ gitignore = '.gitignore',
23
29
  configs = [],
24
30
  } = {}) {
31
+ const gitignoreFile = gitignore === false ? null : resolve(gitignore)
32
+
25
33
  return [
34
+ // Lint the same files as Oxlint and Oxfmt, which both respect .gitignore
35
+ ...(gitignoreFile && existsSync(gitignoreFile)
36
+ ? [
37
+ includeIgnoreFile(gitignoreFile, {
38
+ gitignoreResolution: true,
39
+ name: 'lifeofqui/gitignore',
40
+ }),
41
+ ]
42
+ : []),
43
+
26
44
  ...defineConfigWithVueTs(
27
45
  { ignores: [...defaultIgnores, ...ignores] },
28
46
 
package/oxfmt.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import type { OxfmtConfig } from 'oxfmt'
2
2
 
3
- declare const config: OxfmtConfig
3
+ declare const config: OxfmtConfig & { ignorePatterns: string[] }
4
4
  export default config
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lifeofqui/lint-config",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Shared ESLint, Oxlint and Oxfmt setup for Vue/Nuxt projects",
5
5
  "license": "MIT",
6
6
  "author": "Quirin Koch",