Skip to content

Commit

Permalink
chore: bump deps, use pnpm instead (#568)
Browse files Browse the repository at this point in the history
  • Loading branch information
JounQin authored Jul 11, 2023
1 parent 6878434 commit 370e88f
Show file tree
Hide file tree
Showing 21 changed files with 7,079 additions and 10,076 deletions.
2 changes: 1 addition & 1 deletion .changeset/pre.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"mode": "pre",
"mode": "exit",
"tag": "alpha",
"initialVersions": {
"eslint-plugin-prettier": "4.2.2"
Expand Down
2 changes: 1 addition & 1 deletion .commitlintrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"extends": "@1stg"
"extends": "@commitlint/config-conventional"
}
22 changes: 22 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"root": true,
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"env": {
"mocha": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:@eslint-community/eslint-comments/recommended",
"plugin:eslint-plugin/recommended",
"plugin:n/recommended",
"plugin:mdx/recommended",
"plugin:prettier/recommended"
],
"rules": {
"eslint-plugin/report-message-format": ["error", "^[^a-z].*\\.$"]
}
}
39 changes: 0 additions & 39 deletions .eslintrc.json

This file was deleted.

11 changes: 7 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,24 @@ jobs:
- 14
- 16
- 18
- 20

steps:
- uses: actions/checkout@v3

- uses: pnpm/action-setup@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: yarn
cache: pnpm

- name: Install
run: yarn --frozen-lockfile
run: pnpm install

- name: Test
run: yarn mocha
run: pnpm mocha

- name: Perf
run: TIMING=1 yarn lint
run: TIMING=1 pnpm lint
10 changes: 5 additions & 5 deletions .github/workflows/pkg-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
- uses: pnpm/action-setup@v2

- uses: actions/setup-node@v3
with:
node-version: 16
cache: yarn
cache: pnpm

- name: Package Size Report
uses: pkg-size/action@v1
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ jobs:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- uses: actions/checkout@v3

- name: Setup Node.js 16
uses: actions/setup-node@v3
- uses: pnpm/action-setup@v2

- uses: actions/setup-node@v3
with:
node-version: 16
cache: yarn
cache: pnpm

- name: Install Dependencies
run: yarn --frozen-lockfile
run: pnpm install

- name: Create Release Pull Request or Publish to npm
id: changesets
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
node_modules
*.log
.*cache
.yarn/*
!.yarn/plugins
!.yarn/releases
4 changes: 4 additions & 0 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"*.{js,md,ts}": ["eslint --cache -f friendly --fix"],
"*.{json,yml}": ["prettier --write"]
}
1 change: 0 additions & 1 deletion .lintstagedrc.js

This file was deleted.

2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
lts/*
14
6 changes: 5 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
"@1stg/prettier-config/semi"
{
"arrowParens": "avoid",
"singleQuote": true,
"plugins": ["prettier-plugin-pkg"]
}
1 change: 0 additions & 1 deletion .simple-git-hooks.js

This file was deleted.

4 changes: 4 additions & 0 deletions .simple-git-hooks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"pre-commit": "npx lint-staged",
"commit-msg": "npx commitlint -e"
}
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ Thanks for contributing!
```sh
git clone https://github.com/prettier/eslint-plugin-prettier.git
cd eslint-plugin-prettier
yarn
pnpm install
```

## Running the tests

```sh
yarn test
pnpm test
```

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.

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`.
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`.

## Commit messages

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

```sh
yarn release
pnpm release
```

Please view [changesets](https://github.com/changesets/changesets) and its [action](https://github.com/changesets/action) for more details.
60 changes: 34 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
],
"funding": "https://opencollective.com/prettier",
"license": "MIT",
"packageManager": "yarn@1.22.19",
"packageManager": "pnpm@7.33.3",
"engines": {
"node": "^14.18.0 || >=16.0.0"
},
Expand All @@ -28,12 +28,12 @@
"prettier"
],
"scripts": {
"format": "yarn prettier '**/*.{js,json,md,yml}' --write && yarn lint --fix",
"format": "prettier --write . && pnpm lint --fix",
"lint": "eslint . --cache -f friendly --max-warnings 10",
"prepare": "simple-git-hooks && yarn-deduplicate --strategy fewer || exit 0",
"prerelease": "yarn format && yarn test",
"prepare": "simple-git-hooks",
"prerelease": "pnpm format && pnpm test",
"release": "changeset publish",
"test": "yarn lint && mocha"
"test": "pnpm lint && mocha"
},
"peerDependencies": {
"@types/eslint": ">=8.0.0",
Expand All @@ -53,29 +53,37 @@
"synckit": "^0.8.5"
},
"devDependencies": {
"@1stg/common-config": "^7.1.1",
"@changesets/changelog-github": "^0.4.6",
"@changesets/cli": "^2.24.4",
"@graphql-eslint/eslint-plugin": "^3.10.7",
"@types/eslint": "^8.4.6",
"@types/prettier": "^2.7.0",
"@1stg/remark-preset": "^2.0.0",
"@changesets/changelog-github": "^0.4.8",
"@changesets/cli": "^2.26.2",
"@commitlint/config-conventional": "^17.6.6",
"@eslint-community/eslint-plugin-eslint-comments": "^3.2.1",
"@graphql-eslint/eslint-plugin": "^3.20.0",
"@types/eslint": "^8.44.0",
"@types/prettier-linter-helpers": "^1.0.1",
"@typescript-eslint/parser": "^5.36.1",
"eslint-config-prettier": "^8.5.0",
"eslint-mdx": "^2.0.2",
"eslint-plugin-eslint-plugin": "^5.0.6",
"eslint-plugin-mdx": "^2.0.2",
"eslint-plugin-self": "^1.2.1",
"eslint-plugin-svelte": "^2.7.0",
"commitlint": "^17.6.6",
"eslint": "^8.44.0",
"eslint-config-prettier": "^8.8.0",
"eslint-formatter-friendly": "^7.0.0",
"eslint-mdx": "^2.1.0",
"eslint-plugin-eslint-plugin": "^5.1.0",
"eslint-plugin-mdx": "^2.1.0",
"eslint-plugin-n": "^16.0.1",
"eslint-plugin-prettier": "link:.",
"eslint-plugin-svelte": "^2.32.2",
"eslint-plugin-svelte3": "^4.0.0",
"graphql": "^16.6.0",
"mocha": "^10.0.0",
"svelte": "^3.49.0",
"vue-eslint-parser": "^9.0.3",
"yarn-deduplicate": "^6.0.0"
"graphql": "^16.7.1",
"lint-staged": "^13.2.3",
"mocha": "^10.2.0",
"prettier": "^3.0.0",
"prettier-plugin-pkg": "^0.18.0",
"simple-git-hooks": "^2.8.1",
"svelte": "^4.0.5",
"vue-eslint-parser": "^9.3.1"
},
"resolutions": {
"eslint-plugin-prettier": "link:.",
"prettier": "^3.0.0-alpha.0"
"pnpm": {
"patchedDependencies": {
"@graphql-eslint/eslint-plugin@3.20.0": "patches/@graphql-eslint__eslint-plugin@3.20.0.patch"
}
}
}
74 changes: 74 additions & 0 deletions patches/@graphql-eslint__eslint-plugin@3.20.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
diff --git a/cjs/documents.js b/cjs/documents.js
index f418f624fec59761e9537d7e0acc43a0bebb843e..0cda9fb8be4888d5a8d8c38a0b82f84b5745edb8 100644
--- a/cjs/documents.js
+++ b/cjs/documents.js
@@ -44,7 +44,7 @@ const handleVirtualPath = (documents) => {
if ([".gql", ".graphql"].some((extension) => location.endsWith(extension))) {
return source;
}
- filepathMap[location] ??= -1;
+ filepathMap[location] = filepathMap[location] != null ? filepathMap[location] : -1;
const index = filepathMap[location] += 1;
return {
...source,
diff --git a/cjs/parser.js b/cjs/parser.js
index 269ecb5e2107d08ac185af6175d921de38fac476..4b9d5a698b515feaf6107f73dbdc14186d507354 100644
--- a/cjs/parser.js
+++ b/cjs/parser.js
@@ -44,7 +44,7 @@ debug("cwd %o", import_utils2.CWD);
function parseForESLint(code, options) {
try {
const { filePath } = options;
- options.documents ||= options.operations;
+ options.documents = options.documents || options.operations;
const { document } = (0, import_utils.parseGraphQLSDL)(filePath, code, {
...options.graphQLParserOptions,
noLocation: false
diff --git a/cjs/rules/graphql-js-validation.js b/cjs/rules/graphql-js-validation.js
index 9130aae0f12847ce0d9cd69c7dae673d80f75de4..168cdf270ba1dfc39e8f5002b76b5242b154f1c5 100644
--- a/cjs/rules/graphql-js-validation.js
+++ b/cjs/rules/graphql-js-validation.js
@@ -49,7 +49,7 @@ function validateDocument({
};
if (token) {
loc = // if cursor on `@` symbol than use next node
- token.type === "@" ? sourceCode.getNodeByRangeIndex(token.range[1] + 1).loc : token.loc;
+ token.type === "@" ? sourceCode.getNodeByRangeIndex(token.range[1] + 1).loc : token.loc;
}
const didYouMeanContent = error.message.match(/Did you mean (?<content>.*)\?$/)?.groups.content;
const matches = didYouMeanContent ? [...didYouMeanContent.matchAll(/"(?<name>[^"]*)"/g)] : [];
@@ -407,7 +407,7 @@ const GRAPHQL_JS_VALIDATIONS = Object.assign(
...siblings.getOperations(),
...siblings.getFragments()
].reduce((map, { filePath, document }) => {
- map[filePath] ??= [];
+ map[filePath] = map[filePath] != null ? map[filePath] : [];
map[filePath].push(document);
return map;
}, /* @__PURE__ */ Object.create(null));
diff --git a/cjs/rules/no-one-place-fragments.js b/cjs/rules/no-one-place-fragments.js
index 0f4e2c34a00d4267eef2cf0f6e6e2d5369e4a11f..adbee674fbda8710acad8690dc7c637d8e6f1956 100644
--- a/cjs/rules/no-one-place-fragments.js
+++ b/cjs/rules/no-one-place-fragments.js
@@ -87,7 +87,7 @@ const rule = {
(0, import_graphql.visit)(document, {
FragmentSpread({ name }) {
const spreadName = name.value;
- usedFragmentsMap[spreadName] ||= [];
+ usedFragmentsMap[spreadName] = usedFragmentsMap[spreadName] || [];
usedFragmentsMap[spreadName].push(relativeFilePath);
}
});
diff --git a/cjs/rules/no-unused-fields.js b/cjs/rules/no-unused-fields.js
index dab854e13820dcf4037cc51729354e67fbb3bf90..1f1b1ddd52119bea302e4998bff6a5a316ca0a3d 100644
--- a/cjs/rules/no-unused-fields.js
+++ b/cjs/rules/no-unused-fields.js
@@ -39,7 +39,7 @@ function getUsedFields(schema, operations) {
}
const parentTypeName = typeInfo.getParentType().name;
const fieldName = node.name.value;
- usedFields[parentTypeName] ??= /* @__PURE__ */ new Set();
+ usedFields[parentTypeName] = usedFields[parentTypeName] != null ? usedFields[parentTypeName] : /* @__PURE__ */ new Set();
usedFields[parentTypeName].add(fieldName);
}
});
Loading

0 comments on commit 370e88f

Please sign in to comment.