diff --git a/presenter/eslint-local-rules.cjs b/presenter/eslint-local-rules.cjs new file mode 100644 index 0000000000..a0037154a5 --- /dev/null +++ b/presenter/eslint-local-rules.cjs @@ -0,0 +1,4 @@ +/* eslint-disable import/no-commonjs */ +module.exports = { + ...require('./eslint-local-rules/href-pattern.cjs'), +} diff --git a/presenter/eslint-local-rules/rules.ts b/presenter/eslint-local-rules/href-pattern.cjs similarity index 82% rename from presenter/eslint-local-rules/rules.ts rename to presenter/eslint-local-rules/href-pattern.cjs index 97516fe8d9..52705bc5d3 100644 --- a/presenter/eslint-local-rules/rules.ts +++ b/presenter/eslint-local-rules/href-pattern.cjs @@ -1,9 +1,8 @@ -/* eslint import/no-commonjs: 0 */ -import utils from './node_modules/eslint-plugin-vue/lib/utils' +/* eslint-disable import/no-commonjs */ +// eslint-disable-next-line @typescript-eslint/no-var-requires +const utils = require('../node_modules/eslint-plugin-vue/lib/utils') -import type { Rule } from 'eslint' - -function getName(attribute: any) { +function getName(attribute) { if (!attribute.directive) { return attribute.key.name } @@ -18,11 +17,11 @@ function getName(attribute: any) { return null } -function getValue(attribute: any ) { +function getValue(attribute) { return attribute.value.value } -export default { +module.exports = { 'href-pattern': { meta: { type: 'problem', @@ -39,7 +38,7 @@ export default { create(context) { return utils.defineTemplateBodyVisitor(context, { VStartTag() {}, - VAttribute(node: any) { + VAttribute(node) { const name = getName(node) if (name == null) { return @@ -65,4 +64,4 @@ export default { }) }, }, -} satisfies Record +} diff --git a/presenter/eslint-local-rules/index.js b/presenter/eslint-local-rules/index.js deleted file mode 100644 index 6e13a03bc4..0000000000 --- a/presenter/eslint-local-rules/index.js +++ /dev/null @@ -1,18 +0,0 @@ -import tsNode from 'ts-node' - -let defaultExport - -const loadRules = async () => { - tsNode.register({ - transpileOnly: true, - compilerOptions: { - module: 'commonjs', - }, - }) - - const rulesModule = await import('./rules') - defaultExport = rulesModule.default -} - -loadRules() -export default defaultExport