Skip to content

Commit f113f21

Browse files
committed
feat: split eslint config into standard and strict tiers
1 parent cb562e4 commit f113f21

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+928
-599
lines changed

.changeset/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ Finally, to publish the packages, run:
2626
bun release
2727
```
2828

29-
Learn more about [Changesets](https://github.com/changesets/changesets) in the official documentation.
29+
Learn more about [Changesets](https://github.com/changesets/changesets) in the official documentation.

.changeset/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
"baseBranch": "main",
99
"updateInternalDependencies": "patch",
1010
"ignore": []
11-
}
11+
}

.github/workflows/ci-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343

4444
- name: Run Build
4545
run: bun run build
46-
46+
4747
- name: Create Release Pull Request or Publish to npm
4848
id: changesets
4949
uses: changesets/action@v1

bun.lock

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@
1212
},
1313
"devDependencies": {
1414
"@changesets/cli": "^2.28.1",
15+
"eslint": "^9.x",
1516
"turbo": "latest",
1617
},
1718
},
1819
"packages/eslint-config-sylph": {
1920
"name": "@sylphlab/eslint-config-sylph",
20-
"version": "3.2.5",
21+
"version": "3.3.0",
2122
"dependencies": {
2223
"globals": "^16.0.0",
2324
},
@@ -69,7 +70,7 @@
6970
},
7071
"packages/eslint-config-sylph-react": {
7172
"name": "@sylphlab/eslint-config-sylph-react",
72-
"version": "5.0.3",
73+
"version": "6.0.0",
7374
"devDependencies": {
7475
"@sylphlab/eslint-config-sylph": "workspace:*",
7576
"@sylphlab/typescript-config": "workspace:*",
@@ -80,7 +81,7 @@
8081
},
8182
"peerDependencies": {
8283
"@eslint/js": "^9.24.0",
83-
"@sylphlab/eslint-config-sylph": "^3.2.3",
84+
"@sylphlab/eslint-config-sylph": "^3.3.0",
8485
"@typescript-eslint/eslint-plugin": "^8.29.1",
8586
"@typescript-eslint/parser": "^8.29.1",
8687
"eslint": "^9.24.0",
@@ -106,13 +107,14 @@
106107
},
107108
"packages/eslint-config-sylph-rn": {
108109
"name": "@sylphlab/eslint-config-sylph-rn",
109-
"version": "5.0.3",
110+
"version": "6.0.0",
110111
"dependencies": {
111112
"@sylphlab/eslint-config-sylph-react": "workspace:*",
112113
"@sylphlab/typescript-config": "workspace:*",
113114
},
114115
"devDependencies": {
115116
"@types/node": "^22.14.0",
117+
"eslint": "^9.x",
116118
"jiti": "^2.4.2",
117119
"typescript": "^5.8.3",
118120
"typescript-eslint": "^8.29.1",
@@ -145,9 +147,26 @@
145147
"typescript": "^5.8.3",
146148
},
147149
},
150+
"packages/eslint-config-sylph-strict": {
151+
"name": "@sylphlab/eslint-config-sylph-strict",
152+
"version": "0.1.0",
153+
"dependencies": {
154+
"@sylphlab/eslint-config-sylph": "workspace:*",
155+
},
156+
"peerDependencies": {
157+
"@eslint/js": "^9.x",
158+
"eslint": "^9.x",
159+
"eslint-plugin-functional": "^6.x",
160+
"typescript": "^5.x",
161+
"typescript-eslint": "^7.x",
162+
},
163+
"optionalPeers": [
164+
"typescript",
165+
],
166+
},
148167
"packages/eslint-config-sylph-vue": {
149168
"name": "@sylphlab/eslint-config-sylph-vue",
150-
"version": "5.0.4",
169+
"version": "6.0.0",
151170
"devDependencies": {
152171
"@sylphlab/eslint-config-sylph": "workspace:*",
153172
"@sylphlab/typescript-config": "workspace:*",
@@ -511,6 +530,8 @@
511530

512531
"@sylphlab/eslint-config-sylph-rn": ["@sylphlab/eslint-config-sylph-rn@workspace:packages/eslint-config-sylph-rn"],
513532

533+
"@sylphlab/eslint-config-sylph-strict": ["@sylphlab/eslint-config-sylph-strict@workspace:packages/eslint-config-sylph-strict"],
534+
514535
"@sylphlab/eslint-config-sylph-vue": ["@sylphlab/eslint-config-sylph-vue@workspace:packages/eslint-config-sylph-vue"],
515536

516537
"@sylphlab/prettier-config": ["@sylphlab/prettier-config@workspace:packages/prettier-config"],

docs/best-practices/core-principles.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ This section outlines the fundamental principles for writing high-quality TypeSc
1414
- Prioritize pure functions (predictable output for the same input, no side effects).
1515
- Avoid mutating data directly; prefer creating new data structures (immutability).
1616
- Use higher-order functions (`map`, `filter`, `reduce`) and function composition for data manipulation.
17-
- Utilize libraries like `fp-ts` or `Ramda` for robust functional patterns, composition, and managing side effects, especially in complex domains. Leverage `Immer` for easier immutable state updates where applicable.
17+
- Utilize libraries like `fp-ts` or `Ramda` for robust functional patterns, composition, and managing side effects, especially in complex domains. Leverage `Immer` for easier immutable state updates where applicable.

docs/best-practices/structure-patterns.md

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -44,36 +44,38 @@ This section details the recommended project structure for TypeScript NPM packag
4444
## 2. Advanced TypeScript Patterns (Encouraged)
4545

4646
- **Immutability**:
47-
- Use `readonly` modifiers for properties and `Readonly<T>` / `ReadonlyArray<T>` (`@typescript-eslint/prefer-readonly`).
48-
- Leverage TypeScript's `const` assertions (`as const`) for literal types when creating immutable constants.
47+
- Use `readonly` modifiers for properties and `Readonly<T>` / `ReadonlyArray<T>` (`@typescript-eslint/prefer-readonly`).
48+
- Leverage TypeScript's `const` assertions (`as const`) for literal types when creating immutable constants.
4949
- **Type Safety**:
50-
- Use branded types or nominal typing techniques for primitive type safety where applicable (e.g., distinguishing between different kinds of string IDs).
51-
- Prefer discriminated unions for modeling state or variants over loose objects or class hierarchies.
50+
- Use branded types or nominal typing techniques for primitive type safety where applicable (e.g., distinguishing between different kinds of string IDs).
51+
- Prefer discriminated unions for modeling state or variants over loose objects or class hierarchies.
5252
- **Object Creation**:
53-
- Implement the Builder pattern for complex object creation to ensure valid states.
54-
- Use factory functions or static methods instead of complex constructors.
53+
- Implement the Builder pattern for complex object creation to ensure valid states.
54+
- Use factory functions or static methods instead of complex constructors.
5555
- **Operations on Types**:
56-
- Apply the Visitor pattern for type-safe operations on discriminated unions.
57-
- Leverage Mapped Types (`Pick`, `Omit`, `Partial`, `Required`, custom) for consistent type transformations.
58-
- Use the `satisfies` operator for ensuring type compatibility without changing the inferred type.
56+
- Apply the Visitor pattern for type-safe operations on discriminated unions.
57+
- Leverage Mapped Types (`Pick`, `Omit`, `Partial`, `Required`, custom) for consistent type transformations.
58+
- Use the `satisfies` operator for ensuring type compatibility without changing the inferred type.
5959

6060
## 3. Best Practices
6161

6262
- **Error Handling**:
63-
- Primarily use discriminated union result types (e.g., `{ success: true, data: T } | { success: false, error: E }`, potentially using helper libraries) for handling predictable errors, making failure an explicit part of the function's contract.
64-
- Reserve throwing exceptions for truly exceptional, unrecoverable situations (e.g., programming errors, critical infrastructure failures). When throwing, use custom error classes extending `Error`.
65-
- Always include context and potentially the original error (`cause`) when creating errors or error results.
66-
- Validate API boundaries and external data rigorously using runtime validation libraries (like Zod, io-ts) that integrate with TypeScript types to ensure data integrity.
63+
64+
- Primarily use discriminated union result types (e.g., `{ success: true, data: T } | { success: false, error: E }`, potentially using helper libraries) for handling predictable errors, making failure an explicit part of the function's contract.
65+
- Reserve throwing exceptions for truly exceptional, unrecoverable situations (e.g., programming errors, critical infrastructure failures). When throwing, use custom error classes extending `Error`.
66+
- Always include context and potentially the original error (`cause`) when creating errors or error results.
67+
- Validate API boundaries and external data rigorously using runtime validation libraries (like Zod, io-ts) that integrate with TypeScript types to ensure data integrity.
6768

6869
- **Asynchronous Code**:
69-
- Always prefer `async/await` for readability over raw `Promise.then/catch` chains.
70-
- Ensure all Promises are handled (use `@typescript-eslint/no-floating-promises` lint rule).
71-
- Use `Promise.all` / `Promise.allSettled` for concurrency.
72-
- Avoid the `new Promise()` constructor anti-pattern; use `async` functions instead.
73-
- Implement cancellation patterns (e.g., using `AbortController`) for long-running async operations where appropriate.
70+
71+
- Always prefer `async/await` for readability over raw `Promise.then/catch` chains.
72+
- Ensure all Promises are handled (use `@typescript-eslint/no-floating-promises` lint rule).
73+
- Use `Promise.all` / `Promise.allSettled` for concurrency.
74+
- Avoid the `new Promise()` constructor anti-pattern; use `async` functions instead.
75+
- Implement cancellation patterns (e.g., using `AbortController`) for long-running async operations where appropriate.
7476

7577
- **Performance Optimizations**:
76-
- Be mindful of object and array allocations within loops or frequently called functions.
77-
- Use `Set` and `Map` for efficient lookups (O(1) average) compared to array methods like `find` or `includes` (O(n)).
78-
- Employ lazy initialization for expensive resources or computations.
79-
- Profile code using Node.js inspector or other tools to identify bottlenecks before optimizing prematurely.
78+
- Be mindful of object and array allocations within loops or frequently called functions.
79+
- Use `Set` and `Map` for efficient lookups (O(1) average) compared to array methods like `find` or `includes` (O(n)).
80+
- Employ lazy initialization for expensive resources or computations.
81+
- Profile code using Node.js inspector or other tools to identify bottlenecks before optimizing prematurely.

0 commit comments

Comments
 (0)