fenge 0.6.0 → 0.6.2
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/CHANGELOG.md +16 -0
- package/README.md +48 -2
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# fenge
|
|
2
2
|
|
|
3
|
+
## 0.6.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [b6cbd84]
|
|
8
|
+
- @fenge/eslint-config@0.5.13
|
|
9
|
+
|
|
10
|
+
## 0.6.1
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies [1c16e81]
|
|
15
|
+
- Updated dependencies [995ac57]
|
|
16
|
+
- @fenge/tsconfig@0.4.1
|
|
17
|
+
- @fenge/eslint-config@0.5.12
|
|
18
|
+
|
|
3
19
|
## 0.6.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -73,7 +73,53 @@
|
|
|
73
73
|
|
|
74
74
|
<details>
|
|
75
75
|
<summary>English</summary>
|
|
76
|
-
|
|
76
|
+
|
|
77
|
+
### Core: `Type Safety`, `Formatting`, and `Linting`
|
|
78
|
+
|
|
79
|
+
After years of practice, we have found that the three main aspects affecting modern JavaScript project code quality and development experience are:
|
|
80
|
+
|
|
81
|
+
- **Type Safety**: Used to detect type and spelling errors in advance, such as whether object methods are called correctly, whether function parameters match the expected types within the function body, etc.
|
|
82
|
+
- **Formatting**: Used to unify code style, improve readability, and reduce conflicts. It mainly focuses on issues like indentation, line breaks, single/double quotes, with/without semicolons, etc.
|
|
83
|
+
- **Linting**: Used to identify logical flaws and poor practices early, reducing bugs and maintenance costs. Its focus can be anywhere except for `Formatting`, such as redefining variables, switch statements without break, cyclomatic complexity, etc.
|
|
84
|
+
|
|
85
|
+
These three aspects are also built-in features in more advanced runtimes like [Deno](https://deno.com), which [Node](https://nodejs.org) does not natively support. Instead, the community offers a variety of tools: TypeScript, Flow, Biome, ESLint, oxc-lint, Prettier, dprint. Using these tools in Node projects brings three major issues impacting **development experience**:
|
|
86
|
+
|
|
87
|
+
- **Tool Selection Problem**: Which set of tools should I choose to optimize the above three problems? If I choose different toolsets for the next Node project, how do I handle it?
|
|
88
|
+
- **Tool Conflict and Integration Problem**: After determining the tools to use, do these tools conflict with each other? Should formatting or linting come first when committing code? What is the best practice for integrating these tools?
|
|
89
|
+
- **Complex Configuration Problem**: Each tool has complex and difficult-to-understand configurations scattered across the project root directory (or `package.json`). This not only looks messy but also increases the learning curve. Even if the tools are consistent across Node projects, the configurations may vary, leading to inconsistent development experiences.
|
|
90
|
+
|
|
91
|
+
To address these issues, there are now many tutorials explaining the configuration and practices of TypeScript + Prettier + ESLint, which can alleviate some problems but still expose users to a cluttered toolchain and cumbersome configurations. Our goal is not this; our goal is to **provide a unified tool that abstracts away these complex details, offering a simple, consistent, and ready-to-use development experience**.
|
|
92
|
+
|
|
93
|
+
### Relationship between `Type Safety`, `Formatting`, and `Linting`
|
|
94
|
+
|
|
95
|
+
To illustrate the relationship among these three, let's take the most representative solutions `TypeScript`, `Prettier`, and `ESLint` as examples.
|
|
96
|
+
|
|
97
|
+
| - | Type Safety | Formatting | Linting |
|
|
98
|
+
| -------------- | ----------- | ---------- | ------- |
|
|
99
|
+
| Representative | TypeScript | Prettier | ESLint |
|
|
100
|
+
| Focus on Logic | ✅ | ❌ | ✅ |
|
|
101
|
+
| Auto Fixing | ❌ | ✅ | ✅ |
|
|
102
|
+
|
|
103
|
+
Over time, these three areas have developed certain intersections:
|
|
104
|
+
|
|
105
|
+
1. Intersection between `Type Safety` and `Linting`: For example, "mismatched function parameter count" can be detected by both TypeScript and ESLint.
|
|
106
|
+
2. Intersection between `Formatting` and `Linting`: For example, "whether to end with a semicolon" or "use single or double quotes" can be detected and fixed by both Prettier and ESLint.
|
|
107
|
+
|
|
108
|
+
Although there are overlaps among them today, the ideal situation is that **Type Safety, Formatting, and Linting focus on different domains without overlap**.
|
|
109
|
+
|
|
110
|
+
### Why Separate Formatting from Linting
|
|
111
|
+
|
|
112
|
+
While `Type Safety` might also overlap with `Linting`, the community generally does not confuse TypeScript with ESLint, so this aspect is not elaborated here. However, many people in the community combine `Formatting` and `Linting` together, such as [@antfu/eslint-config](https://github.com/antfu/eslint-config). We strongly **do not recommend** doing this for several reasons:
|
|
113
|
+
|
|
114
|
+
1. They serve different purposes; specialized tasks should be handled by specialized tools.
|
|
115
|
+
2. Formatting and Linting impose different cognitive loads. When reviewing code, we often don't need to pay attention to Formatting changes, but we must carefully check Linting changes because Formatting changes are generally safe, while Linting changes may contain incorrect fixes.
|
|
116
|
+
3. Since Linting changes may contain incorrect fixes, when used with Git Hooks, mixing Linting and Formatting fixes can lead to erroneous fixes entering Git Commits directly, making bugs harder to detect.
|
|
117
|
+
4. The community trend is to separate Formatters and Linters. For example, early versions of ESLint were also used for formatting, but starting from v8.53.0, [ESLint deprecated Formatting Rules](https://eslint.org/blog/2023/10/deprecating-formatting-rules). Deno and Biome also separate `Linter` and `Formatter`.
|
|
118
|
+
|
|
119
|
+
### Summary
|
|
120
|
+
|
|
121
|
+
In summary, Type Safety, Formatting, and Linting are three indispensable aspects of the future JavaScript and TypeScript code ecosystem. Before Node provides official solutions, these three areas have been fragmented, difficult to use, and negatively impacted code quality. We couldn't wait for Node to provide related solutions, so we created `Fenge` to shield developers from complexity, simplify their workflow, and allow them to focus on business logic.
|
|
122
|
+
|
|
77
123
|
</details>
|
|
78
124
|
|
|
79
125
|
## Features
|
|
@@ -131,7 +177,7 @@ Config `tsconfig.build.json` file in your project root.
|
|
|
131
177
|
{
|
|
132
178
|
"extends": "./tsconfig.json",
|
|
133
179
|
"include": ["src"],
|
|
134
|
-
"exclude": ["**/*.
|
|
180
|
+
"exclude": ["**/*.test.ts"]
|
|
135
181
|
}
|
|
136
182
|
```
|
|
137
183
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fenge",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"description": "A CLI tool for code quality",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -51,9 +51,9 @@
|
|
|
51
51
|
"ora": "8.2.0",
|
|
52
52
|
"prettier": "3.5.3",
|
|
53
53
|
"yoctocolors": "2.1.1",
|
|
54
|
-
"@fenge/eslint-config": "0.5.
|
|
54
|
+
"@fenge/eslint-config": "0.5.13",
|
|
55
|
+
"@fenge/tsconfig": "0.4.1",
|
|
55
56
|
"@fenge/prettier-config": "0.2.2",
|
|
56
|
-
"@fenge/tsconfig": "0.4.0",
|
|
57
57
|
"@fenge/types": "0.2.0",
|
|
58
58
|
"prettier-ignore": "0.2.0"
|
|
59
59
|
},
|