elcharitas/waxe

View on GitHub

Showing 70 of 70 total issues

Function main has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

async function main() {
    const app = new docs.Application();
    const pages = {};
    
    app.options.addReader(new docs.TSConfigReader);
Severity: Minor
Found in docs/generate.js - About 1 hr to fix

    Function parseString has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function parseString(literal: WaxLiteral, argLiteral?: WaxLiteral, createScope?: boolean): string {
        const list: string[] = literal.split('');
        let inString: string = null;
    
        list.forEach((char: string, index: number, list: string[], nextChar: string = list[index + 1]) => {
    Severity: Minor
    Found in src/compiler/parser.ts - About 1 hr to fix

      Function parsePath has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      function parsePath(path: string, base_path: string): string {
          
          if(base_path === ''){
              base_path = '/';
          }
      Severity: Minor
      Found in src/compiler/index.ts - About 45 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function debugType has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function debugType<T>(args: string[], constraint?: T, expected?: WaxPresenter | T): string[] {
          const expectedType: string = typeof expected;
          
          if(typeof constraint !== expectedType){
              args.push((expected as WaxPresenter)?.name || expectedType);
      Severity: Minor
      Found in src/debug/index.ts - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      missing whitespace
      Open

          path = path.replace(/\.$/,'').replace(/\/\./g,'').replace(/"/g,'%22')
      Severity: Minor
      Found in src/compiler/index.ts by tslint

      Rule: whitespace

      Enforces whitespace style conventions.

      Rationale

      Helps maintain a readable, consistent style in your codebase.

      Notes
      • Has Fix

      Config

      Several arguments may be optionally provided:

      • "check-branch" checks branching statements (if/else/for/while) are followed by whitespace.
      • "check-decl"checks that variable declarations have whitespace around the equals token.
      • "check-operator" checks for whitespace around operator tokens.
      • "check-module" checks for whitespace in import & export statements.
      • "check-separator" checks for whitespace after separator tokens (,/;).
      • "check-rest-spread" checks that there is no whitespace after rest/spread operator (...).
      • "check-type" checks for whitespace before a variable type specification.
      • "check-typecast" checks for whitespace between a typecast and its target.
      • "check-type-operator" checks for whitespace between type operators | and &.
      • "check-preblock" checks for whitespace before the opening brace of a block.
      • "check-postbrace" checks for whitespace after an opening brace.
      Examples
      "whitespace": true,check-branch,check-operator,check-typecast
      Schema
      {
        "type": "array",
        "items": {
          "type": "string",
          "enum": [
            "check-branch",
            "check-decl",
            "check-operator",
            "check-module",
            "check-separator",
            "check-rest-spread",
            "check-type",
            "check-typecast",
            "check-type-operator",
            "check-preblock",
            "check-postbrace"
          ]
        },
        "minLength": 0,
        "maxLength": 11
      }

      For more information see this page.

      file should end with a newline
      Open

      }
      Severity: Minor
      Found in src/plugins/misc.ts by tslint

      Rule: eofline

      Ensures the file ends with a newline.

      Fix for single-line files is not supported.

      Rationale

      It is a standard convention to end files with a newline.

      Notes
      • Has Fix

      Config

      Not configurable.

      Examples
      "eofline": true

      For more information see this page.

      Missing semicolon
      Open

      }
      Severity: Minor
      Found in src/waxe.ts by tslint

      Rule: semicolon

      Enforces consistent semicolon usage at the end of every statement.

      Notes
      • Has Fix

      Config

      One of the following arguments must be provided:

      • "always" enforces semicolons at the end of every statement.
      • "never" disallows semicolons at the end of every statement except for when they are necessary.

      The following arguments may be optionally provided:

      • "ignore-interfaces" skips checking semicolons at the end of interface members.
      • "ignore-bound-class-methods" skips checking semicolons at the end of bound class methods.
      • "strict-bound-class-methods" disables any special handling of bound class methods and treats them as any other assignment. This option overrides "ignore-bound-class-methods".
      Examples
      "semicolon": true,always
      "semicolon": true,never
      "semicolon": true,always,ignore-interfaces
      "semicolon": true,always,ignore-bound-class-methods
      Schema
      {
        "type": "array",
        "items": [
          {
            "type": "string",
            "enum": [
              "always",
              "never"
            ]
          },
          {
            "type": "string",
            "enum": [
              "ignore-interfaces"
            ]
          }
        ],
        "additionalItems": false
      }

      For more information see this page.

      != should be !==
      Open

              else if(!inString && char === '$' && nextChar != '[') {
      Severity: Minor
      Found in src/compiler/parser.ts by tslint

      Rule: triple-equals

      Requires === and !== in place of == and !=.

      Config

      Two arguments may be optionally provided:

      • "allow-null-check" allows == and != when comparing to null.
      • "allow-undefined-check" allows == and != when comparing to undefined.
      Examples
      "triple-equals": true
      "triple-equals": true,allow-null-check
      "triple-equals": true,allow-undefined-check
      Schema
      {
        "type": "array",
        "items": {
          "type": "string",
          "enum": [
            "allow-null-check",
            "allow-undefined-check"
          ]
        },
        "minLength": 0,
        "maxLength": 2
      }

      For more information see this page.

      non-arrow functions are forbidden
      Open

              argLiteral.arg = function(key: number): string {
      Severity: Minor
      Found in src/compiler/walker.ts by tslint

      Rule: only-arrow-functions

      Disallows traditional (non-arrow) function expressions.

      Note that non-arrow functions are allowed if 'this' appears somewhere in its body (as such functions cannot be converted to arrow functions).

      Rationale

      Traditional functions don't bind lexical scope, which can lead to unexpected behavior when accessing 'this'.

      Config

      Two arguments may be optionally provided:

      • "allow-declarations" allows standalone function declarations.
      • "allow-named-functions" allows the expression function foo() {} but not function() {}.
      Examples
      "only-arrow-functions": true
      "only-arrow-functions": true,allow-declarations,allow-named-functions
      Schema
      {
        "type": "array",
        "items": {
          "type": "string",
          "enum": [
            "allow-declarations",
            "allow-named-functions"
          ]
        },
        "minLength": 0,
        "maxLength": 1
      }

      For more information see this page.

      non-arrow functions are forbidden
      Open

              argLiteral.parse = function(): string {
      Severity: Minor
      Found in src/compiler/walker.ts by tslint

      Rule: only-arrow-functions

      Disallows traditional (non-arrow) function expressions.

      Note that non-arrow functions are allowed if 'this' appears somewhere in its body (as such functions cannot be converted to arrow functions).

      Rationale

      Traditional functions don't bind lexical scope, which can lead to unexpected behavior when accessing 'this'.

      Config

      Two arguments may be optionally provided:

      • "allow-declarations" allows standalone function declarations.
      • "allow-named-functions" allows the expression function foo() {} but not function() {}.
      Examples
      "only-arrow-functions": true
      "only-arrow-functions": true,allow-declarations,allow-named-functions
      Schema
      {
        "type": "array",
        "items": {
          "type": "string",
          "enum": [
            "allow-declarations",
            "allow-named-functions"
          ]
        },
        "minLength": 0,
        "maxLength": 1
      }

      For more information see this page.

      missing whitespace
      Open

              debugInfo = debugInfo.replace(`%${index+1}`, arg);
      Severity: Minor
      Found in src/debug/index.ts by tslint

      Rule: whitespace

      Enforces whitespace style conventions.

      Rationale

      Helps maintain a readable, consistent style in your codebase.

      Notes
      • Has Fix

      Config

      Several arguments may be optionally provided:

      • "check-branch" checks branching statements (if/else/for/while) are followed by whitespace.
      • "check-decl"checks that variable declarations have whitespace around the equals token.
      • "check-operator" checks for whitespace around operator tokens.
      • "check-module" checks for whitespace in import & export statements.
      • "check-separator" checks for whitespace after separator tokens (,/;).
      • "check-rest-spread" checks that there is no whitespace after rest/spread operator (...).
      • "check-type" checks for whitespace before a variable type specification.
      • "check-typecast" checks for whitespace between a typecast and its target.
      • "check-type-operator" checks for whitespace between type operators | and &.
      • "check-preblock" checks for whitespace before the opening brace of a block.
      • "check-postbrace" checks for whitespace after an opening brace.
      Examples
      "whitespace": true,check-branch,check-operator,check-typecast
      Schema
      {
        "type": "array",
        "items": {
          "type": "string",
          "enum": [
            "check-branch",
            "check-decl",
            "check-operator",
            "check-module",
            "check-separator",
            "check-rest-spread",
            "check-type",
            "check-typecast",
            "check-type-operator",
            "check-preblock",
            "check-postbrace"
          ]
        },
        "minLength": 0,
        "maxLength": 11
      }

      For more information see this page.

      missing whitespace
      Open

          return new Function('call,tpl', 'return tpl['+strfy(name)+']=function(){return call(this,arguments)}')(
      Severity: Minor
      Found in src/compiler/parser.ts by tslint

      Rule: whitespace

      Enforces whitespace style conventions.

      Rationale

      Helps maintain a readable, consistent style in your codebase.

      Notes
      • Has Fix

      Config

      Several arguments may be optionally provided:

      • "check-branch" checks branching statements (if/else/for/while) are followed by whitespace.
      • "check-decl"checks that variable declarations have whitespace around the equals token.
      • "check-operator" checks for whitespace around operator tokens.
      • "check-module" checks for whitespace in import & export statements.
      • "check-separator" checks for whitespace after separator tokens (,/;).
      • "check-rest-spread" checks that there is no whitespace after rest/spread operator (...).
      • "check-type" checks for whitespace before a variable type specification.
      • "check-typecast" checks for whitespace between a typecast and its target.
      • "check-type-operator" checks for whitespace between type operators | and &.
      • "check-preblock" checks for whitespace before the opening brace of a block.
      • "check-postbrace" checks for whitespace after an opening brace.
      Examples
      "whitespace": true,check-branch,check-operator,check-typecast
      Schema
      {
        "type": "array",
        "items": {
          "type": "string",
          "enum": [
            "check-branch",
            "check-decl",
            "check-operator",
            "check-module",
            "check-separator",
            "check-rest-spread",
            "check-type",
            "check-typecast",
            "check-type-operator",
            "check-preblock",
            "check-postbrace"
          ]
        },
        "minLength": 0,
        "maxLength": 11
      }

      For more information see this page.

      missing whitespace
      Open

              log(`Usage: waxe ${action||'[command]'} [path]\n`);
      Severity: Minor
      Found in src/cli.ts by tslint

      Rule: whitespace

      Enforces whitespace style conventions.

      Rationale

      Helps maintain a readable, consistent style in your codebase.

      Notes
      • Has Fix

      Config

      Several arguments may be optionally provided:

      • "check-branch" checks branching statements (if/else/for/while) are followed by whitespace.
      • "check-decl"checks that variable declarations have whitespace around the equals token.
      • "check-operator" checks for whitespace around operator tokens.
      • "check-module" checks for whitespace in import & export statements.
      • "check-separator" checks for whitespace after separator tokens (,/;).
      • "check-rest-spread" checks that there is no whitespace after rest/spread operator (...).
      • "check-type" checks for whitespace before a variable type specification.
      • "check-typecast" checks for whitespace between a typecast and its target.
      • "check-type-operator" checks for whitespace between type operators | and &.
      • "check-preblock" checks for whitespace before the opening brace of a block.
      • "check-postbrace" checks for whitespace after an opening brace.
      Examples
      "whitespace": true,check-branch,check-operator,check-typecast
      Schema
      {
        "type": "array",
        "items": {
          "type": "string",
          "enum": [
            "check-branch",
            "check-decl",
            "check-operator",
            "check-module",
            "check-separator",
            "check-rest-spread",
            "check-type",
            "check-typecast",
            "check-type-operator",
            "check-preblock",
            "check-postbrace"
          ]
        },
        "minLength": 0,
        "maxLength": 11
      }

      For more information see this page.

      file should end with a newline
      Open

      }
      Severity: Minor
      Found in src/compiler/walker.ts by tslint

      Rule: eofline

      Ensures the file ends with a newline.

      Fix for single-line files is not supported.

      Rationale

      It is a standard convention to end files with a newline.

      Notes
      • Has Fix

      Config

      Not configurable.

      Examples
      "eofline": true

      For more information see this page.

      missing whitespace
      Open

          return new Function('call,tpl', 'return tpl['+strfy(name)+']=function(){return call(this,arguments)}')(
      Severity: Minor
      Found in src/compiler/parser.ts by tslint

      Rule: whitespace

      Enforces whitespace style conventions.

      Rationale

      Helps maintain a readable, consistent style in your codebase.

      Notes
      • Has Fix

      Config

      Several arguments may be optionally provided:

      • "check-branch" checks branching statements (if/else/for/while) are followed by whitespace.
      • "check-decl"checks that variable declarations have whitespace around the equals token.
      • "check-operator" checks for whitespace around operator tokens.
      • "check-module" checks for whitespace in import & export statements.
      • "check-separator" checks for whitespace after separator tokens (,/;).
      • "check-rest-spread" checks that there is no whitespace after rest/spread operator (...).
      • "check-type" checks for whitespace before a variable type specification.
      • "check-typecast" checks for whitespace between a typecast and its target.
      • "check-type-operator" checks for whitespace between type operators | and &.
      • "check-preblock" checks for whitespace before the opening brace of a block.
      • "check-postbrace" checks for whitespace after an opening brace.
      Examples
      "whitespace": true,check-branch,check-operator,check-typecast
      Schema
      {
        "type": "array",
        "items": {
          "type": "string",
          "enum": [
            "check-branch",
            "check-decl",
            "check-operator",
            "check-module",
            "check-separator",
            "check-rest-spread",
            "check-type",
            "check-typecast",
            "check-type-operator",
            "check-preblock",
            "check-postbrace"
          ]
        },
        "minLength": 0,
        "maxLength": 11
      }

      For more information see this page.

      missing whitespace
      Open

              return `if(${literal.text()||literal.length==0}){continue}`;
      Severity: Minor
      Found in src/plugins/core.ts by tslint

      Rule: whitespace

      Enforces whitespace style conventions.

      Rationale

      Helps maintain a readable, consistent style in your codebase.

      Notes
      • Has Fix

      Config

      Several arguments may be optionally provided:

      • "check-branch" checks branching statements (if/else/for/while) are followed by whitespace.
      • "check-decl"checks that variable declarations have whitespace around the equals token.
      • "check-operator" checks for whitespace around operator tokens.
      • "check-module" checks for whitespace in import & export statements.
      • "check-separator" checks for whitespace after separator tokens (,/;).
      • "check-rest-spread" checks that there is no whitespace after rest/spread operator (...).
      • "check-type" checks for whitespace before a variable type specification.
      • "check-typecast" checks for whitespace between a typecast and its target.
      • "check-type-operator" checks for whitespace between type operators | and &.
      • "check-preblock" checks for whitespace before the opening brace of a block.
      • "check-postbrace" checks for whitespace after an opening brace.
      Examples
      "whitespace": true,check-branch,check-operator,check-typecast
      Schema
      {
        "type": "array",
        "items": {
          "type": "string",
          "enum": [
            "check-branch",
            "check-decl",
            "check-operator",
            "check-module",
            "check-separator",
            "check-rest-spread",
            "check-type",
            "check-typecast",
            "check-type-operator",
            "check-preblock",
            "check-postbrace"
          ]
        },
        "minLength": 0,
        "maxLength": 11
      }

      For more information see this page.

      Parentheses are required when invoking a constructor
      Open

                  this._core = new Wax;
      Severity: Minor
      Found in src/waxe.ts by tslint

      Rule: new-parens

      Requires parentheses when invoking a constructor via the new keyword.

      Rationale

      Maintains stylistic consistency with other function calls.

      Config

      Not configurable.

      Examples
      "new-parens": true

      For more information see this page.

      missing whitespace
      Open

                      element.innerHTML = (element as HTMLInputElement).value = Wax.template(element.id, (element as HTMLInputElement).value||element.innerHTML)(context);
      Severity: Minor
      Found in src/waxe.ts by tslint

      Rule: whitespace

      Enforces whitespace style conventions.

      Rationale

      Helps maintain a readable, consistent style in your codebase.

      Notes
      • Has Fix

      Config

      Several arguments may be optionally provided:

      • "check-branch" checks branching statements (if/else/for/while) are followed by whitespace.
      • "check-decl"checks that variable declarations have whitespace around the equals token.
      • "check-operator" checks for whitespace around operator tokens.
      • "check-module" checks for whitespace in import & export statements.
      • "check-separator" checks for whitespace after separator tokens (,/;).
      • "check-rest-spread" checks that there is no whitespace after rest/spread operator (...).
      • "check-type" checks for whitespace before a variable type specification.
      • "check-typecast" checks for whitespace between a typecast and its target.
      • "check-type-operator" checks for whitespace between type operators | and &.
      • "check-preblock" checks for whitespace before the opening brace of a block.
      • "check-postbrace" checks for whitespace after an opening brace.
      Examples
      "whitespace": true,check-branch,check-operator,check-typecast
      Schema
      {
        "type": "array",
        "items": {
          "type": "string",
          "enum": [
            "check-branch",
            "check-decl",
            "check-operator",
            "check-module",
            "check-separator",
            "check-rest-spread",
            "check-type",
            "check-typecast",
            "check-type-operator",
            "check-preblock",
            "check-postbrace"
          ]
        },
        "minLength": 0,
        "maxLength": 11
      }

      For more information see this page.

      missing whitespace
      Open

                  src ? log(pagefn({})): help(action);
      Severity: Minor
      Found in src/cli.ts by tslint

      Rule: whitespace

      Enforces whitespace style conventions.

      Rationale

      Helps maintain a readable, consistent style in your codebase.

      Notes
      • Has Fix

      Config

      Several arguments may be optionally provided:

      • "check-branch" checks branching statements (if/else/for/while) are followed by whitespace.
      • "check-decl"checks that variable declarations have whitespace around the equals token.
      • "check-operator" checks for whitespace around operator tokens.
      • "check-module" checks for whitespace in import & export statements.
      • "check-separator" checks for whitespace after separator tokens (,/;).
      • "check-rest-spread" checks that there is no whitespace after rest/spread operator (...).
      • "check-type" checks for whitespace before a variable type specification.
      • "check-typecast" checks for whitespace between a typecast and its target.
      • "check-type-operator" checks for whitespace between type operators | and &.
      • "check-preblock" checks for whitespace before the opening brace of a block.
      • "check-postbrace" checks for whitespace after an opening brace.
      Examples
      "whitespace": true,check-branch,check-operator,check-typecast
      Schema
      {
        "type": "array",
        "items": {
          "type": "string",
          "enum": [
            "check-branch",
            "check-decl",
            "check-operator",
            "check-module",
            "check-separator",
            "check-rest-spread",
            "check-type",
            "check-typecast",
            "check-type-operator",
            "check-preblock",
            "check-postbrace"
          ]
        },
        "minLength": 0,
        "maxLength": 11
      }

      For more information see this page.

      Array type using 'Array<t>' is forbidden. Use 'T[]' instead.</t>
      Open

      function conflictProp<T extends Record<string, unknown>>(context: T, props: Array<keyof T> = Object.keys(context)): T {
      Severity: Minor
      Found in src/compiler/index.ts by tslint

      Rule: array-type

      Requires using either 'T[]' or 'Array<t>' for arrays.</t>

      Notes
      • TypeScript Only
      • Has Fix

      Config

      One of the following arguments must be provided:

      • "array" enforces use of T[] for all types T.
      • "generic" enforces use of Array<T> for all types T.
      • "array-simple" enforces use of T[] if T is a simple type (primitive or type reference).
      Examples
      "array-type": true,array
      "array-type": true,generic
      "array-type": true,array-simple
      Schema
      {
        "type": "string",
        "enum": [
          "array",
          "generic",
          "array-simple"
        ]
      }

      For more information see this page.

      Severity
      Category
      Status
      Source
      Language