@eimerreis/linting 0.1.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 Moritz Frölich
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 ADDED
@@ -0,0 +1,76 @@
1
+ # @eimerreis/linting
2
+
3
+ Personal linting and formatting defaults for new JavaScript/TypeScript projects.
4
+
5
+ Built on:
6
+
7
+ - `oxlint` for linting
8
+ - `oxfmt` for formatting
9
+
10
+ Default focus:
11
+
12
+ - React + TypeScript
13
+ - Next.js
14
+ - Tailwind class sorting
15
+ - Vitest rules
16
+
17
+ ## Install
18
+
19
+ ```bash
20
+ npm add -D @eimerreis/linting oxlint oxfmt
21
+ ```
22
+
23
+ ## Quick Start
24
+
25
+ From your project root:
26
+
27
+ ```bash
28
+ npx @eimerreis/linting init
29
+ ```
30
+
31
+ Or with explicit command name:
32
+
33
+ ```bash
34
+ npx eimerreis-linting init
35
+ ```
36
+
37
+ This creates:
38
+
39
+ - `.oxlintrc.json`
40
+ - `.oxfmtrc.json`
41
+
42
+ And updates `package.json` scripts (if present):
43
+
44
+ - `lint`
45
+ - `lint:fix`
46
+ - `format`
47
+ - `format:check`
48
+
49
+ ### CLI options
50
+
51
+ ```bash
52
+ eimerreis-linting [init] [targetDir] [--force]
53
+ ```
54
+
55
+ - `targetDir`: scaffold config in another directory
56
+ - `--force`: overwrite existing `.oxlintrc.json` / `.oxfmtrc.json` and script values
57
+
58
+ ## Manual Setup
59
+
60
+ If you do not want to use the init script, create the config files manually.
61
+
62
+ `.oxlintrc.json`
63
+
64
+ ```json
65
+ {
66
+ "extends": ["./node_modules/@eimerreis/linting/oxlint.config.json"]
67
+ }
68
+ ```
69
+
70
+ `.oxfmtrc.json`
71
+
72
+ ```json
73
+ {
74
+ "extends": ["./node_modules/@eimerreis/linting/oxfmt.config.json"]
75
+ }
76
+ ```
package/bin/init.mjs ADDED
@@ -0,0 +1,102 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
4
+ import { fileURLToPath } from "node:url";
5
+ import { dirname, resolve } from "node:path";
6
+ import process from "node:process";
7
+
8
+ const packageName = "@eimerreis/linting";
9
+ const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..");
10
+
11
+ const rawArgs = process.argv.slice(2);
12
+
13
+ if (rawArgs.includes("--help") || rawArgs.includes("-h")) {
14
+ console.log("Usage: eimerreis-linting [init] [targetDir] [--force]");
15
+ process.exit(0);
16
+ }
17
+
18
+ const args = rawArgs[0] === "init" ? rawArgs.slice(1) : rawArgs;
19
+ const force = args.includes("--force");
20
+ const targetArg = args.find((arg) => !arg.startsWith("-"));
21
+ const targetDir = resolve(process.cwd(), targetArg ?? ".");
22
+
23
+ const targetPackageJsonPath = resolve(targetDir, "package.json");
24
+ const oxlintPath = resolve(targetDir, ".oxlintrc.json");
25
+ const oxfmtPath = resolve(targetDir, ".oxfmtrc.json");
26
+
27
+ function ensureDirectory(filePath) {
28
+ const dir = dirname(filePath);
29
+ if (!existsSync(dir)) {
30
+ mkdirSync(dir, { recursive: true });
31
+ }
32
+ }
33
+
34
+ function writeJson(filePath, data) {
35
+ ensureDirectory(filePath);
36
+ writeFileSync(filePath, `${JSON.stringify(data, null, 2)}\n`, "utf8");
37
+ }
38
+
39
+ function readJson(filePath) {
40
+ return JSON.parse(readFileSync(filePath, "utf8"));
41
+ }
42
+
43
+ function upsertScript(packageJson, name, command) {
44
+ if (!packageJson.scripts || typeof packageJson.scripts !== "object") {
45
+ packageJson.scripts = {};
46
+ }
47
+ if (!packageJson.scripts[name] || force) {
48
+ packageJson.scripts[name] = command;
49
+ }
50
+ }
51
+
52
+ function createExtendsConfig(targetPath, exportPath) {
53
+ if (existsSync(targetPath) && !force) {
54
+ console.log(`skip ${targetPath} (already exists)`);
55
+ return;
56
+ }
57
+
58
+ writeJson(targetPath, {
59
+ extends: [`./node_modules/${packageName}/${exportPath}`],
60
+ });
61
+ console.log(`write ${targetPath}`);
62
+ }
63
+
64
+ function maybeUpdatePackageJson() {
65
+ if (!existsSync(targetPackageJsonPath)) {
66
+ console.log("skip package.json (not found)");
67
+ return;
68
+ }
69
+
70
+ const packageJson = readJson(targetPackageJsonPath);
71
+
72
+ upsertScript(packageJson, "lint", "oxlint .");
73
+ upsertScript(packageJson, "lint:fix", "oxlint --fix .");
74
+ upsertScript(packageJson, "format", "oxfmt .");
75
+ upsertScript(packageJson, "format:check", "oxfmt --check .");
76
+
77
+ writeJson(targetPackageJsonPath, packageJson);
78
+ console.log(`update ${targetPackageJsonPath}`);
79
+ }
80
+
81
+ function printNextSteps() {
82
+ const relativePath = targetDir === process.cwd() ? "." : targetDir;
83
+ console.log("done");
84
+ console.log("next steps:");
85
+ console.log(`1) cd ${relativePath}`);
86
+ console.log("2) npm add -D @eimerreis/linting oxlint oxfmt");
87
+ console.log("3) npm run lint && npm run format:check");
88
+ }
89
+
90
+ function main() {
91
+ if (!existsSync(packageRoot)) {
92
+ console.error("init failed: package root not found");
93
+ process.exit(1);
94
+ }
95
+
96
+ createExtendsConfig(oxlintPath, "oxlint.config.json");
97
+ createExtendsConfig(oxfmtPath, "oxfmt.config.json");
98
+ maybeUpdatePackageJson();
99
+ printNextSteps();
100
+ }
101
+
102
+ main();
@@ -0,0 +1,19 @@
1
+ {
2
+ "$schema": "./node_modules/oxfmt/configuration_schema.json",
3
+ "printWidth": 125,
4
+ "tabWidth": 4,
5
+ "semi": true,
6
+ "singleQuote": false,
7
+ "trailingComma": "es5",
8
+ "sortImports": {
9
+ "order": "asc",
10
+ "ignoreCase": true,
11
+ "newlinesBetween": true,
12
+ "groups": ["builtin", "external", "internal", ["parent", "sibling", "index"]],
13
+ "internalPattern": ["@/", "~/"]
14
+ },
15
+ "sortTailwindcss": {
16
+ "functions": ["cn", "clsx", "cva", "tw"]
17
+ },
18
+ "ignorePatterns": ["node_modules/**", ".next/**", "dist/**", "build/**", "coverage/**", "out/**"]
19
+ }
@@ -0,0 +1,38 @@
1
+ {
2
+ "$schema": "./node_modules/oxlint/configuration_schema.json",
3
+ "plugins": ["eslint", "typescript", "unicorn", "oxc", "react", "nextjs", "import", "vitest"],
4
+ "categories": {
5
+ "correctness": "error",
6
+ "suspicious": "warn"
7
+ },
8
+ "env": {
9
+ "browser": true,
10
+ "node": true,
11
+ "es6": true
12
+ },
13
+ "rules": {
14
+ "eslint/no-unused-vars": [
15
+ "warn",
16
+ {
17
+ "varsIgnorePattern": "_"
18
+ }
19
+ ],
20
+ "typescript/no-explicit-any": "off",
21
+ "react/prop-types": "off",
22
+ "react/react-in-jsx-scope": "off",
23
+ "react-hooks/refs": "off",
24
+ "react-hooks/incompatible-library": "off",
25
+ "import/no-duplicates": "error",
26
+ "import/no-self-import": "error",
27
+ "import/no-cycle": "warn"
28
+ },
29
+ "ignorePatterns": ["node_modules/**", ".next/**", "dist/**", "build/**", "coverage/**", "out/**"],
30
+ "overrides": [
31
+ {
32
+ "files": ["**/*.{test,spec}.{js,jsx,ts,tsx}", "**/__tests__/**/*.{js,jsx,ts,tsx}"],
33
+ "rules": {
34
+ "typescript/no-explicit-any": "off"
35
+ }
36
+ }
37
+ ]
38
+ }
package/package.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "@eimerreis/linting",
3
+ "version": "0.1.0",
4
+ "description": "Personal OXC linting and formatting defaults",
5
+ "keywords": [
6
+ "format",
7
+ "lint",
8
+ "nextjs",
9
+ "oxc",
10
+ "oxfmt",
11
+ "oxlint",
12
+ "react",
13
+ "tailwind",
14
+ "typescript"
15
+ ],
16
+ "license": "MIT",
17
+ "bin": {
18
+ "eimerreis-linting": "bin/init.mjs"
19
+ },
20
+ "files": [
21
+ "bin",
22
+ "oxlint.config.json",
23
+ "oxfmt.config.json",
24
+ "README.md",
25
+ "LICENSE"
26
+ ],
27
+ "type": "module",
28
+ "exports": {
29
+ "./oxlint": "./oxlint.config.json",
30
+ "./oxfmt": "./oxfmt.config.json",
31
+ "./package.json": "./package.json"
32
+ },
33
+ "publishConfig": {
34
+ "access": "public"
35
+ },
36
+ "scripts": {
37
+ "changeset": "changeset",
38
+ "lint": "oxlint .",
39
+ "lint:fix": "oxlint --fix .",
40
+ "format": "oxfmt .",
41
+ "format:check": "oxfmt --check .",
42
+ "version-packages": "changeset version",
43
+ "release": "changeset publish"
44
+ },
45
+ "devDependencies": {
46
+ "@changesets/cli": "^2.29.7",
47
+ "oxfmt": "^0.41.0",
48
+ "oxlint": "^1.56.0"
49
+ },
50
+ "peerDependencies": {
51
+ "oxfmt": "^0.41.0",
52
+ "oxlint": "^1.56.0"
53
+ },
54
+ "engines": {
55
+ "node": "^20.19.0 || >=22.12.0"
56
+ }
57
+ }