Skip to content

Commit

Permalink
lint: make sure that prettier-doc/no-concat is enforced
Browse files Browse the repository at this point in the history
`concat` function has been deprecated since prettier 2.3.0.
  • Loading branch information
zackad committed Feb 22, 2024
1 parent 9a498d5 commit 2d78933
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
extends:
- eslint:recommended
- plugin:prettier/recommended
- plugin:prettier-doc/recommended
- plugin:jest/recommended
plugins:
- import
Expand Down Expand Up @@ -30,6 +31,7 @@ rules:
- never
prefer-arrow-callback: error
prefer-const: error
prettier-doc/no-concat: error
react/no-deprecated: off
strict: off
symbol-description: error
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jest": "^27.9.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-prettier-doc": "^1.1.0",
"jest": "^30.0.0-alpha.3",
"jest-runner-eslint": "^2.1.2"
},
Expand Down
6 changes: 3 additions & 3 deletions tests/switch-plugin/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const prettier = require("prettier");
const { concat, indent, hardline } = prettier.doc.builders;
const { indent, hardline } = prettier.doc.builders;
const {
STRING_NEEDS_QUOTES,
printSingleTwigTag,
Expand All @@ -16,7 +16,7 @@ const printSwitch = (node, path, print) => {
node.sections.forEach((section, i) => {
if (Node.isGenericTwigTag(section)) {
if (section.tagName === "endswitch") {
parts.push(concat([hardline, printedSections[i]]));
parts.push([hardline, printedSections[i]]);
} else {
parts.push(indentWithHardline(printedSections[i]));
}
Expand All @@ -27,7 +27,7 @@ const printSwitch = (node, path, print) => {
}
}
});
return concat(parts);
return parts;
};

module.exports = {
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1606,6 +1606,11 @@ eslint-plugin-jest@^27.9.0:
dependencies:
"@typescript-eslint/utils" "^5.10.0"

eslint-plugin-prettier-doc@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier-doc/-/eslint-plugin-prettier-doc-1.1.0.tgz#ebf679b480e6048e90d5b152e6043714780bb4e6"
integrity sha512-ytzztiiqobTeYLqdRnv+dgowcb63gFFy31RekPeVPB6YOshwuGKJVKPdkq/mYtwsJ+eDtLiHksfwH5/M5nU09g==

eslint-plugin-prettier@^4.0.0:
version "4.2.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-4.2.1.tgz#651cbb88b1dab98bfd42f017a12fa6b2d993f94b"
Expand Down

0 comments on commit 2d78933

Please sign in to comment.