Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply a filter on undefined response data #408

Closed
Toilal opened this issue Mar 17, 2017 · 3 comments
Closed

Apply a filter on undefined response data #408

Toilal opened this issue Mar 17, 2017 · 3 comments

Comments

@Toilal
Copy link

Toilal commented Mar 17, 2017

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"
  }
Toilal added a commit to Toilal/vue-cli that referenced this issue Apr 5, 2017
Default value is now defined in metalsmith metadata when meta.js "when" property returns false. This makes the filter evaluation works for filters using data that have been skipped in the prompt workflow by using the default value of the field.

Close vuejs#408
Toilal added a commit to Toilal/vue-cli that referenced this issue Apr 5, 2017
Undefined value is now defined in metalsmith metadata when meta.js "when" property returns false. This makes the filter evaluation works for filters using data that have been skipped in the prompt workflow by using the default value of the field.

Close vuejs#408
@busyhe
Copy link

busyhe commented Dec 12, 2018

@Toilal Is...solved?

@Toilal
Copy link
Author

Toilal commented Dec 17, 2018

I don't think it's been solved, but I have now switched to @vue/cli 3.

@CucurbitBaby
Copy link

good !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants