Skip to content

Commit 2c68532

Browse files
authored
update bob (#1329)
* update bob * use ts everywhere * add legacy configs * legacy configs * adjust tests * everything works * eslint fixes * fix ci * assert { type: "json" } * fix prebuild * fix alpha release * try new version
1 parent e42e3e9 commit 2c68532

32 files changed

+374
-837
lines changed

.eslintrc.cjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,11 @@ module.exports = {
5858
'@typescript-eslint/no-unused-vars': 'off',
5959
},
6060
},
61+
{
62+
files: ['scripts/**'],
63+
rules: {
64+
'no-console': 'off'
65+
}
66+
}
6167
],
6268
};

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
packageManager: pnpm
3737

3838
- name: Use GraphQL v${{matrix.graphql_version}}
39-
run: node ./scripts/match-graphql.js ${{matrix.graphql_version}}
39+
run: node scripts/match-graphql.js ${{matrix.graphql_version}}
4040

4141
- name: Install Dependencies
4242
run: pnpm i --no-frozen-lockfile

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
strict-peer-dependencies=false
22
shell-emulator=true
3+
enable-pre-post-scripts=true

package.json

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,19 @@
55
"license": "MIT",
66
"private": true,
77
"scripts": {
8-
"build": "pnpm transpile-ts && bob build",
8+
"build": "tsc && bob build",
99
"ci:lint": "eslint --ignore-path .gitignore --ext ts,js . --output-file eslint_report.json --format json",
1010
"create-rule": "tsx scripts/create-rule.ts",
1111
"generate:configs": "tsx scripts/generate-configs.ts",
1212
"generate:docs": "tsx scripts/generate-docs.ts",
1313
"lint": "eslint --ignore-path .gitignore --ext ts,js .",
14-
"postbuild": "cp -r README.md docs ./packages/plugin/dist/",
15-
"postinstall": "node scripts/patch-graphql.js",
16-
"prebuild": "rimraf packages/*/dist ./tsconfig.tsbuildinfo",
14+
"postbuild": "cp -r README.md docs ./packages/plugin/dist/ && tsx scripts/postbuild.ts",
15+
"postinstall": "tsx scripts/patch-graphql.ts",
16+
"prebuild": "rimraf ./tsconfig.tsbuildinfo",
1717
"prerelease": "pnpm build",
1818
"prettier": "prettier --cache --write --list-different .",
1919
"release": "changeset publish",
20-
"test": "vitest .",
21-
"transpile-ts": "tsc --project tsconfig.json"
20+
"test": "vitest ."
2221
},
2322
"devDependencies": {
2423
"@changesets/changelog-github": "0.4.8",
@@ -29,7 +28,7 @@
2928
"@types/node": "18.11.17",
3029
"@typescript-eslint/eslint-plugin": "5.47.0",
3130
"@typescript-eslint/parser": "5.47.0",
32-
"bob-the-bundler": "1.7.3",
31+
"bob-the-bundler": "4.2.0-alpha-20221222123652-a454f30",
3332
"chalk": "^4.1.2",
3433
"dedent": "0.7.0",
3534
"enquirer": "2.3.6",
@@ -49,7 +48,7 @@
4948
"rimraf": "3.0.2",
5049
"tsx": "^3.12.1",
5150
"typescript": "4.9.4",
52-
"vitest": "0.26.1"
51+
"vitest": "0.26.2"
5352
},
5453
"resolutions": {
5554
"graphql": "16.6.0"
@@ -65,7 +64,7 @@
6564
6665
6766
68-
"[email protected].1": "patches/[email protected].1.patch"
67+
"[email protected].2": "patches/[email protected].2.patch"
6968
}
7069
}
7170
}

packages/plugin/package.json

Lines changed: 16 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,32 @@
55
"repository": "https://github.com/B2o5T/graphql-eslint",
66
"author": "Dotan Simha <[email protected]>",
77
"license": "MIT",
8-
"main": "dist/index.js",
9-
"module": "dist/index.mjs",
8+
"main": "dist/cjs/index.js",
9+
"module": "dist/esm/index.js",
1010
"exports": {
1111
"./package.json": "./package.json",
1212
".": {
13-
"require": "./dist/index.js",
14-
"import": "./dist/index.mjs"
15-
},
16-
"./*": {
17-
"require": "./dist/*.js",
18-
"import": "./dist/*.mjs"
13+
"require": {
14+
"types": "./dist/typings/index.d.cts",
15+
"default": "./dist/cjs/index.js"
16+
},
17+
"import": {
18+
"types": "./dist/typings/index.d.ts",
19+
"default": "./dist/esm/index.js"
20+
},
21+
"default": {
22+
"types": "./dist/typings/index.d.ts",
23+
"default": "./dist/esm/index.js"
24+
}
1925
}
2026
},
21-
"typings": "dist/index.d.ts",
27+
"typings": "dist/typings/index.d.ts",
2228
"keywords": [
2329
"eslint",
2430
"eslintplugin",
2531
"eslint-plugin",
2632
"graphql"
2733
],
28-
"scripts": {
29-
"prepack": "bob prepack",
30-
"test": "jest"
31-
},
3234
"peerDependencies": {
3335
"graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"
3436
},
@@ -59,48 +61,7 @@
5961
"access": "public"
6062
},
6163
"sideEffects": false,
62-
"buildOptions": {
63-
"input": "./src/index.ts",
64-
"copy": "./src/configs",
65-
"external": [
66-
"eslint",
67-
"graphql",
68-
"graphql/validation/rules/ExecutableDefinitionsRule",
69-
"graphql/validation/rules/FieldsOnCorrectTypeRule",
70-
"graphql/validation/rules/FragmentsOnCompositeTypesRule",
71-
"graphql/validation/rules/KnownArgumentNamesRule",
72-
"graphql/validation/rules/KnownDirectivesRule",
73-
"graphql/validation/rules/KnownFragmentNamesRule",
74-
"graphql/validation/rules/KnownTypeNamesRule",
75-
"graphql/validation/rules/LoneAnonymousOperationRule",
76-
"graphql/validation/rules/LoneSchemaDefinition",
77-
"graphql/validation/rules/NoFragmentCyclesRule",
78-
"graphql/validation/rules/NoUndefinedVariablesRule",
79-
"graphql/validation/rules/NoUnusedFragmentsRule",
80-
"graphql/validation/rules/NoUnusedVariablesRule",
81-
"graphql/validation/rules/OverlappingFieldsCanBeMergedRule",
82-
"graphql/validation/rules/PossibleFragmentSpreadsRule",
83-
"graphql/validation/rules/PossibleTypeExtensionsRule",
84-
"graphql/validation/rules/ProvidedRequiredArgumentsRule",
85-
"graphql/validation/rules/ScalarLeafsRule",
86-
"graphql/validation/rules/SingleFieldSubscriptionsRule",
87-
"graphql/validation/rules/UniqueArgumentNamesRule",
88-
"graphql/validation/rules/UniqueDirectiveNamesRule",
89-
"graphql/validation/rules/UniqueDirectivesPerLocationRule",
90-
"graphql/validation/rules/UniqueEnumValueNamesRule",
91-
"graphql/validation/rules/UniqueFieldDefinitionNamesRule",
92-
"graphql/validation/rules/UniqueInputFieldNamesRule",
93-
"graphql/validation/rules/UniqueOperationTypesRule",
94-
"graphql/validation/rules/UniqueTypeNamesRule",
95-
"graphql/validation/rules/UniqueVariableNamesRule",
96-
"graphql/validation/rules/ValuesOfCorrectTypeRule",
97-
"graphql/validation/rules/VariablesAreInputTypesRule",
98-
"graphql/validation/rules/VariablesInAllowedPositionRule",
99-
"graphql/language",
100-
"minimatch"
101-
]
102-
},
10364
"typescript": {
104-
"definition": "dist/index.d.ts"
65+
"definition": "dist/typings/index.d.ts"
10566
}
10667
}

packages/plugin/src/configs/base.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

packages/plugin/src/configs/base.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export default {
2+
parser: '@graphql-eslint/eslint-plugin',
3+
plugins: ['@graphql-eslint'],
4+
};

packages/plugin/src/configs/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import schemaRecommendedConfig from './schema-recommended';
2+
import schemaAllConfig from './schema-all';
3+
import operationsRecommendedConfig from './operations-recommended';
4+
import operationsAllConfig from './operations-all';
5+
import relayConfig from './relay';
6+
7+
export const configs = {
8+
'schema-recommended': schemaRecommendedConfig,
9+
'schema-all': schemaAllConfig,
10+
'operations-recommended': operationsRecommendedConfig,
11+
'operations-all': operationsAllConfig,
12+
relay: relayConfig,
13+
};

packages/plugin/src/configs/operations-all.json

Lines changed: 0 additions & 25 deletions
This file was deleted.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* 🚨 IMPORTANT! Do not manually modify this file. Run: `yarn generate-configs`
3+
*/
4+
5+
export default {
6+
extends: ['./configs/base', './configs/operations-recommended'],
7+
rules: {
8+
'@graphql-eslint/alphabetize': [
9+
'error',
10+
{
11+
selections: ['OperationDefinition', 'FragmentDefinition'],
12+
variables: ['OperationDefinition'],
13+
arguments: ['Field', 'Directive'],
14+
},
15+
],
16+
'@graphql-eslint/lone-executable-definition': 'error',
17+
'@graphql-eslint/match-document-filename': [
18+
'error',
19+
{
20+
query: 'kebab-case',
21+
mutation: 'kebab-case',
22+
subscription: 'kebab-case',
23+
fragment: 'kebab-case',
24+
},
25+
],
26+
'@graphql-eslint/unique-fragment-name': 'error',
27+
'@graphql-eslint/unique-operation-name': 'error',
28+
},
29+
};

0 commit comments

Comments
 (0)