Closed mathieutu closed 1 year ago
Hi, thank you for your report and your patience in waiting for my response. Your input has sparked an idea in me that could potentially address this issue in an upcoming release. However, currently, this limitation is inherent to the design of the plugin itself. Nonetheless, there are alternative approaches that can still help you identify the mentioned issues.
You can employ different settings for ESLint depending on the context in which you are using it. For instance, you can utilize diff/ci
to disable the eslint-plugin-diff
on your local machine. This will ensure that you receive all ESLint errors, including the ones you mentioned. In CI environments, however, eslint-plugin-diff
will be enabled, resulting in the exclusion of those specific errors.
Another option is to utilize other tools that can compensate for the limitation. TypeScript, for example, can be configured to throw an error for unused variables, thereby aiding in the identification of such issues.
Please let me know if you need any further assistance or clarification.
Hi, and thanks again for this great project!
Is your feature request related to a problem? Please describe. We're using the no-unused-vars rule.
With this diff
Eslint with the diff plugin does not see any issue here. However when running eslint standard, it detects properly the issue:
'bar' is assigned a value but never used.
It's coming from https://github.com/paleite/eslint-plugin-diff/blob/53fd185e1efec3fdf99fc1848ae67ecb7d318bb7/src/processors.ts#L103-L107.
It's the same for unused imports rules, and all the ones that are based on part that are not touched.
Describe the solution you'd like I don't think we actually can safely lint part of files with ESLint. I would remove this part of code. The impact should not be very important.
Describe alternatives you've considered We could use a flag, to allow diffing only on files, and not lines.
Happy to make the PR of the chosen solution. 👋