Skip to content

vue/component-name-in-template-casing transforms <b-button> to <BButton>. #710

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

Closed
TitanFighter opened this issue Dec 5, 2018 · 2 comments · Fixed by #714
Closed

vue/component-name-in-template-casing transforms <b-button> to <BButton>. #710

TitanFighter opened this issue Dec 5, 2018 · 2 comments · Fixed by #714

Comments

@TitanFighter
Copy link

TitanFighter commented Dec 5, 2018

Tell us about your environment

  • ESLint version: 5.9.0
  • eslint-plugin-vue version: 3.2.1
  • Node version: 10.14.1

Please show your full configuration:

{
  "name": "test",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint"
  },
  "dependencies": {
    "vue": "^2.5.17"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "^3.2.0",
    "@vue/cli-plugin-eslint": "^3.2.0",
    "@vue/cli-service": "^3.2.0",
    "babel-eslint": "^10.0.1",
    "eslint": "^5.8.0",
    "eslint-plugin-vue": "^5.0.0-0",
    "vue-template-compiler": "^2.5.17"
  },
  "eslintConfig": {
    "root": true,
    "env": {
      "node": true
    },
    "extends": [
      "plugin:vue/recommended",
      "eslint:recommended"
    ],
    "parserOptions": {
      "parser": "babel-eslint"
    }
  },
  "postcss": {
    "plugins": {
      "autoprefixer": {}
    }
  },
  "browserslist": [
    "> 1%",
    "last 2 versions",
    "not ie <= 8"
  ]
}

What did you do?

  1. Create a new project in vue ui with default template;
  2. In vue ui open Configuration -> ESLint configuration -> Rules tab + select Error for vue/component-name-in-template-casing + Save settings;
  3. Open App.vue and add, for example <b-button>My Button</b-button>. Save changes;
  4. npm run lint;
  5. Open App.vue again and you will see, that b-button is changes to BButton, because of the rule to transform components to PascalCase. I checked that bootstrap-vue works in camelCase (bButton) and kebab-case (b-button), but not in PascalCase (BButton), probably because in the first part of b-button/BButton there is just 1 letter (I can guess, should be at least 2 instead).

What did you expect to happen?
So, as a result, as I understand, the rule vue/component-name-in-template-casing should not transform component name in case, if the first part of <b-button> has just one letter or if the first letter has lower case + the 2nd letter has upper case + the 3rd letter has lower case (bButton).

What actually happened?
<b-button> and <bButton> are transformed to <BButton>.

Additional info
Same problem happens with Vuetify (commented in #397)

@ota-meshi
Copy link
Member

Thank you for this issue.
I opened PR.

@michalsnik
Copy link
Member

Hi @TitanFighter I'm going to close this issue, as there is other that propose slightly better solution to this problem: #705 And it's actually in progress in #714

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