mm_eslint 1.4.4 → 1.4.6
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 +56 -19
- package/README_EN.md +57 -20
- package/index.js +200 -1045
- package/{config.js → lib/config.js} +95 -30
- package/{corrector.js → lib/corrector.js} +54 -2
- package/lib/detector/class_instance_name.js +246 -0
- package/lib/detector/class_name.js +261 -0
- package/lib/detector/const_name.js +519 -0
- package/lib/detector/function_name.js +318 -0
- package/lib/detector/index.js +18 -0
- package/lib/detector/name.js +626 -0
- package/lib/detector/object_name.js +245 -0
- package/lib/detector/param_name.js +247 -0
- package/lib/detector/variable_name.js +286 -0
- package/lib/fix/class_fix.js +83 -0
- package/lib/fix/export_fix.js +169 -0
- package/lib/fix/function_fix.js +85 -0
- package/lib/fix/index.js +21 -0
- package/lib/fix/method_fix.js +82 -0
- package/lib/fix/param_fix.js +63 -0
- package/lib/fix/property_fix.js +93 -0
- package/lib/fix/variable_fix.js +134 -0
- package/lib/fix.js +160 -0
- package/lib/tip.js +85 -0
- package/{util.js → lib/util.js} +8 -0
- package/{validator.js → lib/validator.js} +12 -16
- package/package.json +13 -11
- package/detector.js +0 -1239
- package/eslint.config.js +0 -22
- package/tip.js +0 -71
package/README.md
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
[](https://www.npmjs.com/package/mm_eslint)
|
|
6
6
|
[](https://opensource.org/licenses/ISC)
|
|
7
7
|
[](https://nodejs.org/)
|
|
8
|
+
[](https://www.npmjs.com/package/mm_eslint)
|
|
9
|
+
[](https://gitee.com/qiuwenwu91/mm_eslint/stargazers)
|
|
8
10
|
|
|
9
11
|
## 功能特性
|
|
10
12
|
|
|
@@ -22,12 +24,12 @@
|
|
|
22
24
|
## 实际支持的规则
|
|
23
25
|
|
|
24
26
|
插件实际支持以下ESLint规则:
|
|
25
|
-
- `
|
|
26
|
-
- `
|
|
27
|
-
- `
|
|
28
|
-
- `
|
|
29
|
-
- `
|
|
30
|
-
- `
|
|
27
|
+
- `mm_eslint/class-name` - 类名检测
|
|
28
|
+
- `mm_eslint/class-instance-name` - 类实例名检测
|
|
29
|
+
- `mm_eslint/function-name` - 函数名检测
|
|
30
|
+
- `mm_eslint/param-name` - 参数名检测
|
|
31
|
+
- `mm_eslint/variable-name` - 变量名检测
|
|
32
|
+
- `mm_eslint/constant-name` - 常量名检测
|
|
31
33
|
|
|
32
34
|
## 安装
|
|
33
35
|
|
|
@@ -54,28 +56,30 @@ cp mm_eslint/index.js your-project/eslint-plugins/
|
|
|
54
56
|
|
|
55
57
|
```javascript
|
|
56
58
|
// eslint.config.js
|
|
57
|
-
const
|
|
59
|
+
const mmEslint = require('mm_eslint');
|
|
58
60
|
|
|
59
61
|
module.exports = [
|
|
60
62
|
{
|
|
61
|
-
files: [
|
|
63
|
+
files: ['**/*.js'],
|
|
62
64
|
plugins: {
|
|
63
|
-
|
|
65
|
+
mm_eslint: {
|
|
66
|
+
rules: mmEslint
|
|
67
|
+
}
|
|
64
68
|
},
|
|
65
69
|
rules: {
|
|
66
70
|
// 命名规范插件规则
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
'mm_eslint/class-name': 'error',
|
|
72
|
+
'mm_eslint/class-instance-name': 'error',
|
|
73
|
+
'mm_eslint/function-name': 'error',
|
|
74
|
+
'mm_eslint/param-name': 'warn',
|
|
75
|
+
'mm_eslint/variable-name': 'warn',
|
|
76
|
+
'mm_eslint/constant-name': 'error',
|
|
73
77
|
|
|
74
78
|
// 禁用与命名规范插件冲突的默认规则
|
|
75
|
-
camelcase:
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
+
camelcase: 'off',
|
|
80
|
+
'id-match': 'off',
|
|
81
|
+
'new-cap': 'off',
|
|
82
|
+
'id-length': 'off',
|
|
79
83
|
},
|
|
80
84
|
},
|
|
81
85
|
];
|
|
@@ -273,7 +277,10 @@ mm_eslint/
|
|
|
273
277
|
├── corrector.js # 命名修正器
|
|
274
278
|
├── tip.js # 提示信息
|
|
275
279
|
├── util.js # 工具函数
|
|
280
|
+
├── handler.js # 规则处理器
|
|
281
|
+
├── fix.js # 自动修复功能
|
|
276
282
|
├── package.json # npm配置
|
|
283
|
+
├── eslint.config.js # ESLint配置示例
|
|
277
284
|
├── README.md # 中文说明文档
|
|
278
285
|
├── README_EN.md # 英文说明文档
|
|
279
286
|
├── LICENSE # 许可证
|
|
@@ -293,6 +300,30 @@ npm test
|
|
|
293
300
|
npm run lint
|
|
294
301
|
```
|
|
295
302
|
|
|
303
|
+
## 发布说明
|
|
304
|
+
|
|
305
|
+
### npm发布
|
|
306
|
+
|
|
307
|
+
插件已发布到npm,可以通过以下命令安装:
|
|
308
|
+
|
|
309
|
+
```bash
|
|
310
|
+
npm install mm_eslint --save-dev
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
### 版本管理
|
|
314
|
+
|
|
315
|
+
项目使用语义化版本控制(Semantic Versioning):
|
|
316
|
+
- **主版本号**:不兼容的API修改
|
|
317
|
+
- **次版本号**:向下兼容的功能性新增
|
|
318
|
+
- **修订号**:向下兼容的问题修正
|
|
319
|
+
|
|
320
|
+
### 发布流程
|
|
321
|
+
|
|
322
|
+
1. 更新版本号:`npm version patch|minor|major`
|
|
323
|
+
2. 运行测试:`npm test`
|
|
324
|
+
3. 代码检查:`npm run lint`
|
|
325
|
+
4. 发布到npm:`npm publish`
|
|
326
|
+
|
|
296
327
|
## 许可证
|
|
297
328
|
|
|
298
329
|
ISC License
|
|
@@ -303,6 +334,12 @@ ISC License
|
|
|
303
334
|
|
|
304
335
|
## 更新日志
|
|
305
336
|
|
|
337
|
+
### v1.4.4
|
|
338
|
+
- 更新插件名称和规则前缀为 `mm_eslint`
|
|
339
|
+
- 优化模块结构和文件组织
|
|
340
|
+
- 增强测试覆盖率和错误处理
|
|
341
|
+
- 改进文档和示例
|
|
342
|
+
|
|
306
343
|
### v1.4.3
|
|
307
344
|
- 优化模块结构和文件组织
|
|
308
345
|
- 增强测试覆盖率和错误处理
|
package/README_EN.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
# MM ESLint Plugin
|
|
2
2
|
|
|
3
|
-
ESLint plugin for personal naming conventions - supports PascalCase, camelCase, snake_case, and UPPER_SNAKE_CASE naming rules.
|
|
3
|
+
ESLint plugin for personal naming conventions - supports PascalCase, camelCase, snake_case, and UPPER_SNAKE_CASE naming rules with intelligent recommendations.
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/mm_eslint)
|
|
6
6
|
[](https://opensource.org/licenses/ISC)
|
|
7
7
|
[](https://nodejs.org/)
|
|
8
|
+
[](https://www.npmjs.com/package/mm_eslint)
|
|
9
|
+
[](https://gitee.com/qiuwenwu91/mm_eslint/stargazers)
|
|
8
10
|
|
|
9
11
|
## Features
|
|
10
12
|
|
|
@@ -22,12 +24,12 @@ ESLint plugin for personal naming conventions - supports PascalCase, camelCase,
|
|
|
22
24
|
## Actual Supported Rules
|
|
23
25
|
|
|
24
26
|
The plugin actually supports the following ESLint rules:
|
|
25
|
-
- `
|
|
26
|
-
- `
|
|
27
|
-
- `
|
|
28
|
-
- `
|
|
29
|
-
- `
|
|
30
|
-
- `
|
|
27
|
+
- `mm_eslint/class-name` - Class name detection
|
|
28
|
+
- `mm_eslint/class-instance-name` - Class instance name detection
|
|
29
|
+
- `mm_eslint/function-name` - Function name detection
|
|
30
|
+
- `mm_eslint/param-name` - Parameter name detection
|
|
31
|
+
- `mm_eslint/variable-name` - Variable name detection
|
|
32
|
+
- `mm_eslint/constant-name` - Constant name detection
|
|
31
33
|
|
|
32
34
|
## Installation
|
|
33
35
|
|
|
@@ -54,28 +56,30 @@ Import the plugin in your ESLint configuration file:
|
|
|
54
56
|
|
|
55
57
|
```javascript
|
|
56
58
|
// eslint.config.js
|
|
57
|
-
const
|
|
59
|
+
const mmEslint = require('mm_eslint');
|
|
58
60
|
|
|
59
61
|
module.exports = [
|
|
60
62
|
{
|
|
61
|
-
files: [
|
|
63
|
+
files: ['**/*.js'],
|
|
62
64
|
plugins: {
|
|
63
|
-
|
|
65
|
+
mm_eslint: {
|
|
66
|
+
rules: mmEslint
|
|
67
|
+
}
|
|
64
68
|
},
|
|
65
69
|
rules: {
|
|
66
70
|
// Naming convention plugin rules
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
'mm_eslint/class-name': 'error',
|
|
72
|
+
'mm_eslint/class-instance-name': 'error',
|
|
73
|
+
'mm_eslint/function-name': 'error',
|
|
74
|
+
'mm_eslint/param-name': 'warn',
|
|
75
|
+
'mm_eslint/variable-name': 'warn',
|
|
76
|
+
'mm_eslint/constant-name': 'error',
|
|
73
77
|
|
|
74
78
|
// Disable default rules conflicting with naming convention plugin
|
|
75
|
-
camelcase:
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
+
camelcase: 'off',
|
|
80
|
+
'id-match': 'off',
|
|
81
|
+
'new-cap': 'off',
|
|
82
|
+
'id-length': 'off',
|
|
79
83
|
},
|
|
80
84
|
},
|
|
81
85
|
];
|
|
@@ -273,7 +277,10 @@ mm_eslint/
|
|
|
273
277
|
├── corrector.js # Name corrector
|
|
274
278
|
├── tip.js # Tip messages
|
|
275
279
|
├── util.js # Utility functions
|
|
280
|
+
├── handler.js # Rule handler
|
|
281
|
+
├── fix.js # Auto-fix functionality
|
|
276
282
|
├── package.json # npm configuration
|
|
283
|
+
├── eslint.config.js # ESLint configuration example
|
|
277
284
|
├── README.md # Chinese documentation
|
|
278
285
|
├── README_EN.md # English documentation
|
|
279
286
|
├── LICENSE # License
|
|
@@ -293,6 +300,30 @@ npm test
|
|
|
293
300
|
npm run lint
|
|
294
301
|
```
|
|
295
302
|
|
|
303
|
+
## Publishing Information
|
|
304
|
+
|
|
305
|
+
### npm Publishing
|
|
306
|
+
|
|
307
|
+
The plugin is published to npm and can be installed via:
|
|
308
|
+
|
|
309
|
+
```bash
|
|
310
|
+
npm install mm_eslint --save-dev
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
### Version Management
|
|
314
|
+
|
|
315
|
+
Project uses Semantic Versioning:
|
|
316
|
+
- **Major version**: Incompatible API changes
|
|
317
|
+
- **Minor version**: Backward-compatible functionality additions
|
|
318
|
+
- **Patch version**: Backward-compatible bug fixes
|
|
319
|
+
|
|
320
|
+
### Publishing Process
|
|
321
|
+
|
|
322
|
+
1. Update version: `npm version patch|minor|major`
|
|
323
|
+
2. Run tests: `npm test`
|
|
324
|
+
3. Code linting: `npm run lint`
|
|
325
|
+
4. Publish to npm: `npm publish`
|
|
326
|
+
|
|
296
327
|
## License
|
|
297
328
|
|
|
298
329
|
ISC License
|
|
@@ -303,6 +334,12 @@ Issues and Pull Requests are welcome to improve this plugin.
|
|
|
303
334
|
|
|
304
335
|
## Changelog
|
|
305
336
|
|
|
337
|
+
### v1.4.4
|
|
338
|
+
- Updated plugin name and rule prefix to `mm_eslint`
|
|
339
|
+
- Optimized module structure and file organization
|
|
340
|
+
- Enhanced test coverage and error handling
|
|
341
|
+
- Improved documentation and examples
|
|
342
|
+
|
|
306
343
|
### v1.4.3
|
|
307
344
|
- Optimized module structure and file organization
|
|
308
345
|
- Enhanced test coverage and error handling
|