Skip to content

Apply a filter on undefined response data #408

Closed
@Toilal

Description

@Toilal

I'm currently writing a custom template based on webpack template, and I ask user the JavaScript compiler he wants.

Based on the answer, some other questions are removed using when

"compiler": {
      "type": "list",
      "message": "Which JavaScript compiler do you want to use?",
      "choices": [
        {
          "name": "Babel (ES2015)",
          "value": "babel",
          "short": "babel"
        },
        {
          "name": "TypeScript (Awesome Typescript Loader)",
          "value": "typescript",
          "short": "typescript"
        },
        {
          "name": "No compiler (Vanilla JS)",
          "value": "none",
          "short": "none"
        }
      ]
    },
    "eslint": {
      "when": "compiler == 'babel'",
      "type": "confirm",
      "message": "Use ESLint to lint your code?"
    },

The eslint question is displayed only when compiler babel is choosen, all is ok here.

But then, if user choose something else than babel as compiler, an error message is displayed about filters.

Error when evaluating filter condition: eslint

It seems to be caused by the filters handling because eslint is undefined in data.

  "filters": {
    ".eslintrc.js": "eslint",
    ".eslintignore": "eslint",
    "config/test.env.js": "unit || e2e",
    "test/unit/**/*": "unit",
    "build/webpack.test.conf.js": "unit",
    "test/e2e/**/*": "e2e",
    "src/router/**/*": "router"
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions