Skip to content

Commit ddde3ad

Browse files
authored
Merge branch 'master' into chore/export_package
2 parents f7f66d5 + fa1e1e5 commit ddde3ad

File tree

5 files changed

+60
-26
lines changed

5 files changed

+60
-26
lines changed

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
test/fixtures
2+
/pnpm-lock.yaml
13
# this file doesn't exist, but we use it as a filename that should be ignored
24
# by prettier in the tests
35
ignore-me.js

.prettierrc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
{
22
"arrowParens": "avoid",
33
"singleQuote": true,
4-
"plugins": ["@prettier/plugin-pug", "prettier-plugin-pkg"],
4+
"plugins": [
5+
"@prettier/plugin-pug",
6+
"prettier-plugin-pkg",
7+
"prettier-plugin-svelte"
8+
],
59
"overrides": [
610
{
711
"files": ".changeset/**/*",

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@
4141
"prettier"
4242
],
4343
"scripts": {
44+
"check": "prettier --check . && pnpm lint",
4445
"format": "prettier --write . && pnpm lint --fix",
4546
"lint": "eslint . --cache -f friendly --max-warnings 10",
4647
"prepare": "simple-git-hooks",
47-
"prerelease": "pnpm format && pnpm test",
48-
"release": "changeset publish",
48+
"release": "pnpm check && pnpm test && changeset publish",
4949
"test": "pnpm lint && mocha"
5050
},
5151
"peerDependencies": {
@@ -81,9 +81,9 @@
8181
"eslint": "^8.56.0",
8282
"eslint-config-prettier": "^9.1.0",
8383
"eslint-formatter-friendly": "^7.0.0",
84-
"eslint-mdx": "^2.2.1",
84+
"eslint-mdx": "^2.3.0",
8585
"eslint-plugin-eslint-plugin": "^5.2.1",
86-
"eslint-plugin-mdx": "^2.2.1",
86+
"eslint-plugin-mdx": "^2.3.0",
8787
"eslint-plugin-n": "^16.5.0",
8888
"eslint-plugin-prettier": "link:.",
8989
"eslint-plugin-pug": "^1.2.5",
@@ -94,6 +94,7 @@
9494
"mocha": "^10.2.0",
9595
"prettier": "^3.1.1",
9696
"prettier-plugin-pkg": "^0.18.0",
97+
"prettier-plugin-svelte": "^3.1.2",
9798
"simple-git-hooks": "^2.9.0",
9899
"svelte": "^4.2.8",
99100
"vue-eslint-parser": "^9.3.2"

pnpm-lock.yaml

Lines changed: 22 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/prettier.js

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,21 @@ const eslint = new ESLint({
3737
},
3838
extends: 'plugin:prettier/recommended',
3939
overrides: [
40+
{
41+
// `.prettierignore` will be used by default which is unexpected for these test fixtures
42+
files: 'test/fixtures/**/*',
43+
rules: {
44+
'prettier/prettier': [
45+
'error',
46+
{},
47+
{
48+
fileInfoOptions: {
49+
ignorePath: '.eslintignore',
50+
},
51+
},
52+
],
53+
},
54+
},
4055
{
4156
files: ['*.{md,mdx}'],
4257
extends: 'plugin:mdx/recommended',
@@ -283,20 +298,25 @@ runFixture('*.mdx', [
283298
],
284299
]);
285300

301+
/**
302+
* @see https://github.com/sveltejs/svelte/blob/226bf419f9b9b5f1a6da33bd6403dd70afe58b52/packages/svelte/package.json#L73
303+
*/
304+
const svelteUnsupported = +process.versions.node.split('.')[0] < 16;
305+
286306
runFixture(
287307
'eslint-plugin-svelte/*.svelte',
288308
[
289309
[
290310
{
291-
column: 5,
311+
column: 1,
292312
endColumn: 11,
293313
endLine: 2,
294314
fix: {
295-
range: [13, 19],
296-
text: 'name',
315+
range: [9, 19],
316+
text: ' let name',
297317
},
298318
line: 2,
299-
message: 'Replace `·name·` with `name`',
319+
message: 'Replace `let··name·` with `··let·name`',
300320
messageId: 'replace',
301321
nodeType: null,
302322
ruleId: 'prettier/prettier',
@@ -319,16 +339,10 @@ runFixture(
319339
},
320340
],
321341
],
322-
// FIXME: https://github.com/sveltejs/prettier-plugin-svelte/issues/317
323-
true,
342+
svelteUnsupported,
324343
);
325344

326-
runFixture(
327-
'eslint-plugin-svelte3/*.svelte',
328-
[[], []],
329-
// FIXME: https://github.com/sveltejs/prettier-plugin-svelte/issues/317
330-
true,
331-
);
345+
runFixture('eslint-plugin-svelte3/*.svelte', [[], []], svelteUnsupported);
332346

333347
/**
334348
* The `script` code style actually does not match `prettier`'s,

0 commit comments

Comments
 (0)