Skip to content

Commit

Permalink
prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertAKARobin committed Sep 3, 2024
1 parent 0b9ac9c commit ae73aa7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
2 changes: 1 addition & 1 deletion docs/rules/no-extra-spacing-text.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = {
[Whitespace in HTML is largely ignored](https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model/Whitespace), so the purpose of this rule is to prevent unnecessary whitespace in text, such as:

- Tab characters
- Sequences of more than 1 whitepsace character
- Sequences of more than 1 whitespace character

When used with `--fix`, the rule will replace invalid whitespace with a single space.

Expand Down
3 changes: 2 additions & 1 deletion packages/eslint-plugin/lib/rules/no-extra-spacing-text.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ module.exports = {
},
],
messages: {
[MESSAGE_IDS.UNEXPECTED]: "Tabs and/or multiple consecutive spaces not allowed here",
[MESSAGE_IDS.UNEXPECTED]:
"Tabs and/or multiple consecutive spaces not allowed here",
},
},

Expand Down
14 changes: 3 additions & 11 deletions packages/eslint-plugin/tests/rules/no-extra-spacing-text.test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
const createRuleTester = require("../rule-tester");
const rule = require("../../lib/rules/no-extra-spacing-text");


function errorsAt(...positions) {
return positions.map(input => {
return positions.map((input) => {
const [line, column, length] = input;
if (input.length === 3) {
return {
Expand Down Expand Up @@ -108,11 +107,7 @@ ruleTester.run("no-extra-spacing-text", rule, {
{
code: `<div>\n\tfoo \n</div> \n<div>\n\tbar\t\n</div>`,
output: `<div>\n\tfoo\n</div>\n<div>\n\tbar\n</div>`,
errors: errorsAt(
[2, 5, 3, 1],
[3, 7, 4, 1],
[5, 5, 6, 1],
),
errors: errorsAt([2, 5, 3, 1], [3, 7, 4, 1], [5, 5, 6, 1]),
},

{
Expand All @@ -136,10 +131,7 @@ ruleTester.run("no-extra-spacing-text", rule, {
foo bar
</div>
`,
errors: errorsAt(
[3, 6, 5],
[3, 14, 4, 1],
),
errors: errorsAt([3, 6, 5], [3, 14, 4, 1]),
},

{
Expand Down

0 comments on commit ae73aa7

Please sign in to comment.