Eslint-plugin-vue: Rule proposal: no-reserved-component-names

Created on 31 May 2018  路  4Comments  路  Source: vuejs/eslint-plugin-vue

see https://stackoverflow.com/a/22545622/248058

Those names should produce an error:

  • annotation-xml
  • color-profile
  • font-face
  • font-face-src
  • font-face-uri
  • font-face-format
  • font-face-name
  • missing-glyph
accepted proposition new rule proposition

Most helpful comment

This makes sense, but I think it should be focused on avoiding reserved names in component definitions, e.g. no-reserved-component-names and it would be in essentials.

All 4 comments

This makes sense, but I think it should be focused on avoiding reserved names in component definitions, e.g. no-reserved-component-names and it would be in essentials.

Some examples of code it should catch:

Vue.component('font-face', {})
const name = 'font-face'

Vue.component(name, {})
// filename: font-face.vue

export default {
  name: 'font-face'
}
// filename: font-face.vue

module.exports = {
  name: 'font-face'
}

I think we should also warn about:

export default {
  components: {
    'font-face': ...,
  }
}

This returns same warning in Vue app, as former examples. @chrisvfritz @shadskii

I've added warnings for locally registered components in #757. Thank you for the suggestion!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

filipalacerda picture filipalacerda  路  4Comments

xiGUAwanOU picture xiGUAwanOU  路  3Comments

sqal picture sqal  路  3Comments

apertureless picture apertureless  路  4Comments

armano2 picture armano2  路  4Comments