paleite / eslint-plugin-diff

Run ESLint on your changes only
https://npm.im/eslint-plugin-diff
MIT License
172 stars 13 forks source link

Seems not compatible with eslint-plugin-vue #46

Open towertop opened 1 year ago

towertop commented 1 year ago

When I turn on eslint-plugin-diff with eslint-plugin-vue at the same time, a simple .vue file content keey reporting rule 'vue/comment-directive ' error.

From their document [https://eslint.vuejs.org/rules/comment-directive.html](), the problematic rule uses eslint processer API rather than other regular rules.

图片

<template>
  <div class="a-new-table"></div>
</template>
<script lang="ts">
import { defineComponent } from 'vue'

export default defineComponent({
  name: 'ANewTable',
  setup() {
    return {}
  },
})
</script>
<style lang="less" scoped>
.a-new-table {
  background: black;
}
</style>

No expert on eslint and git, spend a whole hour to figure out this. Hope anyone could look into it.

paleite commented 1 year ago

Hi, thanks for the report. Would you be able to provide a reproduction repo so I can investigate this further? Thanks

levchak0910 commented 1 year ago

This plugin is implemented to work via processor, but vue plugin (same as svelte, astro, etc) have their own processor, and only 1 processor can be applied per file (not 100% sure, but most likely)

  1. I tried to console.log all files which are handled by this plugins and .vue files are not amongst them
// src/preprocessors.ts
const getPreProcessor = (diffFileList, staged) => (text, filename) => {
    // ...
    console.log("getPreProcessor", shouldBeProcessed, filename);
    return shouldBeProcessed ? [text] : [];
};
  1. When forcing
overrides: [
    {
      files: [ "*.vue" ],
      processor: "diff/ci",
    },
]

.vue files are handled by this plugin, but not handled by eslint-plugin-vue

@paleite do you have any ideas if it possible anyhow merge these 2 plugins together?

cakeinpanic commented 8 months ago

Same issue with angular preprocessor plugin:@angular-eslint/template/process-inline-templates....

Kombuchelada commented 3 months ago

Same issue with angular preprocessor plugin:@angular-eslint/template/process-inline-templates....

We're also getting the same issue.

Kombuchelada commented 3 months ago

It was an error on our side. I was seeing eslint errors from the templates but its because we didn't add the plugin:diff/ci to the *.html overrides section. duh.

hejialianghe commented 1 month ago

有解决这个问题么