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

feat: prettier 3 support #44

Merged
merged 1 commit into from
Oct 11, 2023
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
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node: [16.x, 18.x]
node: [18, 20]
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Use node@${{ matrix.node }}
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: "npm"
Expand All @@ -28,4 +28,4 @@ jobs:
- name: Run tests
run: npm run ci:test
- name: Report code coverage
run: npm run ci:report
uses: codecov/codecov-action@v3
1 change: 1 addition & 0 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"timeout": "5000",
"extension": ["js", "ts"],
"enable-source-maps": true,
"watchFiles": ["src/**/*.ts"],
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
</a>
</h1>

> Note:
> For prettier@2 or below use `prettier-plugin-marko@1`.

A [Prettier](https://prettier.io/) plugin for parsing and printing Marko files.

# Installation
Expand Down
2 changes: 1 addition & 1 deletion build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const opts: BuildOptions = {
({ path }) => ({
path,
external: true,
})
}),
);
},
},
Expand Down
5,890 changes: 3,646 additions & 2,244 deletions package-lock.json

Large diffs are not rendered by default.

41 changes: 19 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,30 @@
"author": "Dylan Piercey <[email protected]>",
"bugs": "https://github.com/marko-js/prettier/issues",
"devDependencies": {
"@babel/generator": "^7.20.14",
"@commitlint/cli": "^17.4.4",
"@commitlint/config-conventional": "^17.4.4",
"@babel/generator": "^7.23.0",
"@commitlint/cli": "^17.7.2",
"@commitlint/config-conventional": "^17.7.0",
"@istanbuljs/nyc-config-typescript": "^1.0.2",
"@types/babel__generator": "^7.6.4",
"@types/mocha": "^10.0.1",
"@types/node": "^18.14.0",
"@types/prettier": "^2.7.2",
"@typescript-eslint/eslint-plugin": "^5.52.0",
"@typescript-eslint/parser": "^5.52.0",
"codecov": "^3.8.3",
"esbuild": "^0.17.8",
"esbuild-register": "^3.4.2",
"eslint": "^8.34.0",
"eslint-config-prettier": "^8.6.0",
"fast-glob": "^3.2.12",
"@types/babel__generator": "^7.6.5",
"@types/mocha": "^10.0.2",
"@types/node": "^20.8.4",
"@typescript-eslint/eslint-plugin": "^6.7.5",
"@typescript-eslint/parser": "^6.7.5",
"esbuild": "^0.19.4",
"esbuild-register": "^3.5.0",
"eslint": "^8.51.0",
"eslint-config-prettier": "^9.0.0",
"fast-glob": "^3.3.1",
"fixpack": "^4.0.0",
"husky": "^8.0.3",
"lint-staged": "^13.1.2",
"marko": "^5.22.4",
"lint-staged": "^14.0.1",
"marko": "^5.31.11",
"mocha": "^10.2.0",
"mocha-snap": "^4.3.0",
"mocha-snap": "^5.0.0",
"nyc": "^15.1.0",
"prettier": "^2.8.8",
"semantic-release": "^20.1.0",
"typescript": "^4.9.5"
"prettier": "^3.0.3",
"semantic-release": "^22.0.5",
"typescript": "^5.2.2"
},
"exports": {
".": {
Expand Down Expand Up @@ -66,7 +64,6 @@
},
"scripts": {
"build": "tsc -b && node -r esbuild-register build",
"ci:report": "codecov",
"ci:test": "nyc npm run mocha -- --forbid-pending --forbid-only",
"format": "npm run lint:eslint -- --fix && npm run lint:prettier -- --write && (fixpack || true)",
"lint": "tsc -b && npm run lint:eslint && npm run lint:prettier -- -l && fixpack",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{ aaaaaaaaaa: 1, bbbbbbbbbb: 2, cccccccccc: 3 },
aaaaaaaaaa,
bbbbbbbbbb,
cccccccccc
cccccccccc,
)/>
-- ${test}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ div foo(
{ aaaaaaaaaa: 1, bbbbbbbbbb: 2, cccccccccc: 3 },
aaaaaaaaaa,
bbbbbbbbbb,
cccccccccc
cccccccccc,
)
-- ${test}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{ aaaaaaaaaa: 1, bbbbbbbbbb: 2, cccccccccc: 3 },
aaaaaaaaaa,
bbbbbbbbbb,
cccccccccc
cccccccccc,
)/>
-- ${test}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{ aaaaaaaaaa: 1, bbbbbbbbbb: 2, cccccccccc: 3 },
aaaaaaaaaa,
bbbbbbbbbb,
cccccccccc
cccccccccc,
)/>
-- ${test}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
{ aaaaaaaaaa: 1, bbbbbbbbbb: 2, cccccccccc: 3 },
aaaaaaaaaa,
bbbbbbbbbb,
cccccccccc
cccccccccc,
)/>
<foo(a, b)/>
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ foo(
{ aaaaaaaaaa: 1, bbbbbbbbbb: 2, cccccccccc: 3 },
aaaaaaaaaa,
bbbbbbbbbb,
cccccccccc
cccccccccc,
)
foo(a, b)
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
{ aaaaaaaaaa: 1, bbbbbbbbbb: 2, cccccccccc: 3 },
aaaaaaaaaa,
bbbbbbbbbb,
cccccccccc
cccccccccc,
)/>
<foo(a, b)/>
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
{ aaaaaaaaaa: 1, bbbbbbbbbb: 2, cccccccccc: 3 },
aaaaaaaaaa,
bbbbbbbbbb,
cccccccccc
cccccccccc,
)/>
<foo(a, b)/>
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
{ aaaaaaaaaa: 1, bbbbbbbbbb: 2, cccccccccc: 3 },
aaaaaaaaaa,
bbbbbbbbbb,
cccccccccc
cccccccccc,
)/>
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ div foo(
{ aaaaaaaaaa: 1, bbbbbbbbbb: 2, cccccccccc: 3 },
aaaaaaaaaa,
bbbbbbbbbb,
cccccccccc
cccccccccc,
)
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
{ aaaaaaaaaa: 1, bbbbbbbbbb: 2, cccccccccc: 3 },
aaaaaaaaaa,
bbbbbbbbbb,
cccccccccc
cccccccccc,
)/>
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
{ aaaaaaaaaa: 1, bbbbbbbbbb: 2, cccccccccc: 3 },
aaaaaaaaaa,
bbbbbbbbbb,
cccccccccc
cccccccccc,
)/>
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
script -- window.bla = ${JSON.stringify(input.bla)};
script
-- window.bla = ${JSON.stringify(input.bla)};

script
--
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
style {

invalid { color blue; }

}

<style>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
style {

invalid { color blue; }

}

style
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
style {

invalid { color blue; }

}

<style>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
style {

invalid { color blue; }

}

<style>
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/__snapshots__/params-tag.expected/auto.marko
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
},
aaaaaaaaaa,
bbbbbbbbbb,
cccccccccc
cccccccccc,
|/>
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ foo|
},
aaaaaaaaaa,
bbbbbbbbbb,
cccccccccc
cccccccccc,
|
2 changes: 1 addition & 1 deletion src/__tests__/__snapshots__/params-tag.expected/html.marko
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
},
aaaaaaaaaa,
bbbbbbbbbb,
cccccccccc
cccccccccc,
|/>
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
},
aaaaaaaaaa,
bbbbbbbbbb,
cccccccccc
cccccccccc,
|/>
2 changes: 1 addition & 1 deletion src/__tests__/__snapshots__/scriptlets.expected/auto.marko
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ $ console.log(
["g", 1],
["h", 1],
["i", 1],
])
]),
);
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ $ console.log(
["g", 1],
["h", 1],
["i", 1],
])
]),
);
2 changes: 1 addition & 1 deletion src/__tests__/__snapshots__/scriptlets.expected/html.marko
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ $ console.log(
["g", 1],
["h", 1],
["i", 1],
])
]),
);
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ $ console.log(
["g", 1],
["h", 1],
["i", 1],
])
]),
);
2 changes: 1 addition & 1 deletion src/__tests__/__snapshots__/static.expected/auto.marko
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ static console.log(
["g", 1],
["h", 1],
["i", 1],
])
]),
);
2 changes: 1 addition & 1 deletion src/__tests__/__snapshots__/static.expected/concise.marko
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ static console.log(
["g", 1],
["h", 1],
["i", 1],
])
]),
);
2 changes: 1 addition & 1 deletion src/__tests__/__snapshots__/static.expected/html.marko
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ static console.log(
["g", 1],
["h", 1],
["i", 1],
])
]),
);
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ static console.log(
["g", 1],
["h", 1],
["i", 1],
])
]),
);
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
{ aaaaaaaaaa: 1, bbbbbbbbbb: 2, cccccccccc: 3 },
aaaaaaaaaa,
bbbbbbbbbb,
cccccccccc
cccccccccc,
)/>
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ foo(
{ aaaaaaaaaa: 1, bbbbbbbbbb: 2, cccccccccc: 3 },
aaaaaaaaaa,
bbbbbbbbbb,
cccccccccc
cccccccccc,
)
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
{ aaaaaaaaaa: 1, bbbbbbbbbb: 2, cccccccccc: 3 },
aaaaaaaaaa,
bbbbbbbbbb,
cccccccccc
cccccccccc,
)/>
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
{ aaaaaaaaaa: 1, bbbbbbbbbb: 2, cccccccccc: 3 },
aaaaaaaaaa,
bbbbbbbbbb,
cccccccccc
cccccccccc,
)/>
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
w,
x,
y,
z
z,
|>
${a}
</custom-tag>
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ custom-tag|
w,
x,
y,
z
z,
|
-- ${a}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
w,
x,
y,
z
z,
|>
${a}
</custom-tag>
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
w,
x,
y,
z
z,
|>
${a}
</custom-tag>
Loading