Skip to content

Commit

Permalink
Merge branch 'master' into chore/export_package
Browse files Browse the repository at this point in the history
  • Loading branch information
JounQin committed Dec 26, 2023
2 parents f7f66d5 + fa1e1e5 commit ddde3ad
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 26 deletions.
2 changes: 2 additions & 0 deletions .prettierignore
@@ -1,3 +1,5 @@
test/fixtures
/pnpm-lock.yaml
# this file doesn't exist, but we use it as a filename that should be ignored
# by prettier in the tests
ignore-me.js
6 changes: 5 additions & 1 deletion .prettierrc
@@ -1,7 +1,11 @@
{
"arrowParens": "avoid",
"singleQuote": true,
"plugins": ["@prettier/plugin-pug", "prettier-plugin-pkg"],
"plugins": [
"@prettier/plugin-pug",
"prettier-plugin-pkg",
"prettier-plugin-svelte"
],
"overrides": [
{
"files": ".changeset/**/*",
Expand Down
9 changes: 5 additions & 4 deletions package.json
Expand Up @@ -41,11 +41,11 @@
"prettier"
],
"scripts": {
"check": "prettier --check . && pnpm lint",
"format": "prettier --write . && pnpm lint --fix",
"lint": "eslint . --cache -f friendly --max-warnings 10",
"prepare": "simple-git-hooks",
"prerelease": "pnpm format && pnpm test",
"release": "changeset publish",
"release": "pnpm check && pnpm test && changeset publish",
"test": "pnpm lint && mocha"
},
"peerDependencies": {
Expand Down Expand Up @@ -81,9 +81,9 @@
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-formatter-friendly": "^7.0.0",
"eslint-mdx": "^2.2.1",
"eslint-mdx": "^2.3.0",
"eslint-plugin-eslint-plugin": "^5.2.1",
"eslint-plugin-mdx": "^2.2.1",
"eslint-plugin-mdx": "^2.3.0",
"eslint-plugin-n": "^16.5.0",
"eslint-plugin-prettier": "link:.",
"eslint-plugin-pug": "^1.2.5",
Expand All @@ -94,6 +94,7 @@
"mocha": "^10.2.0",
"prettier": "^3.1.1",
"prettier-plugin-pkg": "^0.18.0",
"prettier-plugin-svelte": "^3.1.2",
"simple-git-hooks": "^2.9.0",
"svelte": "^4.2.8",
"vue-eslint-parser": "^9.3.2"
Expand Down
31 changes: 22 additions & 9 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 26 additions & 12 deletions test/prettier.js
Expand Up @@ -37,6 +37,21 @@ const eslint = new ESLint({
},
extends: 'plugin:prettier/recommended',
overrides: [
{
// `.prettierignore` will be used by default which is unexpected for these test fixtures
files: 'test/fixtures/**/*',
rules: {
'prettier/prettier': [
'error',
{},
{
fileInfoOptions: {
ignorePath: '.eslintignore',
},
},
],
},
},
{
files: ['*.{md,mdx}'],
extends: 'plugin:mdx/recommended',
Expand Down Expand Up @@ -283,20 +298,25 @@ runFixture('*.mdx', [
],
]);

/**
* @see https://github.com/sveltejs/svelte/blob/226bf419f9b9b5f1a6da33bd6403dd70afe58b52/packages/svelte/package.json#L73
*/
const svelteUnsupported = +process.versions.node.split('.')[0] < 16;

runFixture(
'eslint-plugin-svelte/*.svelte',
[
[
{
column: 5,
column: 1,
endColumn: 11,
endLine: 2,
fix: {
range: [13, 19],
text: 'name',
range: [9, 19],
text: ' let name',
},
line: 2,
message: 'Replace `·name·` with `name`',
message: 'Replace `let··name·` with `··let·name`',
messageId: 'replace',
nodeType: null,
ruleId: 'prettier/prettier',
Expand All @@ -319,16 +339,10 @@ runFixture(
},
],
],
// FIXME: https://github.com/sveltejs/prettier-plugin-svelte/issues/317
true,
svelteUnsupported,
);

runFixture(
'eslint-plugin-svelte3/*.svelte',
[[], []],
// FIXME: https://github.com/sveltejs/prettier-plugin-svelte/issues/317
true,
);
runFixture('eslint-plugin-svelte3/*.svelte', [[], []], svelteUnsupported);

/**
* The `script` code style actually does not match `prettier`'s,
Expand Down

0 comments on commit ddde3ad

Please sign in to comment.