Open danyadev opened 3 years ago
I don't think this plugin could possibly work with .vue
files - how would eslint-plugin-import know how to parse "not javascript"?
this plugin works fine with all other .vue
files in the project
I'm not familiar with vue at all; do they use normal JS syntax for imports/exports? When you say "works fine", do you mean, it doesn't error on them, or do you mean, it reports errors inside them?
To clarify the PR title - if you rename the file from PhotosLayout.vue
to photosLayout.vue
and update the corresponding import paths, does it work as expected?
Sorry for the late answer, I left development for a while.
When changing the name of the .vue file, the problem is also reproduced:
.vue files are handled entirely by vue-loader and its repository contains a description of how it works
"works fine" means that the plugin is actually monitoring the use of exports:
Same-ish problem. Inside of a .vue
file the plugin will do things like enforce the order of imports, but if a .js
file exports something that is only imported in .vue
files, it will ignore them and think that there are no imports of it.
I tried renaming the .vue
file to be all lowercase, but that didn't change anything.
// example.js
export function example () {
return 'text';
}
<!-- myexample.vue -->
<template>
<div>Text</div>
</template>
<script>
import { example } from './example.js';
console.log(example());
export default {
name: 'MyExample'
};
</script>
C:\project\example.js
2:1 error exported declaration 'example' not used within other modules import/no-unused-modules
Again, all other rules I'm using apply to .vue
files, it's just this one that doesn't work.
Example project for reproduction:
same issue here, so this rule import/no-unused-modules
still not working in .vue Githubissues.
OS: Windows 10 Pro
The full eslint config and dependency versions can be viewed in the application repository. This bug is also reproduced there.
Perhaps this may also be due to the fact that the module itself is used in the
.vue
file.Error:
calculatePhotosLayout
function is used in the same folder inPhotosLayout.vue
file.