# san/order-in-components

enforce order of properties in components

  • ⚙️ This rule is included in "plugin:san/recommended".
  • 🔧 The --fix option on the command line (opens new window) can automatically fix some of the problems reported by this rule.

# 📖 Rule Details

This rule makes sure you keep declared order of properties in components.

<script> /* ✓ GOOD */ export default { dataTypes: { name: DataTypes.string }, initData () { return { msg: 'Welcome to Your San App' } } } </script>
Now loading...
<script> /* ✗ BAD */ export default { initData () { return { msg: 'Welcome to Your San App' } }, dataTypes: { name: DataTypes.string } } </script>
Now loading...

# 🔧 Options

{
  "san/order-in-components": ["error", {
    "order": [
      // 视图
      "template",
      "components",
      "trimWhitespace",

      // 事件
      "messages",

      // 数据
      "dataTypes",
      "computed",
      "filters",
      "initData",

      // 生命周期
      "LIFECYCLE_HOOKS"
    ]
  }]
}
  • order ((string | string[])[]) ... The order of properties. Elements are the property names or one of the following groups:

    If an element is an array of strings, it means any of those can be placed there unordered. Default is above.

# 🔍 Implementation

Last Updated: 10/26/2021, 7:23:11 AM