Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ota-meshi committed Mar 18, 2024
1 parent c39fb21 commit ba76591
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 6 deletions.
9 changes: 9 additions & 0 deletions .eslintrc.for-vscode.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
extends: [require.resolve("./.eslintrc.js")],
overrides: [
{
files: ["tests/lib/rules/*"],
extends: ["plugin:eslint-rule-tester/recommended-legacy"],
},
],
};
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
"markdown",
"yaml"
],
"eslint.options": {
"overrideConfigFile": "./.eslintrc.for-vscode.js"
},
"typescript.validate.enable": true,
"javascript.validate.enable": false,
"vetur.validation.script": false,
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-eslint-plugin": "^5.0.0",
"eslint-plugin-eslint-rule-tester": "^0.5.1",
"eslint-plugin-json-schema-validator": "^4.6.1",
"eslint-plugin-jsonc": "^2.0.0",
"eslint-plugin-markdown": "^3.0.0",
Expand Down
33 changes: 27 additions & 6 deletions tests/lib/rules/no-useless-escape.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,38 @@ tester.run("no-useless-escape", rule as any, {
{
filename: "test.json",
code: '"hol\\a"',
errors: ["Unnecessary escape character: \\a."],
errors: [
{
message: "Unnecessary escape character: \\a.",
suggestions: [
{ messageId: "removeEscape", output: `"hola"` },
{ messageId: "escapeBackslash", output: String.raw`"hol\\a"` },
],
},
],
},
{
filename: "test.vue",
code: `<custom-block lang="json">"hol\\a"</custom-block>`,
errors: ["Unnecessary escape character: \\a."],
...({
languageOptions: {
parser: vueParser,
errors: [
{
message: "Unnecessary escape character: \\a.",
suggestions: [
{
messageId: "removeEscape",
output: `<custom-block lang="json">"hola"</custom-block>`,
},
{
messageId: "escapeBackslash",
output: String.raw`<custom-block lang="json">"hol\\a"</custom-block>`,
},
],
},
} as any),
],
// @ts-expect-error
languageOptions: {
parser: vueParser,
},
},
],
});

0 comments on commit ba76591

Please sign in to comment.