diff --git a/.eslintignore b/.eslintignore
index 02596a7..ed6f7c4 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -1,2 +1,3 @@
website/
tools/
+eslint.config.mjs
diff --git a/.eslintrc.js b/.eslintrc.js
index 8a92fed..13f6db1 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -2,5 +2,8 @@ module.exports = {
extends: ['eslint:recommended', 'plugin:node/recommended', 'plugin:eslint-plugin/recommended'],
env: {
es6: true
+ },
+ rules: {
+ "node/no-extraneous-require": "off"
}
}
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 9f1649c..e25f080 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -35,6 +35,20 @@ jobs:
- run: npm run lint
- run: npm run test
+ eslint9_test:
+ name: Test eslint-plugin-wxml with eslint9
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v3
+ - uses: actions/setup-node@v3
+ with: {node-version: '${{ env.NODE_VERSION }}'}
+ - run: npm install
+ - run: npm install eslint@9
+ - run: npm install semver
+ - run: npm run lint
+ - run: npm run test
+
eslint8_test:
name: Test eslint-plugin-wxml with eslint8
runs-on: ubuntu-latest
@@ -45,6 +59,7 @@ jobs:
with: {node-version: '${{ env.NODE_VERSION }}'}
- run: npm install
- run: npm install eslint@8
+ - run: npm install semver
- run: npm run lint
- run: npm run test
diff --git a/eslint.config.mjs b/eslint.config.mjs
new file mode 100644
index 0000000..7de11e5
--- /dev/null
+++ b/eslint.config.mjs
@@ -0,0 +1,17 @@
+import js from "@eslint/js";
+
+export default [
+ {
+ ...js.configs.recommended,
+ files: ["lib/**/*.js"],
+ ignores: ["website/**", "tools/**"]
+ },
+ {
+ languageOptions: {
+ globals: {
+ module: "readonly",
+ require: "readonly",
+ }
+ }
+ }
+];
diff --git a/lib/rules/no-unexpected-string-bool.js b/lib/rules/no-unexpected-string-bool.js
index d1c815f..6b8fcec 100644
--- a/lib/rules/no-unexpected-string-bool.js
+++ b/lib/rules/no-unexpected-string-bool.js
@@ -24,6 +24,10 @@ module.exports = {
if (node.value === "true" || node.value === "false") {
context.report({
node,
+ data: {
+ true: "{{true}}",
+ false: "{{false}}",
+ },
messageId: node.value === "true" ? "trueString" : "falseString",
});
}
diff --git a/lib/rules/omit-bool-attributes.js b/lib/rules/omit-bool-attributes.js
index 93d91ce..aafc2e8 100644
--- a/lib/rules/omit-bool-attributes.js
+++ b/lib/rules/omit-bool-attributes.js
@@ -24,7 +24,11 @@ module.exports = {
context.report({
node,
messageId: "omitWarn",
- data: { attrKey: node.key },
+ data: {
+ attrKey: node.key,
+ true: "{{true}}",
+ false: "{{false}}",
+ },
});
}
}
diff --git a/lib/rules/report-interpolation-error.js b/lib/rules/report-interpolation-error.js
index 8cc507d..fe58f75 100644
--- a/lib/rules/report-interpolation-error.js
+++ b/lib/rules/report-interpolation-error.js
@@ -23,8 +23,8 @@ module.exports = {
return;
}
try {
- // eslint-disable-next-line node/no-extraneous-require
espreeParser = require("espree");
+ // eslint-disable-next-line no-unused-vars
} catch (_) {
// ...
}
@@ -38,11 +38,13 @@ module.exports = {
espreeParser.parse(`({${node.value}})`, {
ecmaVersion: espreeParser.latestEcmaVersion,
});
+ // eslint-disable-next-line no-unused-vars
} catch (_) {
try {
espreeParser.parse(`(${node.value})`, {
ecmaVersion: espreeParser.latestEcmaVersion,
});
+ // eslint-disable-next-line no-unused-vars
} catch (_) {
context.report({
node,
diff --git a/tests/rule-tester-compat.js b/tests/rule-tester-compat.js
new file mode 100644
index 0000000..dcb251b
--- /dev/null
+++ b/tests/rule-tester-compat.js
@@ -0,0 +1,12 @@
+const eslint = require("eslint");
+const semver = require("semver");
+
+const ruleTester = semver.gte(eslint.Linter.version, "9.0.0-0")
+ ? new eslint.RuleTester({
+ languageOptions: {
+ parser: require("@wxml/parser"),
+ },
+ })
+ : new eslint.RuleTester({ parser: require.resolve("@wxml/parser") });
+
+module.exports.RuleTester = ruleTester;
diff --git a/tests/rules/colon-style-event-binding.js b/tests/rules/colon-style-event-binding.js
index 1650a7b..0f94c40 100644
--- a/tests/rules/colon-style-event-binding.js
+++ b/tests/rules/colon-style-event-binding.js
@@ -1,10 +1,6 @@
-const RuleTester = require("eslint").RuleTester;
+const tester = require("../rule-tester-compat").RuleTester;
const rule = require("../../lib/rules/colon-style-event-binding");
-const tester = new RuleTester({
- parser: require.resolve("@wxml/parser"),
-});
-
tester.run("colon-style-event-binding", rule, {
valid: [
{
diff --git a/tests/rules/empty-tag-self-closing.js b/tests/rules/empty-tag-self-closing.js
index 2a2b23c..26a213f 100644
--- a/tests/rules/empty-tag-self-closing.js
+++ b/tests/rules/empty-tag-self-closing.js
@@ -1,10 +1,6 @@
-const RuleTester = require("eslint").RuleTester;
+const tester = require("../rule-tester-compat").RuleTester;
const rule = require("../../lib/rules/empty-tag-self-closing");
-const tester = new RuleTester({
- parser: require.resolve("@wxml/parser"),
-});
-
tester.run("empty-tag-self-closing", rule, {
valid: [
{
diff --git a/tests/rules/event-binding-style.js b/tests/rules/event-binding-style.js
index e50a67c..492d90b 100644
--- a/tests/rules/event-binding-style.js
+++ b/tests/rules/event-binding-style.js
@@ -1,10 +1,6 @@
-const RuleTester = require("eslint").RuleTester;
+const tester = require("../rule-tester-compat").RuleTester;
const rule = require("../../lib/rules/event-binding-style");
-const tester = new RuleTester({
- parser: require.resolve("@wxml/parser"),
-});
-
tester.run("event-binding-style", rule, {
valid: [
{
diff --git a/tests/rules/forbid-attributes.js b/tests/rules/forbid-attributes.js
index ff6d735..e480aef 100644
--- a/tests/rules/forbid-attributes.js
+++ b/tests/rules/forbid-attributes.js
@@ -1,10 +1,6 @@
-const RuleTester = require("eslint").RuleTester;
+const tester = require("../rule-tester-compat").RuleTester;
const rule = require("../../lib/rules/forbid-attributes");
-const tester = new RuleTester({
- parser: require.resolve("@wxml/parser"),
-});
-
tester.run("forbid-attributes", rule, {
valid: [
{
diff --git a/tests/rules/forbid-tags.js b/tests/rules/forbid-tags.js
index 2b6e13e..50391d4 100644
--- a/tests/rules/forbid-tags.js
+++ b/tests/rules/forbid-tags.js
@@ -1,10 +1,6 @@
-const RuleTester = require("eslint").RuleTester;
+const tester = require("../rule-tester-compat").RuleTester;
const rule = require("../../lib/rules/forbid-tags");
-const tester = new RuleTester({
- parser: require.resolve("@wxml/parser"),
-});
-
tester.run("forbid-tags", rule, {
valid: [
{
diff --git a/tests/rules/max-depth.js b/tests/rules/max-depth.js
index 688e1a7..8e423a6 100644
--- a/tests/rules/max-depth.js
+++ b/tests/rules/max-depth.js
@@ -1,10 +1,6 @@
-const RuleTester = require("eslint").RuleTester;
+const tester = require("../rule-tester-compat").RuleTester;
const rule = require("../../lib/rules/max-depth");
-const tester = new RuleTester({
- parser: require.resolve("@wxml/parser"),
-});
-
tester.run("max-depth", rule, {
valid: [
{
diff --git a/tests/rules/max-len.js b/tests/rules/max-len.js
index ed19544..98c8734 100644
--- a/tests/rules/max-len.js
+++ b/tests/rules/max-len.js
@@ -1,10 +1,6 @@
-const RuleTester = require("eslint").RuleTester;
+const tester = require("../rule-tester-compat").RuleTester;
const rule = require("../../lib/rules/max-len");
-const tester = new RuleTester({
- parser: require.resolve("@wxml/parser"),
-});
-
tester.run("max-len", rule, {
valid: [
{
diff --git a/tests/rules/max-lines.js b/tests/rules/max-lines.js
index 2368130..82c5da8 100644
--- a/tests/rules/max-lines.js
+++ b/tests/rules/max-lines.js
@@ -1,12 +1,8 @@
const fs = require("fs");
const path = require("path");
-const RuleTester = require("eslint").RuleTester;
+const tester = require("../rule-tester-compat").RuleTester;
const rule = require("../../lib/rules/max-lines");
-const tester = new RuleTester({
- parser: require.resolve("@wxml/parser"),
-});
-
function readFixureFiles(filename) {
if (filename) {
return fs.readFileSync(
diff --git a/tests/rules/no-const-and-let-in-wxs.js b/tests/rules/no-const-and-let-in-wxs.js
index 1e752d0..afd60d5 100644
--- a/tests/rules/no-const-and-let-in-wxs.js
+++ b/tests/rules/no-const-and-let-in-wxs.js
@@ -1,10 +1,6 @@
-const RuleTester = require("eslint").RuleTester;
+const tester = require("../rule-tester-compat").RuleTester;
const rule = require("../../lib/rules/no-const-and-let-in-wxs");
-const tester = new RuleTester({
- parser: require.resolve("@wxml/parser"),
-});
-
tester.run("no-const-and-let-in-wxs", rule, {
valid: [
{
diff --git a/tests/rules/no-dot-this-in-wx-key.js b/tests/rules/no-dot-this-in-wx-key.js
index 8f2165e..cd59647 100644
--- a/tests/rules/no-dot-this-in-wx-key.js
+++ b/tests/rules/no-dot-this-in-wx-key.js
@@ -1,10 +1,6 @@
-const RuleTester = require("eslint").RuleTester;
+const tester = require("../rule-tester-compat").RuleTester;
const rule = require("../../lib/rules/no-dot-this-in-wx-key");
-const tester = new RuleTester({
- parser: require.resolve("@wxml/parser"),
-});
-
tester.run("no-dot-this-in-wx-key", rule, {
valid: [
{
diff --git a/tests/rules/no-duplicate-attributes.js b/tests/rules/no-duplicate-attributes.js
index a2d2435..02dd905 100644
--- a/tests/rules/no-duplicate-attributes.js
+++ b/tests/rules/no-duplicate-attributes.js
@@ -1,10 +1,6 @@
-const RuleTester = require("eslint").RuleTester;
+const tester = require("../rule-tester-compat").RuleTester;
const rule = require("../../lib/rules/no-duplicate-attributes");
-const tester = new RuleTester({
- parser: require.resolve("@wxml/parser"),
-});
-
tester.run("no-duplicate-attributes", rule, {
valid: [
{
diff --git a/tests/rules/no-dynamic-wx-key.js b/tests/rules/no-dynamic-wx-key.js
index 674e69e..15079d9 100644
--- a/tests/rules/no-dynamic-wx-key.js
+++ b/tests/rules/no-dynamic-wx-key.js
@@ -1,10 +1,6 @@
-const RuleTester = require("eslint").RuleTester;
+const tester = require("../rule-tester-compat").RuleTester;
const rule = require("../../lib/rules/no-dynamic-wx-key");
-const tester = new RuleTester({
- parser: require.resolve("@wxml/parser"),
-});
-
tester.run("no-dynamic-wx-key", rule, {
valid: [
{
diff --git a/tests/rules/no-inconsistent-tagname.js b/tests/rules/no-inconsistent-tagname.js
index d3d7cdb..e87323e 100644
--- a/tests/rules/no-inconsistent-tagname.js
+++ b/tests/rules/no-inconsistent-tagname.js
@@ -1,10 +1,6 @@
-const RuleTester = require("eslint").RuleTester;
+const tester = require("../rule-tester-compat").RuleTester;
const rule = require("../../lib/rules/no-inconsistent-tagname");
-const tester = new RuleTester({
- parser: require.resolve("@wxml/parser"),
-});
-
tester.run("no-inconsistent-tagname", rule, {
valid: [
{
diff --git a/tests/rules/no-index-in-wx-key.js b/tests/rules/no-index-in-wx-key.js
index 4c31925..7e95420 100644
--- a/tests/rules/no-index-in-wx-key.js
+++ b/tests/rules/no-index-in-wx-key.js
@@ -1,10 +1,6 @@
-const RuleTester = require("eslint").RuleTester;
+const tester = require("../rule-tester-compat").RuleTester;
const rule = require("../../lib/rules/no-index-in-wx-key");
-const tester = new RuleTester({
- parser: require.resolve("@wxml/parser"),
-});
-
tester.run("no-index-in-wx-key", rule, {
valid: [
{
diff --git a/tests/rules/no-inline-wxs.js b/tests/rules/no-inline-wxs.js
index e4b7e52..9ad920a 100644
--- a/tests/rules/no-inline-wxs.js
+++ b/tests/rules/no-inline-wxs.js
@@ -1,10 +1,6 @@
-const RuleTester = require("eslint").RuleTester;
+const tester = require("../rule-tester-compat").RuleTester;
const rule = require("../../lib/rules/no-inline-wxs");
-const tester = new RuleTester({
- parser: require.resolve("@wxml/parser"),
-});
-
tester.run("no-inline-wxs", rule, {
valid: [
{
diff --git a/tests/rules/no-unexpected-string-bool.js b/tests/rules/no-unexpected-string-bool.js
index 5345f1a..d4165a4 100644
--- a/tests/rules/no-unexpected-string-bool.js
+++ b/tests/rules/no-unexpected-string-bool.js
@@ -1,10 +1,6 @@
-const RuleTester = require("eslint").RuleTester;
+const tester = require("../rule-tester-compat").RuleTester;
const rule = require("../../lib/rules/no-unexpected-string-bool");
-const tester = new RuleTester({
- parser: require.resolve("@wxml/parser"),
-});
-
tester.run("no-unexpected-string-bool", rule, {
valid: [
{
@@ -24,17 +20,41 @@ tester.run("no-unexpected-string-bool", rule, {
{
filename: "test.wxml",
code: ``,
- errors: [{ messageId: "trueString" }],
+ errors: [
+ {
+ messageId: "trueString",
+ data: {
+ true: "{{true}}",
+ false: "{{false}}",
+ },
+ },
+ ],
},
{
filename: "test.wxml",
code: ``,
- errors: [{ messageId: "falseString" }],
+ errors: [
+ {
+ messageId: "falseString",
+ data: {
+ true: "{{true}}",
+ false: "{{false}}",
+ },
+ },
+ ],
},
{
filename: "test.wxml",
code: ``,
- errors: [{ messageId: "falseString" }],
+ errors: [
+ {
+ messageId: "falseString",
+ data: {
+ true: "{{true}}",
+ false: "{{false}}",
+ },
+ },
+ ],
},
],
});
diff --git a/tests/rules/no-unnecessary-block.js b/tests/rules/no-unnecessary-block.js
index 2b6e58e..ab09d71 100644
--- a/tests/rules/no-unnecessary-block.js
+++ b/tests/rules/no-unnecessary-block.js
@@ -1,10 +1,6 @@
-const RuleTester = require("eslint").RuleTester;
+const tester = require("../rule-tester-compat").RuleTester;
const rule = require("../../lib/rules/no-unnecessary-block");
-const tester = new RuleTester({
- parser: require.resolve("@wxml/parser"),
-});
-
tester.run("no-unnecessary-block", rule, {
valid: [
{
diff --git a/tests/rules/no-vue-directive.js b/tests/rules/no-vue-directive.js
index 8ab6128..18edd6d 100644
--- a/tests/rules/no-vue-directive.js
+++ b/tests/rules/no-vue-directive.js
@@ -1,10 +1,6 @@
-const RuleTester = require("eslint").RuleTester;
+const tester = require("../rule-tester-compat").RuleTester;
const rule = require("../../lib/rules/no-vue-directive");
-const tester = new RuleTester({
- parser: require.resolve("@wxml/parser"),
-});
-
tester.run("no-vue-directive", rule, {
valid: [
{
diff --git a/tests/rules/no-wx-for-with-wx-else.js b/tests/rules/no-wx-for-with-wx-else.js
index 4fe4a93..85999b4 100644
--- a/tests/rules/no-wx-for-with-wx-else.js
+++ b/tests/rules/no-wx-for-with-wx-else.js
@@ -1,10 +1,6 @@
-const RuleTester = require("eslint").RuleTester;
+const tester = require("../rule-tester-compat").RuleTester;
const rule = require("../../lib/rules/no-wx-for-with-wx-else");
-const tester = new RuleTester({
- parser: require.resolve("@wxml/parser"),
-});
-
tester.run("no-wx-for-with-wx-else", rule, {
valid: [
{
diff --git a/tests/rules/no-wx-for-with-wx-if.js b/tests/rules/no-wx-for-with-wx-if.js
index 0f8bb6e..424771e 100644
--- a/tests/rules/no-wx-for-with-wx-if.js
+++ b/tests/rules/no-wx-for-with-wx-if.js
@@ -1,10 +1,6 @@
-const RuleTester = require("eslint").RuleTester;
+const tester = require("../rule-tester-compat").RuleTester;
const rule = require("../../lib/rules/no-wx-for-with-wx-if");
-const tester = new RuleTester({
- parser: require.resolve("@wxml/parser"),
-});
-
tester.run("no-wx-for-with-wx-if", rule, {
valid: [
{
diff --git a/tests/rules/no-wx-if-string.js b/tests/rules/no-wx-if-string.js
index 9241972..a17df82 100644
--- a/tests/rules/no-wx-if-string.js
+++ b/tests/rules/no-wx-if-string.js
@@ -1,10 +1,6 @@
-const RuleTester = require("eslint").RuleTester;
+const tester = require("../rule-tester-compat").RuleTester;
const rule = require("../../lib/rules/no-wx-if-string");
-const tester = new RuleTester({
- parser: require.resolve("@wxml/parser"),
-});
-
tester.run("no-wx-if-string", rule, {
valid: [
{
diff --git a/tests/rules/omit-bool-attributes.js b/tests/rules/omit-bool-attributes.js
index 6731d09..2046273 100644
--- a/tests/rules/omit-bool-attributes.js
+++ b/tests/rules/omit-bool-attributes.js
@@ -1,10 +1,6 @@
-const RuleTester = require("eslint").RuleTester;
+const tester = require("../rule-tester-compat").RuleTester;
const rule = require("../../lib/rules/omit-bool-attributes");
-const tester = new RuleTester({
- parser: require.resolve("@wxml/parser"),
-});
-
tester.run("omit-bool-attributes", rule, {
valid: [
{
@@ -37,6 +33,8 @@ tester.run("omit-bool-attributes", rule, {
messageId: "omitWarn",
data: {
attrKey: "autoplay",
+ true: "{{true}}",
+ false: "{{false}}",
},
},
],
@@ -49,6 +47,8 @@ tester.run("omit-bool-attributes", rule, {
messageId: "omitWarn",
data: {
attrKey: "autoplay",
+ true: "{{true}}",
+ false: "{{false}}",
},
},
],
@@ -61,6 +61,8 @@ tester.run("omit-bool-attributes", rule, {
messageId: "omitWarn",
data: {
attrKey: "autoplay",
+ true: "{{true}}",
+ false: "{{false}}",
},
},
],
@@ -73,6 +75,8 @@ tester.run("omit-bool-attributes", rule, {
messageId: "omitWarn",
data: {
attrKey: "autoplay",
+ true: "{{true}}",
+ false: "{{false}}",
},
},
],
diff --git a/tests/rules/quotes.js b/tests/rules/quotes.js
index 2d23e32..113d390 100644
--- a/tests/rules/quotes.js
+++ b/tests/rules/quotes.js
@@ -1,10 +1,6 @@
-const RuleTester = require("eslint").RuleTester;
+const tester = require("../rule-tester-compat").RuleTester;
const rule = require("../../lib/rules/quotes");
-const tester = new RuleTester({
- parser: require.resolve("@wxml/parser"),
-});
-
tester.run("quotes", rule, {
valid: [
{
diff --git a/tests/rules/report-interpolation-error.js b/tests/rules/report-interpolation-error.js
index 58906f9..3c12cfc 100644
--- a/tests/rules/report-interpolation-error.js
+++ b/tests/rules/report-interpolation-error.js
@@ -1,10 +1,6 @@
-const RuleTester = require("eslint").RuleTester;
+const tester = require("../rule-tester-compat").RuleTester;
const rule = require("../../lib/rules/report-interpolation-error");
-const tester = new RuleTester({
- parser: require.resolve("@wxml/parser"),
-});
-
tester.run("report-interpolation-error", rule, {
valid: [
{
diff --git a/tests/rules/report-wxml-syntax-error.js b/tests/rules/report-wxml-syntax-error.js
index 5b613ca..cb957fd 100644
--- a/tests/rules/report-wxml-syntax-error.js
+++ b/tests/rules/report-wxml-syntax-error.js
@@ -1,10 +1,6 @@
-const RuleTester = require("eslint").RuleTester;
+const tester = require("../rule-tester-compat").RuleTester;
const rule = require("../../lib/rules/report-wxml-syntax-error");
-const tester = new RuleTester({
- parser: require.resolve("@wxml/parser"),
-});
-
tester.run("report-wxml-syntax-error", rule, {
valid: [
{
diff --git a/tests/rules/report-wxs-syntax-error.js b/tests/rules/report-wxs-syntax-error.js
index 0200b67..4323694 100644
--- a/tests/rules/report-wxs-syntax-error.js
+++ b/tests/rules/report-wxs-syntax-error.js
@@ -1,10 +1,6 @@
-const RuleTester = require("eslint").RuleTester;
+const tester = require("../rule-tester-compat").RuleTester;
const rule = require("../../lib/rules/report-wxs-syntax-error");
-const tester = new RuleTester({
- parser: require.resolve("@wxml/parser"),
-});
-
tester.run("report-wxs-syntax-error", rule, {
valid: [
{
diff --git a/tests/rules/required-attributes.js b/tests/rules/required-attributes.js
index 743dc04..bc3b6ea 100644
--- a/tests/rules/required-attributes.js
+++ b/tests/rules/required-attributes.js
@@ -1,10 +1,6 @@
-const RuleTester = require("eslint").RuleTester;
+const tester = require("../rule-tester-compat").RuleTester;
const rule = require("../../lib/rules/required-attributes");
-const tester = new RuleTester({
- parser: require.resolve("@wxml/parser"),
-});
-
tester.run("required-attributes", rule, {
valid: [
{
diff --git a/tests/rules/required-root-tag.js b/tests/rules/required-root-tag.js
index 7e73599..554f89a 100644
--- a/tests/rules/required-root-tag.js
+++ b/tests/rules/required-root-tag.js
@@ -1,10 +1,6 @@
-const RuleTester = require("eslint").RuleTester;
+const tester = require("../rule-tester-compat").RuleTester;
const rule = require("../../lib/rules/required-root-tag");
-const tester = new RuleTester({
- parser: require.resolve("@wxml/parser"),
-});
-
tester.run("required-root-tag", rule, {
valid: [
{
diff --git a/tests/rules/required-tags.js b/tests/rules/required-tags.js
index 42701f0..55b3bc1 100644
--- a/tests/rules/required-tags.js
+++ b/tests/rules/required-tags.js
@@ -1,10 +1,6 @@
-const RuleTester = require("eslint").RuleTester;
+const tester = require("../rule-tester-compat").RuleTester;
const rule = require("../../lib/rules/required-tags");
-const tester = new RuleTester({
- parser: require.resolve("@wxml/parser"),
-});
-
tester.run("required-tags", rule, {
valid: [
{
diff --git a/tests/rules/wx-key.js b/tests/rules/wx-key.js
index e9a5226..9780830 100644
--- a/tests/rules/wx-key.js
+++ b/tests/rules/wx-key.js
@@ -1,10 +1,6 @@
-const RuleTester = require("eslint").RuleTester;
+const tester = require("../rule-tester-compat").RuleTester;
const rule = require("../../lib/rules/wx-key");
-const tester = new RuleTester({
- parser: require.resolve("@wxml/parser"),
-});
-
tester.run("wx-key", rule, {
valid: [
{
diff --git a/tests/rules/wxs-module-prop.js b/tests/rules/wxs-module-prop.js
index 8e92cc7..b19ccbb 100644
--- a/tests/rules/wxs-module-prop.js
+++ b/tests/rules/wxs-module-prop.js
@@ -1,10 +1,6 @@
-const RuleTester = require("eslint").RuleTester;
+const tester = require("../rule-tester-compat").RuleTester;
const rule = require("../../lib/rules/wxs-module-prop");
-const tester = new RuleTester({
- parser: require.resolve("@wxml/parser"),
-});
-
tester.run("wxs-module-prop", rule, {
valid: [
{
diff --git a/tests/rules/wxs-must-be-top-level.js b/tests/rules/wxs-must-be-top-level.js
index 4576fe5..a20cfb8 100644
--- a/tests/rules/wxs-must-be-top-level.js
+++ b/tests/rules/wxs-must-be-top-level.js
@@ -1,10 +1,6 @@
-const RuleTester = require("eslint").RuleTester;
+const tester = require("../rule-tester-compat").RuleTester;
const rule = require("../../lib/rules/wxs-must-be-top-level");
-const tester = new RuleTester({
- parser: require.resolve("@wxml/parser"),
-});
-
tester.run("wxs-must-be-top-level", rule, {
valid: [
{