-
-
Notifications
You must be signed in to change notification settings - Fork 649
/
no-export-in-script-setup.js
41 lines (38 loc) · 1.01 KB
/
no-export-in-script-setup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/**
* @author Yosuke Ota
* See LICENSE file in root directory for full license.
*/
'use strict'
const utils = require('../utils')
module.exports = {
meta: {
type: 'problem',
docs: {
description: 'disallow `export` in `<script setup>`',
// TODO Switch in the major version.
// categories: ['vue3-essential'],
categories: undefined,
url: 'https://eslint.vuejs.org/rules/no-export-in-script-setup.html'
},
fixable: null,
schema: [],
messages: {
forbidden: '`<script setup>` cannot contain ES module exports.'
}
},
/** @param {RuleContext} context */
create(context) {
/** @param {ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration} node */
function report(node) {
context.report({
node,
messageId: 'forbidden'
})
}
return utils.defineScriptSetupVisitor(context, {
ExportAllDeclaration: report,
ExportDefaultDeclaration: report,
ExportNamedDeclaration: report
})
}
}