Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lint: Make sure that prettier-doc/no-concat is enforced #8

Merged
merged 1 commit into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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