@vexjs/forbid-lint 0.0.3 → 0.0.4

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.
Files changed (3) hide show
  1. package/README.EN.md +158 -0
  2. package/README.md +8 -6
  3. package/package.json +1 -1
package/README.EN.md ADDED
@@ -0,0 +1,158 @@
1
+ [中文文档](./README.md)
2
+
3
+ # forbid-lint
4
+
5
+ A plugin for frontend projects to prevent modifications to lint files. Since the purpose of this plugin is to avoid modifications to various lint files, it currently only supports configuring file names in the project root directory. Support for configuring sub-level file names will be added in the future.
6
+
7
+ ### Plugin Usage
8
+
9
+ 1. Installation
10
+
11
+ Global Installation
12
+
13
+ ```shell
14
+ npm install @vexjs/forbid-lint -g
15
+ or
16
+ pnpm install @vexjs/forbid-lint -g
17
+ or
18
+ yarn add @vexjs/forbid-lint -g
19
+ ````
20
+
21
+ Project Installation (Recommended)
22
+
23
+ ```shell
24
+ npm install @vexjs/forbid-lint -D
25
+ or
26
+ pnpm install @vexjs/forbid-lint -D
27
+ or
28
+ yarn add @vexjs/forbid-lint -D
29
+ ```
30
+
31
+ 2. Usage
32
+
33
+ `There are two ways to use it, let's introduce the first one:`
34
+
35
+ ---
36
+
37
+ **Manual Configuration File Creation**
38
+
39
+ 1. Create a `.forbidrc.json` file in the project root directory with the following configuration:
40
+
41
+ ```json
42
+ // Add the file names you don't want to be modified to lintFiles
43
+ {
44
+ "lintFiles": [
45
+ ".eslintrc.js",
46
+ ".eslintrc.json",
47
+ ".eslintrc.yml",
48
+ xxx
49
+ ]
50
+ }
51
+ ```
52
+
53
+ TIP: If you don't create this file, the following default file names will be used for validation
54
+
55
+ ```md
56
+ # Default files that are forbidden to modify
57
+
58
+ .eslintrc.js
59
+ .eslintrc.cjs
60
+ .eslintrc.yaml
61
+ .eslintrc.yml
62
+ .eslintrc.json
63
+ eslint.config.js
64
+ eslint.config.mjs
65
+ eslint.config.cjs
66
+ eslint.config.ts
67
+ eslint.config.mts
68
+ eslint.config.cts
69
+ ```
70
+
71
+ 2. Install husky and configure the `pre-commit` hook. Installing and configuring husky is straightforward, you can refer to [husky guide](https://typicode.github.io/husky/). Add the following content to the pre-commit hook:
72
+
73
+ ```shell
74
+ npx forbid-lint check
75
+ ```
76
+
77
+ 3. During git commit, the forbid-lint check command will be executed in the pre-commit hook. If any forbidden files are detected as modified, it will show a warning message and exit the git commit process.
78
+
79
+ ---
80
+
81
+ ### CLI Usage
82
+
83
+ **CLI Command Introduction**
84
+
85
+ ![forbid-lint cli](https://www.yanquankun.cn/cdn/forbid-lint-cli.png)
86
+
87
+ 1. forbid-lint init for initialization
88
+
89
+ 2. forbid-lint check to detect if there are any forbidden files in the staging area
90
+
91
+ `TIP: If you encounter "sh: xxx/bin/forbid-lint: Permission denied" when running CLI commands, you can fix it by running:`
92
+
93
+ ```shell
94
+ chmod +x xxx/forbid-lint/bin/forbid-lint
95
+ ```
96
+
97
+ ---
98
+
99
+ **CLI Configuration File Creation**
100
+
101
+ 1. Run the following CLI command to initialize:
102
+
103
+ ```shell
104
+ # For global installation
105
+ forbid-lint init
106
+
107
+ # For project installation
108
+ npx forbid-lint init
109
+ ```
110
+
111
+ 2. Choose whether to automatically generate the following configurations based on the CLI tool's prompts:
112
+
113
+ 2.1 husky: Automatically install husky (9.1.7) plugin, create .husky directory, generate pre-commit hook, and configure the hook with forbid-lint check [You can also choose to reject automatic installation and install husky manually]
114
+
115
+ 2.2 .forbidrc.json: Automatically generate .forbidrc.json file in the project root directory with the following content: {"lintFiles": [".eslintrc.js", ".eslintrc.json", ".eslintrc.yml"]}
116
+
117
+ ---
118
+
119
+ ### Development
120
+
121
+ ```json
122
+ pnpm dev
123
+ ```
124
+
125
+ Start Node service and run src/index.ts
126
+
127
+ ### Testing
128
+
129
+ ```shell
130
+ pnpm test
131
+ ```
132
+
133
+ 1. Watch for changes in ts files in the src directory
134
+ 2. Dynamically update forbid-lint library for the **demo** directory
135
+
136
+ ### Build
137
+
138
+ ```shell
139
+ pnpm build
140
+ ```
141
+
142
+ ### Unit Testing
143
+
144
+ ```shell
145
+ pnpm jest
146
+ ```
147
+
148
+ ### Publishing
149
+
150
+ ```shell
151
+ pnpm publishCI [x.y.z]
152
+ ```
153
+
154
+ ---
155
+
156
+ ### Overall Flow Chart
157
+
158
+ ![Overall Flow Chart](https://www.yanquankun.cn/cdn/forbid-lint.png)
package/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [English Docs](./README.EN.md)
2
+
1
3
  # forbid-lint
2
4
 
3
5
  一个用于前端工程中禁止修改 lint 文件的插件,由于本插件目的是避免各种 lint 文件的修改,所以目前只支持配置项目根目录的配置文件名,后续会支持配置子级文件名~
@@ -9,21 +11,21 @@
9
11
  全局安装
10
12
 
11
13
  ```shell
12
- npm install forbid-lint -g
14
+ npm install @vexjs/forbid-lint -g
13
15
  or
14
- pnpm install forbid-lint -g
16
+ pnpm install @vexjs/forbid-lint -g
15
17
  or
16
- yarn add forbid-lint -g
18
+ yarn add @vexjs/forbid-lint -g
17
19
  ```
18
20
 
19
21
  项目内安装(建议采用这种方式)
20
22
 
21
23
  ```shell
22
- npm install forbid-lint -D
24
+ npm install @vexjs/forbid-lint -D
23
25
  or
24
- pnpm install forbid-lint -D
26
+ pnpm install @vexjs/forbid-lint -D
25
27
  or
26
- yarn add forbid-lint -D
28
+ yarn add @vexjs/forbid-lint -D
27
29
  ```
28
30
 
29
31
  2. 使用
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vexjs/forbid-lint",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "一个用于前端工程中禁止修改lint文件的插件",
5
5
  "main": "dist/index.js",
6
6
  "bin": {