From 65ef1b6491ab2053601eb61fffa17f8c71fe8415 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 15 Jan 2025 00:24:51 +0900 Subject: [PATCH] chore(deps): update dependency eslint-plugin-prettier to v5 (#72) * chore(deps): update dependency eslint-plugin-prettier to v5 * Update package.json * format --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Yosuke Ota --- .github/workflows/format.yml | 31 +++++++++++++++++++++++++++++ lib/markdown/document.js | 2 +- lib/markdown/extract-styles.js | 8 ++++---- lib/markdown/parse-styles.js | 10 +++++----- lib/stringify.js | 2 +- lib/syntax/build-syntax-resolver.js | 2 +- package.json | 4 ++-- test/document-api.js | 26 ++++++++++++------------ test/error.js | 6 +++--- test/integration/autoprefixer.js | 4 ++-- test/integration/stylelint.js | 6 +++--- test/root.js | 2 +- test/utils.js | 2 +- 13 files changed, 68 insertions(+), 37 deletions(-) create mode 100644 .github/workflows/format.yml diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml new file mode 100644 index 0000000..97ee4b4 --- /dev/null +++ b/.github/workflows/format.yml @@ -0,0 +1,31 @@ +name: 👔 Format + +on: + workflow_dispatch: null + +jobs: + format: + runs-on: ubuntu-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v4 + - name: Setup node + uses: actions/setup-node@v4 + - name: Install deps + run: npm install -f + - name: Format + run: npm run eslint-fix + - name: Commit + run: | + git config --local user.email "github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" + + git add . + if [ -z "$(git status --porcelain)" ]; then + echo "no formatting changed" + exit 0 + fi + git commit -m "chore: format" + git push + echo "pushed formatting changes https://github.com/$GITHUB_REPOSITORY/commit/$(git rev-parse HEAD)" diff --git a/lib/markdown/document.js b/lib/markdown/document.js index 19a81b9..63741cb 100644 --- a/lib/markdown/document.js +++ b/lib/markdown/document.js @@ -7,7 +7,7 @@ class Document extends PostCssDocument { return super.toString( stringifier || { stringify: require("../stringify"), - } + }, ); } diff --git a/lib/markdown/extract-styles.js b/lib/markdown/extract-styles.js index 97a3800..a9dab4f 100644 --- a/lib/markdown/extract-styles.js +++ b/lib/markdown/extract-styles.js @@ -55,14 +55,14 @@ function extractStyles(source, opts) { lang: lang.toLowerCase(), blockInfo, }, - parent + parent, ); } function processHtml(nodes, parent) { if ( nodes.every( - (node) => node.type === "text" || isHtmlComment(node.value || "") + (node) => node.type === "text" || isHtmlComment(node.value || ""), ) ) { // all comment @@ -77,11 +77,11 @@ function extractStyles(source, opts) { isMarkdown: false, content: source.slice( startIndex, - nodes[nodes.length - 1].position.end.offset + nodes[nodes.length - 1].position.end.offset, ), lang: "html", }, - parent + parent, ); } diff --git a/lib/markdown/parse-styles.js b/lib/markdown/parse-styles.js index ef0e91c..69916a1 100644 --- a/lib/markdown/parse-styles.js +++ b/lib/markdown/parse-styles.js @@ -90,7 +90,7 @@ class LocalFixer { this.fixLocation(error.input); error.message = error.message.replace( /:\d+:\d+:/, - `:${error.line}:${error.column}:` + `:${error.line}:${error.column}:`, ); } return error; @@ -110,8 +110,8 @@ class LocalFixer { document: this.source, map: false, }, - style.opts - ) + style.opts, + ), ); } catch (error) { this.error(error); @@ -140,7 +140,7 @@ class LocalFixer { getRootEndOffset(root) { const loc = new Locations(root.source.input.css).getLocFromOffset( - root.source.input.css.length + root.source.input.css.length, ); if (loc.line === 1) { loc.column += root.source.start.column - 1; @@ -182,7 +182,7 @@ function parseStyles(source, opts, styles) { } root.raws.codeBefore = source.slice( index, - getOffsetFromLoc(root.source.start) + getOffsetFromLoc(root.source.start), ); // Note: Stylelint is still using this property. diff --git a/lib/stringify.js b/lib/stringify.js index fab2051..676e3ae 100644 --- a/lib/stringify.js +++ b/lib/stringify.js @@ -140,7 +140,7 @@ function stringify(node, builder) { customAppender.appendCodeAfter( root.raws.codeAfter || "", root, - "codeAfter" + "codeAfter", ); }); } else { diff --git a/lib/syntax/build-syntax-resolver.js b/lib/syntax/build-syntax-resolver.js index afa34af..11909aa 100644 --- a/lib/syntax/build-syntax-resolver.js +++ b/lib/syntax/build-syntax-resolver.js @@ -75,7 +75,7 @@ module.exports = function buildSyntaxResolver(config) { } if (definedLangs.has(lang)) { throw new Error( - `Cannot resolve module "${syntax}". It's likely that the module isn't installed correctly. Try reinstalling by running the \`npm install ${syntax}@latest --save-dev\`` + `Cannot resolve module "${syntax}". It's likely that the module isn't installed correctly. Try reinstalling by running the \`npm install ${syntax}@latest --save-dev\``, ); } } diff --git a/package.json b/package.json index 7fc29f7..ec13efe 100644 --- a/package.json +++ b/package.json @@ -72,7 +72,7 @@ "eslint-plugin-jsonc": "^2.0.0", "eslint-plugin-node": "^11.1.0", "eslint-plugin-node-dependencies": "^0.12.0", - "eslint-plugin-prettier": "^4.0.0", + "eslint-plugin-prettier": "^5.0.0", "eslint-plugin-regexp": "^1.4.1", "eslint-plugin-yml": "^1.0.0", "mocha": "^10.0.0", @@ -82,7 +82,7 @@ "postcss-less": "^6.0.0", "postcss-scss": "^4.0.0", "postcss-styl": "^0.12.0", - "prettier": "^2.4.1", + "prettier": "^3.0.0", "stylelint": "^14.4.0", "stylelint-config-standard": "^29.0.0", "sugarss": "^4.0.0" diff --git a/test/document-api.js b/test/document-api.js index 5cb46ce..a6432c2 100644 --- a/test/document-api.js +++ b/test/document-api.js @@ -37,7 +37,7 @@ describe("api tests", () => { "}", "b {}", "```", - ].join("\n") + ].join("\n"), ); }); }); @@ -73,7 +73,7 @@ describe("api tests", () => { "\tdisplay: flex;", "}", "```", - ].join("\n") + ].join("\n"), ); }); }); @@ -87,7 +87,7 @@ describe("api tests", () => { root.last, postcss.rule({ selector: "b", - }) + }), ); }, }; @@ -127,7 +127,7 @@ describe("api tests", () => { "\tdisplay: flex;", "}", "```", - ].join("\n") + ].join("\n"), ); }); }); @@ -141,7 +141,7 @@ describe("api tests", () => { root.first, postcss.rule({ selector: "b", - }) + }), ); }, }; @@ -180,7 +180,7 @@ describe("api tests", () => { "\tdisplay: flex;", "}b {}", "```", - ].join("\n") + ].join("\n"), ); }); }); @@ -219,7 +219,7 @@ describe("api tests", () => { "\tdisplay: flex;", "}", "```", - ].join("\n") + ].join("\n"), ); }); }); @@ -260,7 +260,7 @@ describe("api tests", () => { "\tdisplay: flex;", "}b {}", "```", - ].join("\n") + ].join("\n"), ); }); }); @@ -298,7 +298,7 @@ describe("api tests", () => { "b {}", "", "```", - ].join("\n") + ].join("\n"), ); }); }); @@ -332,7 +332,7 @@ describe("api tests", () => { // "", "", - ].join("\n") + ].join("\n"), ); }); }); @@ -366,7 +366,7 @@ describe("api tests", () => { "```css", "b {}", "```", - ].join("\n") + ].join("\n"), ); }); }); @@ -401,7 +401,7 @@ describe("api tests", () => { "```css", "b {}", "```", - ].join("\n") + ].join("\n"), ); }); }); @@ -435,7 +435,7 @@ describe("api tests", () => { "> ```css", "> b {}", "> ```", - ].join("\n") + ].join("\n"), ); }); }); diff --git a/test/error.js b/test/error.js index 9cd1298..fc1401a 100644 --- a/test/error.js +++ b/test/error.js @@ -98,7 +98,7 @@ describe("error tests", () => { expect(() => parser.parse(md, { from: "markdown.md", - }) + }), ).to.throw("TEST"); }); it("define rules option", () => { @@ -119,7 +119,7 @@ describe("error tests", () => { expect(() => parser.parse(md, { from: "markdown.md", - }) + }), ).to.throw("Unknown word"); }); it("define syntax option", () => { @@ -135,7 +135,7 @@ describe("error tests", () => { expect(() => parser.parse(md, { from: "markdown.md", - }) + }), ).to.throw('Cannot resolve module "postcss-foo"'); }); }); diff --git a/test/integration/autoprefixer.js b/test/integration/autoprefixer.js index 1adebd5..1c876c1 100644 --- a/test/integration/autoprefixer.js +++ b/test/integration/autoprefixer.js @@ -12,7 +12,7 @@ chai.use(jestSnapshotPlugin()); const FIXTURE_ROOT = path.resolve( __dirname, - "../../test-fixtures/integration/autoprefixer" + "../../test-fixtures/integration/autoprefixer", ); describe("Integration with autoprefixer", () => { @@ -24,7 +24,7 @@ describe("Integration with autoprefixer", () => { .then(function (result) { const actual = result.content; chai.expect(actual).toMatchSnapshot(); - }) + }), ); }); } diff --git a/test/integration/stylelint.js b/test/integration/stylelint.js index d1804ba..7d1610a 100644 --- a/test/integration/stylelint.js +++ b/test/integration/stylelint.js @@ -12,7 +12,7 @@ chai.use(jestSnapshotPlugin()); const FIXTURE_ROOT = path.resolve( __dirname, - "../../test-fixtures/integration/stylelint" + "../../test-fixtures/integration/stylelint", ); describe("Integration with stylelint", () => { @@ -29,7 +29,7 @@ describe("Integration with stylelint", () => { .then((result) => { const actual = result.results[0].warnings; chai.expect(actual).toMatchSnapshot(); - }) + }), ); }); describe(`stylelint --fix with markdown`, () => { @@ -45,7 +45,7 @@ describe("Integration with stylelint", () => { .then((result) => { const actual = result.output; chai.expect(actual).toMatchSnapshot(); - }) + }), ); }); } diff --git a/test/root.js b/test/root.js index 4e7a64d..55606ab 100644 --- a/test/root.js +++ b/test/root.js @@ -29,7 +29,7 @@ describe("Root node tests", () => { " .c", " color red", "", - ].join("\n") + ].join("\n"), ); }); }); diff --git a/test/utils.js b/test/utils.js index 922279c..34d61f7 100644 --- a/test/utils.js +++ b/test/utils.js @@ -10,7 +10,7 @@ function* listupFixtures(rootDir) { const filepath = path.join(rootDir, filename); if (fs.statSync(filepath).isDirectory()) { for (const { filepath: childFilepath, content } of listupFixtures( - filepath + filepath, )) { yield { filename: childFilepath.slice(rootDir.length),