node_modules/lit-analyzer/lib/index.cjs.js
/**
 * The main function of the cli.
 */
The main function of the cli.
The main function of the cli .
function cli() {
    return __awaiter(this, void 0, void 0, function () {
        var _a, args, rest, globs, config, success;
        return __generator(this, function (_b) {
            switch (_b.label) {
                case 0:
                    _a = parseCliArguments(process.argv.slice(2)), args = _a._, rest = __rest(_a, ["_"]);
                    globs = args.length > 0 ? args : [DEFAULT_GLOB];
                    config = __assign(__assign({}, DEFAULT_CONFIG), rest);
                    if (config.debug) {
                        console.log("CLI Config", config);
                    }
                    config.rules = Object.entries(config.rules || {}).reduce(function (acc, _a) {
                        var _b = __read(_a, 2), k = _b[0], v = _b[1];
                        acc[camelToDashCase(k)] = v;
                        return acc;
                    }, {});
                    if (config.help) {
                        console.log("\n\n  Usage\n    lit-analyzer [<file|directory|glob>]\n    \n  Options\n    --help                Print this message.\n    --format FORMAT       Specify output format. The possible options are:\n                            o code                Highlight problems in the code (default)\n                            o list                Short and precise list of problems\n                            o markdown            Markdown format\n    --noColor             Print results without color\n    --outFile FILE        Emit all output to a single file\n    --maxWarnings NUMBER  Fail only when the number of warnings is larger than this number\n    --quiet               Report only errors and not warnings\n    --failFast            Exit the process right after the first problem has been found\n    --strict              Enable strict mode. This change the default ruleset.\n    --rules.___ SEVERITY  Enable or disable a rule (example: --rules.no-unknown-tag-name off). \n                          Severity can be: \"off\" | \"warn\" | \"error\". The possible rules are:\n                          o  no-unknown-tag-name\n                          o  no-missing-import\n                          o  no-unclosed-tag\n                          o  no-unknown-attribute\n                          o  no-unknown-property\n                          o  no-unknown-event\n                          o  no-unknown-slot\n                          o  no-invalid-boolean-binding\n                          o  no-expressionless-property-binding\n                          o  no-noncallable-event-binding\n                          o  no-boolean-in-attribute-binding\n                          o  no-complex-attribute-binding\n                          o  no-nullable-attribute-binding\n                          o  no-incompatible-type-binding\n                          o  no-invalid-directive-binding\n                          o  no-incompatible-property-type\n                          o  no-unknown-property-converter\n                          o  no-invalid-attribute-name\n                          o  no-invalid-tag-name\n                          o  no-invalid-css\n    \n  Examples\n    lit-analyzer src\n    lit-analyzer \"src/**/*.{js,ts}\"\n    lit-analyzer my-element.js\n\t\t");
                        return [2 ];
                    }
                    return [4 , analyzeCommand(globs, config)];
                case 1:
                    success = _b.sent();
                    process.exit(success ? 0 : 1);
                    return [2 ];
            }
        });
    });
}
function cli ( ) { return __awaiter ( this , void 0 , void 0 , function ( ) { var _a , args , rest , globs , config , success ; return __generator ( this , function ( _b ) { switch ( _b . label ) { case 0 : _a = parseCliArguments ( process . argv . slice ( 2 ) ) , args = _a . _ , rest = __rest ( _a , [ "_" ] ) ; globs = args . length > 0 ? args : [ DEFAULT_GLOB ] ; config = __assign ( __assign ( { } , DEFAULT_CONFIG ) , rest ) ; if ( config . debug ) { console . log ( "CLI Config" , config ) ; } config . rules = Object . entries ( config . rules || { } ) . reduce ( function ( acc , _a ) { var _b = __read ( _a , 2 ) , k = _b [ 0 ] , v = _b [ 1 ] ; acc [ camelToDashCase ( k ) ] = v ; return acc ; } , { } ) ; if ( config . help ) { console . log ( "\n\n  Usage\n    lit-analyzer [<file|directory|glob>]\n    \n  Options\n    --help                Print this message.\n    --format FORMAT       Specify output format. The possible options are:\n                            o code                Highlight problems in the code (default)\n                            o list                Short and precise list of problems\n                            o markdown            Markdown format\n    --noColor             Print results without color\n    --outFile FILE        Emit all output to a single file\n    --maxWarnings NUMBER  Fail only when the number of warnings is larger than this number\n    --quiet               Report only errors and not warnings\n    --failFast            Exit the process right after the first problem has been found\n    --strict              Enable strict mode. This change the default ruleset.\n    --rules.___ SEVERITY  Enable or disable a rule (example: --rules.no-unknown-tag-name off). \n                          Severity can be: \"off\" | \"warn\" | \"error\". The possible rules are:\n                          o  no-unknown-tag-name\n                          o  no-missing-import\n                          o  no-unclosed-tag\n                          o  no-unknown-attribute\n                          o  no-unknown-property\n                          o  no-unknown-event\n                          o  no-unknown-slot\n                          o  no-invalid-boolean-binding\n                          o  no-expressionless-property-binding\n                          o  no-noncallable-event-binding\n                          o  no-boolean-in-attribute-binding\n                          o  no-complex-attribute-binding\n                          o  no-nullable-attribute-binding\n                          o  no-incompatible-type-binding\n                          o  no-invalid-directive-binding\n                          o  no-incompatible-property-type\n                          o  no-unknown-property-converter\n                          o  no-invalid-attribute-name\n                          o  no-invalid-tag-name\n                          o  no-invalid-css\n    \n  Examples\n    lit-analyzer src\n    lit-analyzer \"src/**/*.{js,ts}\"\n    lit-analyzer my-element.js\n\t\t" ) ; return [ 2 ] ; } return [ 4 , analyzeCommand ( globs , config ) ] ; case 1 : success = _b . sent ( ) ; process . exit ( success ? 0 : 1 ) ; return [ 2 ] ; } } ) ; } ) ; }
The main function of the cli.
The main function of the cli .
// eslint-disable-next-line no-console // Always convert "rules" to "dash case" because "rules" expects it. // eslint-disable-next-line no-console /*return*/ /*yield*/ /*return*/