<commit_before><template>
  <article class="note">
    <NoteItemTags :inEditMode="inEditMode" :tags="tags" />
    <NoteItemMenu :inEditMode="inEditMode" @action="handleAction" />
    <NoteItemContent :content="content" :inEditMode="inEditMode" />
  </article>
</template>

<script>
import { mapGetters, mapMutations } from 'vuex';
import NoteItemContent from '@/components/NoteItemContent.vue';
import NoteItemMenu from '@/components/NoteItemMenu.vue';
import NoteItemTags from '@/components/NoteItemTags.vue';

export default {
  name: 'NoteItem',

  components: { NoteItemContent, NoteItemMenu, NoteItemTags },

  props: {
    id: {
      type: String,
      required: true,
    },
    content: {
      type: String,
      required: true,
    },
    tags: {
      type: Array,
      required: true,
    },
  },

  computed: {
    ...mapGetters(['editingID', 'preview']),

    inEditMode() {
      return this.editingID === this.id;
    },
  },

  methods: {
    ...mapMutations([
      'cancel',
      'disablePreview',
      'edit',
      'enablePreview',
      'pushActiveTags',
    ]),

    handleAction(type) {
      switch (type) {
        case 'edit':
          this.edit({ id: this.id });
          this.pushActiveTags({ tags: this.tags });
          this.$el.dispatchEvent(new Event('editmodeon'));

          break;

        case 'cancel':
          this.cancel();
          this.$el.dispatchEvent(new Event('editmodeoff'));

          break;

        case 'preview':
          if (this.preview) {
            this.disablePreview();
            this.$el.dispatchEvent(new Event('previewmodeoff'));
          } else {
            this.enablePreview();
            this.$el.dispatchEvent(new Event('previewmodeon'));
          }

          break;
        default:
      }
    },
    // cancelEdit() {
    //   this.cancel();
    //   this.$el.dispatchEvent(new Event('editmodeoff'));
    // },
    //
    // startEdit() {
    //   this.edit({ id: this.id });
    //   this.pushActiveTags({ tags: this.tags });
    //   this.$el.dispatchEvent(new Event('editmodeon'));
    // },
  },
};
</script><commit_msg>Switch statement linted<commit_after><template>
  <article class="note">
    <NoteItemTags :inEditMode="inEditMode" :tags="tags" />
    <NoteItemMenu :inEditMode="inEditMode" @action="handleAction" />
    <NoteItemContent :content="content" :inEditMode="inEditMode" />
  </article>
</template>

<script>
import { mapGetters, mapMutations } from 'vuex';
import NoteItemContent from '@/components/NoteItemContent.vue';
import NoteItemMenu from '@/components/NoteItemMenu.vue';
import NoteItemTags from '@/components/NoteItemTags.vue';

export default {
  name: 'NoteItem',

  components: { NoteItemContent, NoteItemMenu, NoteItemTags },

  props: {
    id: {
      type: String,
      required: true,
    },
    content: {
      type: String,
      required: true,
    },
    tags: {
      type: Array,
      required: true,
    },
  },

  computed: {
    ...mapGetters(['editingID', 'preview']),

    inEditMode() {
      return this.editingID === this.id;
    },
  },

  methods: {
    ...mapMutations([
      'cancel',
      'disablePreview',
      'edit',
      'enablePreview',
      'pushActiveTags',
    ]),

    handleAction(type) {
      switch (type) {
        case 'edit': {
          this.edit({ id: this.id });
          this.pushActiveTags({ tags: this.tags });
          this.$el.dispatchEvent(new Event('editmodeon'));

          break;
        }

        case 'cancel': {
          this.cancel();
          this.$el.dispatchEvent(new Event('editmodeoff'));

          break;
        }

        case 'preview': {
          if (this.preview) {
            this.disablePreview();
            this.$el.dispatchEvent(new Event('previewmodeoff'));
          } else {
            this.enablePreview();
            this.$el.dispatchEvent(new Event('previewmodeon'));
          }

          break;
        }

        default:
      }
    },
  },
};
</script>
{'fraction_non_alphanumeric': 0.15678391959798996, 'fraction_numerical': 0.0, 'mean_word_length': 2.215670436187399, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6245901', 'n_tokens_mistral': 1217, 'n_tokens_neox': 1195, 'n_words': 222}