@lifeofqui/lint-config 0.0.0-stage → 1.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Quirin Koch
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,85 @@
1
- # Temporary Holding Version
1
+ # @lifeofqui/lint-config
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Gemeinsames Lint- und Format-Setup für Vue-/Nuxt-Projekte: **Oxlint** für JS/TS, **ESLint** nur für das, was Oxlint nicht kann (Vue-Templates/SFCs, AST-Selector-Regeln), **Oxfmt** zum Formatieren.
4
+
5
+ Das Paket bringt Regeln **und** Tool-Versionen mit: `eslint`, `oxlint` und `oxfmt` sind exakt gepinnte Dependencies. Ein Update dieses Pakets aktualisiert also Regeln und Tools in einem Schritt.
6
+
7
+ > Node `>= 22.18` · npm (die Binaries werden nach `node_modules/.bin` gehoistet)
8
+
9
+ ## Setup in einem Projekt
10
+
11
+ ```bash
12
+ npm i -D @lifeofqui/lint-config
13
+ ```
14
+
15
+ `eslint`, `oxlint`, `oxfmt`, `eslint-plugin-oxlint`, `eslint-plugin-vue`, `@vue/eslint-config-typescript` und `eslint-config-prettier` aus den devDependencies des Projekts entfernen.
16
+
17
+ **`.oxlintrc.json`**
18
+
19
+ ```json
20
+ {
21
+ "$schema": "./node_modules/oxlint/configuration_schema.json",
22
+ "extends": ["./node_modules/@lifeofqui/lint-config/oxlintrc.json"],
23
+ "ignorePatterns": ["public"]
24
+ }
25
+ ```
26
+
27
+ `ignorePatterns` wird von Oxlint **nicht** über `extends` vererbt und bleibt deshalb im Projekt. `categories`, `plugins`, `rules` und `overrides` kommen aus der Basis.
28
+
29
+ **`oxfmt.config.ts`** (Oxfmt kennt kein `extends`, daher Spread)
30
+
31
+ ```ts
32
+ import base from '@lifeofqui/lint-config/oxfmt'
33
+
34
+ export default { ...base }
35
+ ```
36
+
37
+ **`eslint.config.mjs`**
38
+
39
+ ```js
40
+ import { defineLintConfig } from '@lifeofqui/lint-config/eslint'
41
+
42
+ export default defineLintConfig()
43
+ ```
44
+
45
+ Optionen von `defineLintConfig`:
46
+
47
+ | Option | Default | Zweck |
48
+ | ------------------ | -------------------- | --------------------------------------------------------------------- |
49
+ | `ignores` | `[]` | Zusätzliche Ignore-Globs (Nuxt-Build-Ordner sind schon drin) |
50
+ | `oxlintConfigFile` | `'./.oxlintrc.json'` | Oxlint-Config des Projekts, deren Regeln ESLint abschaltet |
51
+ | `configs` | `[]` | Projektspezifische Flat-Configs, werden nach den geteilten angewendet |
52
+
53
+ **Scripts** (Standard, `npm-run-all` im Projekt)
54
+
55
+ ```json
56
+ {
57
+ "fmt": "oxfmt",
58
+ "fmt:check": "oxfmt --check",
59
+ "lint": "run-s --continue-on-error fmt lint:oxlint lint:eslint",
60
+ "lint:check": "run-s --continue-on-error fmt:check lint:check:oxlint lint:check:eslint",
61
+ "lint:check:eslint": "eslint . --cache --max-warnings 0",
62
+ "lint:check:oxlint": "oxlint . --deny-warnings",
63
+ "lint:eslint": "eslint . --fix --cache --max-warnings 0",
64
+ "lint:oxlint": "oxlint . --fix --fix-suggestions --deny-warnings"
65
+ }
66
+ ```
67
+
68
+ ## Projektspezifische Anpassungen
69
+
70
+ - **Oxlint**: eigene `rules` / `overrides` in `.oxlintrc.json` nach dem `extends`. Spätere Einträge gewinnen.
71
+ - **Oxfmt**: `export default { ...base, printWidth: 120 }`
72
+ - **ESLint**: `defineLintConfig({ configs: [{ files: ['…'], rules: { … } }] })`
73
+
74
+ ## Updates verteilen
75
+
76
+ 1. Regel oder Tool-Version hier ändern (Tool-Versionen immer exakt pinnen).
77
+ 2. Lokal testen: `npm pack`, im Projekt `npm i -D ../lint-config/lifeofqui-lint-config-<version>.tgz`, dann `npm run lint:check`.
78
+ 3. `npm version patch|minor|major` und danach `npm publish`.
79
+ 4. In den Projekten öffnet Dependabot einen PR (`.github/dependabot.yml`), die CI prüft ihn mit `npm run lint:check`.
80
+
81
+ Semver: neue oder verschärfte Regeln und Tool-Updates mit Formatierungsänderungen → `minor`, Lockerungen und Fixes → `patch`, geänderte Datei-Struktur oder Optionen → `major`.
82
+
83
+ ## Hinweis zu eslint-plugin-oxlint
84
+
85
+ `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.js ADDED
@@ -0,0 +1,100 @@
1
+ import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript'
2
+ import skipFormatting from 'eslint-config-prettier'
3
+ import pluginOxlint from 'eslint-plugin-oxlint'
4
+ import pluginVue from 'eslint-plugin-vue'
5
+ import { fileURLToPath } from 'node:url'
6
+
7
+ const baseOxlintConfigFile = fileURLToPath(new URL('./oxlintrc.json', import.meta.url))
8
+
9
+ const defaultIgnores = ['**/.output', '**/.data', '**/.nuxt', '**/.nitro', '**/.cache', '**/dist']
10
+
11
+ /**
12
+ * ESLint only covers what Oxlint can't: Vue templates / SFCs and AST-selector rules.
13
+ * Everything else (incl. unicorn and import rules) lives in the Oxlint config.
14
+ *
15
+ * @param {object} [options]
16
+ * @param {string[]} [options.ignores] Extra ignore globs, added to the Nuxt build output dirs.
17
+ * @param {string} [options.oxlintConfigFile] Oxlint config whose rules ESLint turns off.
18
+ * @param {object[]} [options.configs] Project-specific flat configs, applied after the shared ones.
19
+ */
20
+ export function defineLintConfig({
21
+ ignores = [],
22
+ oxlintConfigFile = './.oxlintrc.json',
23
+ configs = [],
24
+ } = {}) {
25
+ return [
26
+ ...defineConfigWithVueTs(
27
+ { ignores: [...defaultIgnores, ...ignores] },
28
+
29
+ pluginVue.configs['flat/recommended'],
30
+ vueTsConfigs.recommended,
31
+
32
+ // Project defaults
33
+ {
34
+ rules: {
35
+ '@typescript-eslint/no-explicit-any': 'off',
36
+ 'vue/multi-word-component-names': 'off',
37
+ // Optional type-based props are undefined when omitted; explicit `undefined` defaults add noise.
38
+ 'vue/require-default-prop': 'off',
39
+ // Oxlint covers .ts files; in .vue files ESLint keeps this rule because it sees template usage.
40
+ '@typescript-eslint/no-unused-vars': [
41
+ 'error',
42
+ { argsIgnorePattern: '^_', varsIgnorePattern: '^_', ignoreRestSiblings: true },
43
+ ],
44
+ 'no-restricted-syntax': [
45
+ 'error',
46
+ {
47
+ selector: 'TSEnumDeclaration',
48
+ message: 'Use literal unions instead of enums.',
49
+ },
50
+ ],
51
+ },
52
+ },
53
+
54
+ // Vue component rules (template / SFC — not yet covered by oxlint)
55
+ {
56
+ files: ['app/**/*.vue'],
57
+ rules: {
58
+ 'vue/component-name-in-template-casing': ['error', 'PascalCase'],
59
+ 'vue/block-order': [
60
+ 'error',
61
+ {
62
+ order: ['script', 'template', 'style'],
63
+ },
64
+ ],
65
+ 'vue/custom-event-name-casing': [
66
+ 'warn',
67
+ 'kebab-case',
68
+ // Idiomatic Vue v-model event names; renaming them would fight the ecosystem.
69
+ { ignores: ['update:modelValue', 'update:currentPage'] },
70
+ ],
71
+ 'vue/no-unused-properties': [
72
+ 'error',
73
+ { groups: ['props', 'data', 'computed', 'methods'] },
74
+ ],
75
+ 'vue/no-unused-refs': 'error',
76
+ 'vue/prefer-use-template-ref': 'error',
77
+ },
78
+ },
79
+
80
+ // Nuxt page and layout transitions need a single root element
81
+ {
82
+ files: ['app/pages/**/*.vue', 'app/layouts/**/*.vue'],
83
+ rules: {
84
+ 'vue/no-multiple-template-root': ['error', { disallowComments: true }],
85
+ },
86
+ },
87
+
88
+ ...configs,
89
+ ),
90
+
91
+ // Disable rules handled by Oxlint. Kept outside defineConfigWithVueTs: it lists type-aware
92
+ // rules (as "off"), which would make it switch on the TS project service for every file.
93
+ // The shared base is read directly: eslint-plugin-oxlint drops `categories` from `extends`.
94
+ ...pluginOxlint.buildFromOxlintConfigFile(baseOxlintConfigFile),
95
+ ...pluginOxlint.buildFromOxlintConfigFile(oxlintConfigFile),
96
+
97
+ // Turn off formatting rules — oxfmt formats
98
+ skipFormatting,
99
+ ]
100
+ }
package/oxfmt.js ADDED
@@ -0,0 +1,33 @@
1
+ /** @type {import('oxfmt').OxfmtConfig} */
2
+ export default {
3
+ sortTailwindcss: {},
4
+ sortPackageJson: {
5
+ sortScripts: true,
6
+ },
7
+ semi: false,
8
+ singleQuote: true,
9
+ ignorePatterns: [
10
+ '**/.output',
11
+ '**/.data',
12
+ '**/.nuxt',
13
+ '**/.nitro',
14
+ '**/.cache',
15
+ '**/dist',
16
+ '**/node_modules',
17
+ '**/logs',
18
+ '**/*.log',
19
+ '**/.DS_Store',
20
+ '**/.fleet',
21
+ '**/.env',
22
+ '**/.env.*',
23
+ '!**/.env.example',
24
+ 'test-results/',
25
+ 'playwright/',
26
+ 'playwright-report/',
27
+ 'blob-report/',
28
+ 'playwright/.cache/',
29
+ '!.dockerignore',
30
+ '!.prettierrc',
31
+ '**/public',
32
+ ],
33
+ }
package/oxlintrc.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "$schema": "./node_modules/oxlint/configuration_schema.json",
3
+ "categories": {
4
+ "correctness": "error",
5
+ "suspicious": "warn"
6
+ },
7
+ "plugins": ["eslint", "typescript", "unicorn", "oxc", "import", "vitest"],
8
+ "rules": {
9
+ "no-case-declarations": "error",
10
+ "no-empty": "error",
11
+ "no-fallthrough": "error",
12
+ "no-nested-ternary": "error",
13
+ "no-prototype-builtins": "error",
14
+ "no-regex-spaces": "error",
15
+ "no-shadow": ["error", { "hoist": "functions" }],
16
+ "no-useless-assignment": "error",
17
+ "typescript/ban-ts-comment": ["error", { "minimumDescriptionLength": 10 }],
18
+ "typescript/consistent-type-imports": "error",
19
+ "typescript/no-dynamic-delete": "error",
20
+ "typescript/no-import-type-side-effects": "error",
21
+ "typescript/no-invalid-void-type": "error",
22
+ "typescript/no-non-null-asserted-nullish-coalescing": "error",
23
+ "typescript/unified-signatures": "error",
24
+ "import/first": "error",
25
+ "import/no-duplicates": "error",
26
+ "import/no-mutable-exports": "error",
27
+ "import/no-named-default": "error",
28
+ "unicorn/error-message": "error",
29
+ "unicorn/escape-case": "error",
30
+ "unicorn/no-abusive-eslint-disable": "error",
31
+ "unicorn/no-await-in-promise-methods": "error",
32
+ "unicorn/no-invalid-remove-event-listener": "error",
33
+ "unicorn/no-new-array": "error",
34
+ "unicorn/no-useless-promise-resolve-reject": "error",
35
+ "unicorn/no-useless-spread": "error",
36
+ "unicorn/prefer-array-find": "error",
37
+ "unicorn/prefer-array-some": "error",
38
+ "unicorn/prefer-date-now": "error",
39
+ "unicorn/prefer-includes": "error",
40
+ "unicorn/prefer-number-properties": "error",
41
+ "unicorn/prefer-optional-catch-binding": "error",
42
+ "unicorn/prefer-string-starts-ends-with": "error",
43
+ "unicorn/throw-new-error": "error"
44
+ }
45
+ }
package/package.json CHANGED
@@ -1,6 +1,38 @@
1
1
  {
2
2
  "name": "@lifeofqui/lint-config",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.0",
4
+ "description": "Shared ESLint, Oxlint and Oxfmt setup for Vue/Nuxt projects",
5
+ "license": "MIT",
6
+ "author": "Quirin Koch",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/LifeOfQui/lint-config.git"
10
+ },
11
+ "files": [
12
+ "eslint.js",
13
+ "oxfmt.js",
14
+ "oxlintrc.json"
15
+ ],
16
+ "type": "module",
17
+ "exports": {
18
+ "./eslint": "./eslint.js",
19
+ "./oxfmt": "./oxfmt.js",
20
+ "./oxlintrc.json": "./oxlintrc.json",
21
+ "./package.json": "./package.json"
22
+ },
23
+ "publishConfig": {
24
+ "access": "public"
25
+ },
26
+ "dependencies": {
27
+ "@vue/eslint-config-typescript": "14.9.0",
28
+ "eslint": "10.13.0",
29
+ "eslint-config-prettier": "10.1.8",
30
+ "eslint-plugin-oxlint": "1.90.0",
31
+ "eslint-plugin-vue": "10.12.0",
32
+ "oxfmt": "0.70.0",
33
+ "oxlint": "1.90.0"
34
+ },
35
+ "engines": {
36
+ "node": ">=22.18"
37
+ }
38
+ }