@schafevormfenster/eslint-config 0.0.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 +53 -0
- package/architecture.js +5 -0
- package/base.js +5 -0
- package/caching.js +5 -0
- package/index.js +61 -0
- package/library.js +14 -0
- package/logging.js +5 -0
- package/next.js +44 -0
- package/package.json +44 -0
- package/playwright.js +18 -0
- package/rest.js +5 -0
- package/stack.js +5 -0
- package/vitest.js +15 -0
package/README.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# @schafevormfenster/eslint-config
|
|
2
|
+
|
|
3
|
+
This package serves as the central **Configuration Hub** for ESLint across the `@schafevormfenster` monorepo. It orchestrates community standards (Next.js, TypeScript, Prettier) and integrates our internal custom rules.
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
|
|
7
|
+
- **Standardization**: Ensures all projects (apps, libraries, tests) follow the same coding standards.
|
|
8
|
+
- **Simplicity**: Projects only need to install this one package instead of managing dozens of ESLint plugins and dependencies.
|
|
9
|
+
- **Modularity**: Provides composable configurations for different tech stacks (Next.js, Library, Playwright, etc.).
|
|
10
|
+
|
|
11
|
+
## General Approach
|
|
12
|
+
|
|
13
|
+
This package exports **Flat Config** arrays that can be easily combined in your project's `eslint.config.mjs`. It wraps:
|
|
14
|
+
- **Community Plugins**: `@typescript-eslint`, `@next/eslint-plugin-next`, `eslint-plugin-zod`, `eslint-plugin-playwright`, etc.
|
|
15
|
+
- **Internal Rules**: `@schafevormfenster/eslint-plugin` (Logging, Architecture, etc.).
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
In your application's `eslint.config.mjs`:
|
|
20
|
+
|
|
21
|
+
```javascript
|
|
22
|
+
import { defineConfig } from "eslint/config";
|
|
23
|
+
import svfNext from "@schafevormfenster/eslint-config/next";
|
|
24
|
+
import svfLogging from "@schafevormfenster/eslint-config/logging";
|
|
25
|
+
import svfPlaywright from "@schafevormfenster/eslint-config/playwright";
|
|
26
|
+
|
|
27
|
+
export default defineConfig([
|
|
28
|
+
// 1. Base Stack (Next.js + TypeScript + React)
|
|
29
|
+
...svfNext,
|
|
30
|
+
|
|
31
|
+
// 2. Domain Specific Rules
|
|
32
|
+
...svfLogging,
|
|
33
|
+
|
|
34
|
+
// 3. Testing Overrides (only applies to test files)
|
|
35
|
+
...svfPlaywright,
|
|
36
|
+
|
|
37
|
+
// 4. Local Overrides
|
|
38
|
+
{
|
|
39
|
+
rules: {
|
|
40
|
+
"no-console": "warn"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
]);
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Available Configurations
|
|
47
|
+
|
|
48
|
+
- **`@schafevormfenster/eslint-config`** (default): Base TypeScript & Node.js rules.
|
|
49
|
+
- **`@schafevormfenster/eslint-config/next`**: For Next.js applications (includes React & Hooks).
|
|
50
|
+
- **`@schafevormfenster/eslint-config/library`**: For pure TypeScript libraries.
|
|
51
|
+
- **`@schafevormfenster/eslint-config/logging`**: Enforces internal logging standards.
|
|
52
|
+
- **`@schafevormfenster/eslint-config/playwright`**: For E2E test suites.
|
|
53
|
+
- **`@schafevormfenster/eslint-config/vitest`**: For Unit test suites.
|
package/architecture.js
ADDED
package/base.js
ADDED
package/caching.js
ADDED
package/index.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import tseslint from "typescript-eslint";
|
|
2
|
+
import importPlugin from "eslint-plugin-import";
|
|
3
|
+
import sonarjs from "eslint-plugin-sonarjs";
|
|
4
|
+
import unicorn from "eslint-plugin-unicorn";
|
|
5
|
+
import zodPlugin from "eslint-plugin-zod";
|
|
6
|
+
import globals from "globals";
|
|
7
|
+
|
|
8
|
+
export default [
|
|
9
|
+
// TypeScript
|
|
10
|
+
...tseslint.configs.recommended,
|
|
11
|
+
|
|
12
|
+
// Import
|
|
13
|
+
importPlugin.flatConfigs.recommended,
|
|
14
|
+
|
|
15
|
+
// SonarJS
|
|
16
|
+
sonarjs.configs.recommended,
|
|
17
|
+
|
|
18
|
+
// Unicorn
|
|
19
|
+
unicorn.configs["flat/recommended"],
|
|
20
|
+
|
|
21
|
+
// Zod
|
|
22
|
+
{
|
|
23
|
+
plugins: { zod: zodPlugin },
|
|
24
|
+
rules: {
|
|
25
|
+
"zod/prefer-enum": "error",
|
|
26
|
+
"zod/require-strict": "warn"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
// Global settings
|
|
31
|
+
{
|
|
32
|
+
languageOptions: {
|
|
33
|
+
globals: {
|
|
34
|
+
...globals.node,
|
|
35
|
+
...globals.builtin,
|
|
36
|
+
},
|
|
37
|
+
parserOptions: {
|
|
38
|
+
ecmaVersion: "latest",
|
|
39
|
+
sourceType: "module",
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
rules: {
|
|
43
|
+
// Custom overrides for base config
|
|
44
|
+
"unicorn/filename-case": [
|
|
45
|
+
"error",
|
|
46
|
+
{
|
|
47
|
+
case: "kebabCase",
|
|
48
|
+
ignore: ["README.md"]
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
"import/order": [
|
|
52
|
+
"error",
|
|
53
|
+
{
|
|
54
|
+
groups: ["builtin", "external", "internal", "parent", "sibling", "index"],
|
|
55
|
+
"newlines-between": "always",
|
|
56
|
+
alphabetize: { order: "asc", caseInsensitive: true }
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
];
|
package/library.js
ADDED
package/logging.js
ADDED
package/next.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import nextPlugin from "@next/eslint-plugin-next";
|
|
2
|
+
import reactPlugin from "eslint-plugin-react";
|
|
3
|
+
import hooksPlugin from "eslint-plugin-react-hooks";
|
|
4
|
+
import globals from "globals";
|
|
5
|
+
import baseConfig from "./index.js";
|
|
6
|
+
|
|
7
|
+
export default [
|
|
8
|
+
...baseConfig,
|
|
9
|
+
{
|
|
10
|
+
files: ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"],
|
|
11
|
+
plugins: {
|
|
12
|
+
"@next/next": nextPlugin,
|
|
13
|
+
"react": reactPlugin,
|
|
14
|
+
"react-hooks": hooksPlugin,
|
|
15
|
+
},
|
|
16
|
+
rules: {
|
|
17
|
+
...nextPlugin.configs.recommended.rules,
|
|
18
|
+
...nextPlugin.configs["core-web-vitals"].rules,
|
|
19
|
+
// React recommended rules
|
|
20
|
+
...reactPlugin.configs.recommended.rules,
|
|
21
|
+
// React Hooks recommended rules
|
|
22
|
+
...hooksPlugin.configs.recommended.rules,
|
|
23
|
+
|
|
24
|
+
// Next.js specific overrides
|
|
25
|
+
"react/react-in-jsx-scope": "off",
|
|
26
|
+
"react/prop-types": "off",
|
|
27
|
+
},
|
|
28
|
+
languageOptions: {
|
|
29
|
+
globals: {
|
|
30
|
+
...globals.browser,
|
|
31
|
+
},
|
|
32
|
+
parserOptions: {
|
|
33
|
+
ecmaFeatures: {
|
|
34
|
+
jsx: true,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
settings: {
|
|
39
|
+
react: {
|
|
40
|
+
version: "detect",
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
}
|
|
44
|
+
];
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@schafevormfenster/eslint-config",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public"
|
|
6
|
+
},
|
|
7
|
+
"type": "module",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./index.js",
|
|
10
|
+
"./next": "./next.js",
|
|
11
|
+
"./library": "./library.js",
|
|
12
|
+
"./logging": "./logging.js",
|
|
13
|
+
"./playwright": "./playwright.js",
|
|
14
|
+
"./vitest": "./vitest.js",
|
|
15
|
+
"./architecture": "./architecture.js",
|
|
16
|
+
"./caching": "./caching.js",
|
|
17
|
+
"./stack": "./stack.js",
|
|
18
|
+
"./base": "./base.js",
|
|
19
|
+
"./rest": "./rest.js"
|
|
20
|
+
},
|
|
21
|
+
"peerDependencies": {
|
|
22
|
+
"eslint": "^9.0.0",
|
|
23
|
+
"typescript": "^5.0.0"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@next/eslint-plugin-next": "^16.0.0",
|
|
27
|
+
"@typescript-eslint/eslint-plugin": "^8.18.0",
|
|
28
|
+
"@typescript-eslint/parser": "^8.18.0",
|
|
29
|
+
"eslint-plugin-import": "^2.31.0",
|
|
30
|
+
"eslint-plugin-playwright": "^1.8.0",
|
|
31
|
+
"eslint-plugin-react": "^7.37.0",
|
|
32
|
+
"eslint-plugin-react-hooks": "^5.0.0",
|
|
33
|
+
"eslint-plugin-sonarjs": "^3.0.0",
|
|
34
|
+
"eslint-plugin-unicorn": "^56.0.0",
|
|
35
|
+
"eslint-plugin-vitest": "^0.5.0",
|
|
36
|
+
"eslint-plugin-zod": "^1.4.0",
|
|
37
|
+
"globals": "^15.13.0",
|
|
38
|
+
"typescript-eslint": "^8.18.0",
|
|
39
|
+
"@schafevormfenster/eslint-plugin": "0.0.1"
|
|
40
|
+
},
|
|
41
|
+
"engines": {
|
|
42
|
+
"node": ">=22"
|
|
43
|
+
}
|
|
44
|
+
}
|
package/playwright.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import playwright from "eslint-plugin-playwright";
|
|
2
|
+
import svfPlugin from "@schafevormfenster/eslint-plugin";
|
|
3
|
+
|
|
4
|
+
export default [
|
|
5
|
+
{
|
|
6
|
+
...playwright.configs["flat/recommended"],
|
|
7
|
+
files: ["**/e2e/**", "**/*.spec.ts", "**/*.test.ts"],
|
|
8
|
+
rules: {
|
|
9
|
+
...playwright.configs["flat/recommended"].rules,
|
|
10
|
+
"playwright/no-force-option": "error",
|
|
11
|
+
"playwright/no-wait-for-timeout": "error"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
...svfPlugin.configs.testing,
|
|
16
|
+
files: ["**/e2e/**", "**/*.spec.ts", "**/*.test.ts"],
|
|
17
|
+
}
|
|
18
|
+
];
|
package/rest.js
ADDED
package/stack.js
ADDED
package/vitest.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import vitest from "eslint-plugin-vitest";
|
|
2
|
+
|
|
3
|
+
export default [
|
|
4
|
+
{
|
|
5
|
+
files: ["**/*.test.ts", "**/*.spec.ts"],
|
|
6
|
+
plugins: {
|
|
7
|
+
vitest
|
|
8
|
+
},
|
|
9
|
+
rules: {
|
|
10
|
+
...vitest.configs.recommended.rules,
|
|
11
|
+
"vitest/max-nested-describe": ["error", { max: 3 }],
|
|
12
|
+
"vitest/no-identical-title": "error"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
];
|