Skip to content

Commit 370e88f

Browse files
authored
chore: bump deps, use pnpm instead (#568)
1 parent 6878434 commit 370e88f

21 files changed

+7079
-10076
lines changed

.changeset/pre.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"mode": "pre",
2+
"mode": "exit",
33
"tag": "alpha",
44
"initialVersions": {
55
"eslint-plugin-prettier": "4.2.2"

.commitlintrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"extends": "@1stg"
2+
"extends": "@commitlint/config-conventional"
33
}

.eslintrc

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"root": true,
3+
"parserOptions": {
4+
"ecmaVersion": "latest",
5+
"sourceType": "module"
6+
},
7+
"env": {
8+
"mocha": true,
9+
"node": true
10+
},
11+
"extends": [
12+
"eslint:recommended",
13+
"plugin:@eslint-community/eslint-comments/recommended",
14+
"plugin:eslint-plugin/recommended",
15+
"plugin:n/recommended",
16+
"plugin:mdx/recommended",
17+
"plugin:prettier/recommended"
18+
],
19+
"rules": {
20+
"eslint-plugin/report-message-format": ["error", "^[^a-z].*\\.$"]
21+
}
22+
}

.eslintrc.json

-39
This file was deleted.

.github/workflows/ci.yml

+7-4
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,24 @@ jobs:
1616
- 14
1717
- 16
1818
- 18
19+
- 20
1920

2021
steps:
2122
- uses: actions/checkout@v3
2223

24+
- uses: pnpm/action-setup@v2
25+
2326
- name: Use Node.js ${{ matrix.node-version }}
2427
uses: actions/setup-node@v3
2528
with:
2629
node-version: ${{ matrix.node-version }}
27-
cache: yarn
30+
cache: pnpm
2831

2932
- name: Install
30-
run: yarn --frozen-lockfile
33+
run: pnpm install
3134

3235
- name: Test
33-
run: yarn mocha
36+
run: pnpm mocha
3437

3538
- name: Perf
36-
run: TIMING=1 yarn lint
39+
run: TIMING=1 pnpm lint

.github/workflows/pkg-size.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ jobs:
1111
runs-on: ubuntu-latest
1212

1313
steps:
14-
- name: Checkout
15-
uses: actions/checkout@v3
14+
- uses: actions/checkout@v3
1615

17-
- name: Setup Node.js
18-
uses: actions/setup-node@v3
16+
- uses: pnpm/action-setup@v2
17+
18+
- uses: actions/setup-node@v3
1919
with:
2020
node-version: 16
21-
cache: yarn
21+
cache: pnpm
2222

2323
- name: Package Size Report
2424
uses: pkg-size/action@v1

.github/workflows/release.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ jobs:
1010
name: Release
1111
runs-on: ubuntu-latest
1212
steps:
13-
- name: Checkout Repo
14-
uses: actions/checkout@v3
13+
- uses: actions/checkout@v3
1514

16-
- name: Setup Node.js 16
17-
uses: actions/setup-node@v3
15+
- uses: pnpm/action-setup@v2
16+
17+
- uses: actions/setup-node@v3
1818
with:
1919
node-version: 16
20-
cache: yarn
20+
cache: pnpm
2121

2222
- name: Install Dependencies
23-
run: yarn --frozen-lockfile
23+
run: pnpm install
2424

2525
- name: Create Release Pull Request or Publish to npm
2626
id: changesets

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
node_modules
22
*.log
33
.*cache
4+
.yarn/*
5+
!.yarn/plugins
6+
!.yarn/releases

.lintstagedrc

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"*.{js,md,ts}": ["eslint --cache -f friendly --fix"],
3+
"*.{json,yml}": ["prettier --write"]
4+
}

.lintstagedrc.js

-1
This file was deleted.

.nvmrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
lts/*
1+
14

.prettierrc

+5-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
"@1stg/prettier-config/semi"
1+
{
2+
"arrowParens": "avoid",
3+
"singleQuote": true,
4+
"plugins": ["prettier-plugin-pkg"]
5+
}

.simple-git-hooks.js

-1
This file was deleted.

.simple-git-hooks.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"pre-commit": "npx lint-staged",
3+
"commit-msg": "npx commitlint -e"
4+
}

CONTRIBUTING.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@ Thanks for contributing!
77
```sh
88
git clone https://github.com/prettier/eslint-plugin-prettier.git
99
cd eslint-plugin-prettier
10-
yarn
10+
pnpm install
1111
```
1212

1313
## Running the tests
1414

1515
```sh
16-
yarn test
16+
pnpm test
1717
```
1818

1919
This is an [ESLint](http://eslint.org) plugin. Documentation for the APIs that it uses can be found on ESLint's [Working with Plugins](http://eslint.org/docs/developer-guide/working-with-plugins) page.
2020

21-
This plugin is used to lint itself. The style is checked when `yarn test` is run, and the build will fail if there are any linting errors. You can use `yarn lint --fix` to fix some linting errors. To run the tests without running the linter, you can use `yarn mocha`.
21+
This plugin is used to lint itself. The style is checked when `pnpm test` is run, and the build will fail if there are any linting errors. You can use `pnpm lint --fix` to fix some linting errors. To run the tests without running the linter, you can use `pnpm mocha`.
2222

2323
## Commit messages
2424

@@ -27,7 +27,7 @@ Please view [commitlint](https://commitlint.js.org) for more details.
2727
## Publishing
2828

2929
```sh
30-
yarn release
30+
pnpm release
3131
```
3232

3333
Please view [changesets](https://github.com/changesets/changesets) and its [action](https://github.com/changesets/action) for more details.

package.json

+34-26
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
],
1111
"funding": "https://opencollective.com/prettier",
1212
"license": "MIT",
13-
"packageManager": "[email protected]",
13+
"packageManager": "[email protected]",
1414
"engines": {
1515
"node": "^14.18.0 || >=16.0.0"
1616
},
@@ -28,12 +28,12 @@
2828
"prettier"
2929
],
3030
"scripts": {
31-
"format": "yarn prettier '**/*.{js,json,md,yml}' --write && yarn lint --fix",
31+
"format": "prettier --write . && pnpm lint --fix",
3232
"lint": "eslint . --cache -f friendly --max-warnings 10",
33-
"prepare": "simple-git-hooks && yarn-deduplicate --strategy fewer || exit 0",
34-
"prerelease": "yarn format && yarn test",
33+
"prepare": "simple-git-hooks",
34+
"prerelease": "pnpm format && pnpm test",
3535
"release": "changeset publish",
36-
"test": "yarn lint && mocha"
36+
"test": "pnpm lint && mocha"
3737
},
3838
"peerDependencies": {
3939
"@types/eslint": ">=8.0.0",
@@ -53,29 +53,37 @@
5353
"synckit": "^0.8.5"
5454
},
5555
"devDependencies": {
56-
"@1stg/common-config": "^7.1.1",
57-
"@changesets/changelog-github": "^0.4.6",
58-
"@changesets/cli": "^2.24.4",
59-
"@graphql-eslint/eslint-plugin": "^3.10.7",
60-
"@types/eslint": "^8.4.6",
61-
"@types/prettier": "^2.7.0",
56+
"@1stg/remark-preset": "^2.0.0",
57+
"@changesets/changelog-github": "^0.4.8",
58+
"@changesets/cli": "^2.26.2",
59+
"@commitlint/config-conventional": "^17.6.6",
60+
"@eslint-community/eslint-plugin-eslint-comments": "^3.2.1",
61+
"@graphql-eslint/eslint-plugin": "^3.20.0",
62+
"@types/eslint": "^8.44.0",
6263
"@types/prettier-linter-helpers": "^1.0.1",
63-
"@typescript-eslint/parser": "^5.36.1",
64-
"eslint-config-prettier": "^8.5.0",
65-
"eslint-mdx": "^2.0.2",
66-
"eslint-plugin-eslint-plugin": "^5.0.6",
67-
"eslint-plugin-mdx": "^2.0.2",
68-
"eslint-plugin-self": "^1.2.1",
69-
"eslint-plugin-svelte": "^2.7.0",
64+
"commitlint": "^17.6.6",
65+
"eslint": "^8.44.0",
66+
"eslint-config-prettier": "^8.8.0",
67+
"eslint-formatter-friendly": "^7.0.0",
68+
"eslint-mdx": "^2.1.0",
69+
"eslint-plugin-eslint-plugin": "^5.1.0",
70+
"eslint-plugin-mdx": "^2.1.0",
71+
"eslint-plugin-n": "^16.0.1",
72+
"eslint-plugin-prettier": "link:.",
73+
"eslint-plugin-svelte": "^2.32.2",
7074
"eslint-plugin-svelte3": "^4.0.0",
71-
"graphql": "^16.6.0",
72-
"mocha": "^10.0.0",
73-
"svelte": "^3.49.0",
74-
"vue-eslint-parser": "^9.0.3",
75-
"yarn-deduplicate": "^6.0.0"
75+
"graphql": "^16.7.1",
76+
"lint-staged": "^13.2.3",
77+
"mocha": "^10.2.0",
78+
"prettier": "^3.0.0",
79+
"prettier-plugin-pkg": "^0.18.0",
80+
"simple-git-hooks": "^2.8.1",
81+
"svelte": "^4.0.5",
82+
"vue-eslint-parser": "^9.3.1"
7683
},
77-
"resolutions": {
78-
"eslint-plugin-prettier": "link:.",
79-
"prettier": "^3.0.0-alpha.0"
84+
"pnpm": {
85+
"patchedDependencies": {
86+
"@graphql-eslint/[email protected]": "patches/@[email protected]"
87+
}
8088
}
8189
}

patches/@[email protected]

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
diff --git a/cjs/documents.js b/cjs/documents.js
2+
index f418f624fec59761e9537d7e0acc43a0bebb843e..0cda9fb8be4888d5a8d8c38a0b82f84b5745edb8 100644
3+
--- a/cjs/documents.js
4+
+++ b/cjs/documents.js
5+
@@ -44,7 +44,7 @@ const handleVirtualPath = (documents) => {
6+
if ([".gql", ".graphql"].some((extension) => location.endsWith(extension))) {
7+
return source;
8+
}
9+
- filepathMap[location] ??= -1;
10+
+ filepathMap[location] = filepathMap[location] != null ? filepathMap[location] : -1;
11+
const index = filepathMap[location] += 1;
12+
return {
13+
...source,
14+
diff --git a/cjs/parser.js b/cjs/parser.js
15+
index 269ecb5e2107d08ac185af6175d921de38fac476..4b9d5a698b515feaf6107f73dbdc14186d507354 100644
16+
--- a/cjs/parser.js
17+
+++ b/cjs/parser.js
18+
@@ -44,7 +44,7 @@ debug("cwd %o", import_utils2.CWD);
19+
function parseForESLint(code, options) {
20+
try {
21+
const { filePath } = options;
22+
- options.documents ||= options.operations;
23+
+ options.documents = options.documents || options.operations;
24+
const { document } = (0, import_utils.parseGraphQLSDL)(filePath, code, {
25+
...options.graphQLParserOptions,
26+
noLocation: false
27+
diff --git a/cjs/rules/graphql-js-validation.js b/cjs/rules/graphql-js-validation.js
28+
index 9130aae0f12847ce0d9cd69c7dae673d80f75de4..168cdf270ba1dfc39e8f5002b76b5242b154f1c5 100644
29+
--- a/cjs/rules/graphql-js-validation.js
30+
+++ b/cjs/rules/graphql-js-validation.js
31+
@@ -49,7 +49,7 @@ function validateDocument({
32+
};
33+
if (token) {
34+
loc = // if cursor on `@` symbol than use next node
35+
- token.type === "@" ? sourceCode.getNodeByRangeIndex(token.range[1] + 1).loc : token.loc;
36+
+ token.type === "@" ? sourceCode.getNodeByRangeIndex(token.range[1] + 1).loc : token.loc;
37+
}
38+
const didYouMeanContent = error.message.match(/Did you mean (?<content>.*)\?$/)?.groups.content;
39+
const matches = didYouMeanContent ? [...didYouMeanContent.matchAll(/"(?<name>[^"]*)"/g)] : [];
40+
@@ -407,7 +407,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
41+
...siblings.getOperations(),
42+
...siblings.getFragments()
43+
].reduce((map, { filePath, document }) => {
44+
- map[filePath] ??= [];
45+
+ map[filePath] = map[filePath] != null ? map[filePath] : [];
46+
map[filePath].push(document);
47+
return map;
48+
}, /* @__PURE__ */ Object.create(null));
49+
diff --git a/cjs/rules/no-one-place-fragments.js b/cjs/rules/no-one-place-fragments.js
50+
index 0f4e2c34a00d4267eef2cf0f6e6e2d5369e4a11f..adbee674fbda8710acad8690dc7c637d8e6f1956 100644
51+
--- a/cjs/rules/no-one-place-fragments.js
52+
+++ b/cjs/rules/no-one-place-fragments.js
53+
@@ -87,7 +87,7 @@ const rule = {
54+
(0, import_graphql.visit)(document, {
55+
FragmentSpread({ name }) {
56+
const spreadName = name.value;
57+
- usedFragmentsMap[spreadName] ||= [];
58+
+ usedFragmentsMap[spreadName] = usedFragmentsMap[spreadName] || [];
59+
usedFragmentsMap[spreadName].push(relativeFilePath);
60+
}
61+
});
62+
diff --git a/cjs/rules/no-unused-fields.js b/cjs/rules/no-unused-fields.js
63+
index dab854e13820dcf4037cc51729354e67fbb3bf90..1f1b1ddd52119bea302e4998bff6a5a316ca0a3d 100644
64+
--- a/cjs/rules/no-unused-fields.js
65+
+++ b/cjs/rules/no-unused-fields.js
66+
@@ -39,7 +39,7 @@ function getUsedFields(schema, operations) {
67+
}
68+
const parentTypeName = typeInfo.getParentType().name;
69+
const fieldName = node.name.value;
70+
- usedFields[parentTypeName] ??= /* @__PURE__ */ new Set();
71+
+ usedFields[parentTypeName] = usedFields[parentTypeName] != null ? usedFields[parentTypeName] : /* @__PURE__ */ new Set();
72+
usedFields[parentTypeName].add(fieldName);
73+
}
74+
});

0 commit comments

Comments
 (0)