V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
TomVista
V2EX  ›  问与答

eslint 关闭正则验证不管用.

  •  
  •   TomVista · Apr 16, 2019 · 1415 views
    This topic created in 2571 days ago, the information mentioned may be changed or developed.

    .eslintrc.js

    module.exports = {
      ...
      
      "rules": {
        ...
        
        "no-invalid-this": "error",
        "no-unused-vars": "warn",
        "no-invalid-regexp": "off"
      }
    };
    

    我的正则

    var filePath = glob.sync('./src/*.js');
    var regexp = /(?<=\/)\w+(?=\.js)/;
    var entry = {};
    for (var p in filePath) {
        var flie = regexp.exec(filePath[p]);
        Object.defineProperty(entry, flie[0], {
            value: flie.input,
            configurable: true,
            enumerable: true,
            writable:true
        });
    }
    

    eslint 错误

    Parsing error: Invalid regular expression: /(?<=\/)\w+(?=\.js)/: Invalid group
    
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2576 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 40ms · UTC 00:03 · PVG 08:03 · LAX 17:03 · JFK 20:03
    ♥ Do have faith in what you're doing.