mm_eslint 1.0.4 → 1.0.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.
Files changed (2) hide show
  1. package/index.js +4 -4
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -790,6 +790,7 @@ Detector.prototype._isPrimConst = function (val_node) {
790
790
  * @private
791
791
  */
792
792
  Detector.prototype._isCfgObj = function (val_node) {
793
+ // 配置对象应该是包含大写标识符的对象,而不是普通对象字面量
793
794
  return (
794
795
  val_node.type === "ObjectExpression" &&
795
796
  val_node.properties &&
@@ -797,9 +798,8 @@ Detector.prototype._isCfgObj = function (val_node) {
797
798
  val_node.properties.every(
798
799
  (prop) =>
799
800
  prop.value &&
800
- (prop.value.type === "Literal" ||
801
- (prop.value.type === "Identifier" &&
802
- /^[A-Z_][A-Z0-9_]*$/.test(prop.value.name))),
801
+ prop.value.type === "Identifier" &&
802
+ /^[A-Z_][A-Z0-9_]*$/.test(prop.value.name)
803
803
  )
804
804
  );
805
805
  };
@@ -832,7 +832,7 @@ Detector.prototype._isConstWithName = function (
832
832
  const is_val_const = this._isValConst(val_node, prop_name);
833
833
 
834
834
  if (is_inst_data_name && is_prim_const) {
835
- return is_val_const ? true : false;
835
+ return false; // 实例数据的属性名,即使值是基本类型,也不应视为常量
836
836
  }
837
837
 
838
838
  if (is_upper_name && (is_prim_const || is_cfg_obj)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mm_eslint",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "ESLint plugin for naming conventions - PascalCase, camelCase, snake_case, and UPPER_SNAKE_CASE naming rules",
5
5
  "main": "index.js",
6
6
  "keywords": [