I'm using the eslint-plugin-vue in my Vue project, but unfortunately there's a mix of both ESM (ECMAScript modules) and CJS (CommonJS) module formats used in the SFCs (Single File Components).
Some components are using module.exports = {}
in the <script>
section, and others the ESM format; export default {}
.
The plugin are able to detect errors in the <script>
section when defined using the ESM format, but not when using the CJS format.
For example, the linter is correctly warning about vue/require-prop-types in this snippet:
<script>
export default {
name: 'About',
props: ['name']
}
</script>
But not when defining it this way:
<script>
module.exports = {
name: 'About',
props: ['name']
}
</script>
Any idea if it's possible to enable the eslint-plugin-vue inside CJS module formats in Vue SFCs?