Skip to content

Commit

Permalink
cjs working
Browse files Browse the repository at this point in the history
  • Loading branch information
ulfgebhardt committed Feb 14, 2024
1 parent f1a912b commit 6689071
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 27 deletions.
4 changes: 4 additions & 0 deletions presenter/eslint-local-rules.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/* eslint-disable import/no-commonjs */
module.exports = {
...require('./eslint-local-rules/href-pattern.cjs'),
}
Original file line number Diff line number Diff line change
@@ -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
}
Expand All @@ -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',
Expand All @@ -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
Expand All @@ -65,4 +64,4 @@ export default {
})
},
},
} satisfies Record<string, Rule.RuleModule>
}
18 changes: 0 additions & 18 deletions presenter/eslint-local-rules/index.js

This file was deleted.

0 comments on commit 6689071

Please sign in to comment.