Skip to content

Latest commit

 

History

History
41 lines (31 loc) · 1000 Bytes

match-component-file-name.md

File metadata and controls

41 lines (31 loc) · 1000 Bytes

require component name property to match its file name (vue/match-component-file-name)

You can define an array of file extensions this rule should verify for the component's name.

By default this rule will only verify components in a file with a .jsx extension.

📖 Rule Details

This rule reports if a component name property does not match its file name.

👎 Examples of incorrect code for this rule:

// file name: src/MyComponent.jsx
export default {
  name: 'MComponent', // note the missing y
  render: () {
    return <h1>Hello world</h1>
  }
}

👍 Examples of correct code for this rule:

// file name: src/MyComponent.jsx
export default {
  name: 'MyComponent',
  render: () {
    return <h1>Hello world</h1>
  }
}

🔧 Options

  • ['jsx'] (default) ... verify components in files with .jsx extension.
  • ['jsx', 'vue', 'js'] (or any combinations of these extensions) ... verify components in files with listed extensions.