Skip to content

Commit

Permalink
chore: typecheck everything
Browse files Browse the repository at this point in the history
  • Loading branch information
enisdenjo committed Dec 23, 2022
1 parent 5d7f0e7 commit 83e89bc
Show file tree
Hide file tree
Showing 17 changed files with 109 additions and 67 deletions.
6 changes: 5 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
module.exports = {
/**
* @type {import('eslint').Linter.Config}
*/
const opts = {
env: {
es2020: true,
node: true,
Expand All @@ -22,3 +25,4 @@ module.exports = {
],
},
};
module.exports = opts;
8 changes: 6 additions & 2 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
module.exports = {
/**
* @type {import('@babel/core').TransformOptions}
*/
const opts = {
presets: [
['@babel/preset-env', { targets: { node: 'current' } }],
['@babel/env', { targets: { node: 'current' } }],
'@babel/typescript',
],
plugins: [
Expand All @@ -10,3 +13,4 @@ module.exports = {
'@babel/proposal-optional-chaining',
],
};
module.exports = opts;
2 changes: 0 additions & 2 deletions implementations/apollo-server/index.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// @ts-check

import { GraphQLSchema, GraphQLString, GraphQLObjectType } from 'graphql';
import { ApolloServer } from '@apollo/server';
import { startStandaloneServer } from '@apollo/server/standalone';
Expand Down
2 changes: 0 additions & 2 deletions implementations/express-graphql/index.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// @ts-check

import { GraphQLSchema, GraphQLString, GraphQLObjectType } from 'graphql';
import express from 'express';
import { graphqlHTTP } from 'express-graphql';
Expand Down
2 changes: 0 additions & 2 deletions implementations/graphql-helix/index.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// @ts-check

import { GraphQLSchema, GraphQLString, GraphQLObjectType } from 'graphql';
import {
getGraphQLParameters,
Expand Down
2 changes: 0 additions & 2 deletions implementations/graphql-yoga/index.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// @ts-check

import { GraphQLSchema, GraphQLString, GraphQLObjectType } from 'graphql';
import { createYoga } from 'graphql-yoga';
import { createServer } from 'http';
Expand Down
2 changes: 0 additions & 2 deletions implementations/mercurius/index.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// @ts-check

import { GraphQLSchema, GraphQLString, GraphQLObjectType } from 'graphql';
import Fastify from 'fastify';
import mercurius from 'mercurius';
Expand Down
8 changes: 6 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
module.exports = {
/**
* @type {import('jest').Config}
*/
const opts = {
testEnvironment: 'node',
moduleFileExtensions: ['js', 'ts'],
moduleFileExtensions: ['ts', 'js'],
extensionsToTreatAsEsm: ['.ts'],
testPathIgnorePatterns: ['/node_modules/', '/fixtures/', '/utils/'],
};
module.exports = opts;
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"test": "NODE_OPTIONS=--experimental-vm-modules jest",
"build:esm": "tsc -b tsconfig.esm.json && node scripts/esm-post-process.mjs",
"build:cjs": "tsc -b tsconfig.cjs.json",
"build:umd": "rollup -c && gzip umd/graphql-http.min.js -c > umd/graphql-http.min.js.gz",
"build:umd": "rollup --bundleConfigAsCjs --config rollup.config.ts --configPlugin typescript && gzip umd/graphql-http.min.js -c > umd/graphql-http.min.js.gz",
"build": "yarn build:esm && yarn build:cjs && yarn build:umd",
"release": "semantic-release"
},
Expand All @@ -95,10 +95,13 @@
"@babel/plugin-proposal-optional-chaining": "^7.18.9",
"@babel/preset-env": "^7.20.2",
"@babel/preset-typescript": "^7.18.6",
"@rollup/plugin-terser": "^0.2.1",
"@rollup/plugin-typescript": "^9.0.2",
"@semantic-release/changelog": "^6.0.1",
"@semantic-release/git": "^10.0.1",
"@types/eslint": "^8.4.10",
"@types/express": "^4.17.14",
"@types/glob": "^8.0.0",
"@types/jest": "^29.2.2",
"@typescript-eslint/eslint-plugin": "^5.42.1",
"@typescript-eslint/parser": "^5.42.1",
Expand All @@ -115,7 +118,6 @@
"node-fetch": "^3.2.10",
"prettier": "^2.7.1",
"rollup": "^3.2.5",
"rollup-plugin-terser": "^7.0.2",
"semantic-release": "^19.0.5",
"tslib": "^2.4.1",
"typedoc": "^0.23.20",
Expand Down
2 changes: 1 addition & 1 deletion rollup.config.mjs → rollup.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import typescript from '@rollup/plugin-typescript';
import { terser } from 'rollup-plugin-terser';
import terser from '@rollup/plugin-terser';

export default {
input: './src/client.ts',
Expand Down
2 changes: 0 additions & 2 deletions scripts/audit-implementation.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// @ts-check

/**
*
* Tests a running local server for GraphQL over HTTP compliance.
Expand Down
2 changes: 0 additions & 2 deletions scripts/esm-post-process.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// @ts-check

import fs from 'fs/promises';
import path from 'path';
import glob from 'glob';
Expand Down
4 changes: 3 additions & 1 deletion tsconfig.cjs.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"rootDir": "./src",
"outDir": "./lib",
"declaration": false // already built by `tsconfig.esm.json`
},
"exclude": ["src/__tests__", "lib"]
"include": ["src"],
"exclude": ["src/__tests__"]
}
4 changes: 3 additions & 1 deletion tsconfig.esm.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "es2015",
"rootDir": "./src",
"outDir": "./lib",
"declaration": true
},
"exclude": ["src/__tests__", "lib"]
"include": ["src"],
"exclude": ["src/__tests__"]
}
15 changes: 11 additions & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
{
"compilerOptions": {
/* Visit https://aka.ms/tsconfig.json to read more about this file */
"moduleResolution": "node",
"target": "es2017",
"rootDir": "./src",
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"useUnknownInCatchVariables": false
"useUnknownInCatchVariables": false,
"checkJs": true
},
"exclude": ["lib"]
"include": [
"src",
"scripts",
"rollup.config.ts",
"babel.config.js",
"jest.config.js",
".eslintrc.js",
"typedoc.js"
]
}
8 changes: 6 additions & 2 deletions typedoc.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
module.exports = {
/**
* @type {Partial<import('typedoc').TypeDocOptions>}
*/
const opts = {
entryPointStrategy: 'expand',
out: './docs',
readme: 'none',
plugin: 'typedoc-plugin-markdown',
plugin: ['typedoc-plugin-markdown'],
excludeExternals: true,
excludePrivate: true,
disableSources: true,
categorizeByGroup: false, // removes redundant category names in matching modules
githubPages: false,
exclude: ['**/index.ts', '**/utils.ts', '**/__tests__/**/*'],
};
module.exports = opts;
101 changes: 64 additions & 37 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ __metadata:
languageName: node
linkType: hard

"@babel/code-frame@npm:^7.0.0, @babel/code-frame@npm:^7.10.4, @babel/code-frame@npm:^7.12.13, @babel/code-frame@npm:^7.18.6":
"@babel/code-frame@npm:^7.0.0, @babel/code-frame@npm:^7.12.13, @babel/code-frame@npm:^7.18.6":
version: 7.18.6
resolution: "@babel/code-frame@npm:7.18.6"
dependencies:
Expand Down Expand Up @@ -3571,6 +3571,22 @@ __metadata:
languageName: node
linkType: hard

"@rollup/plugin-terser@npm:^0.2.1":
version: 0.2.1
resolution: "@rollup/plugin-terser@npm:0.2.1"
dependencies:
serialize-javascript: ^6.0.0
smob: ^0.0.6
terser: ^5.15.1
peerDependencies:
rollup: ^2.x || ^3.x
peerDependenciesMeta:
rollup:
optional: true
checksum: 86a5370d111455083907529eacf810e322032f20b756745ce8b0cbb70b0cbd564b7452dc835aa7ece6a9bbc9ac36de4781f7d2c2bb4786f4161100e19826b927
languageName: node
linkType: hard

"@rollup/plugin-typescript@npm:^9.0.2":
version: 9.0.2
resolution: "@rollup/plugin-typescript@npm:9.0.2"
Expand Down Expand Up @@ -3851,7 +3867,17 @@ __metadata:
languageName: node
linkType: hard

"@types/estree@npm:^1.0.0":
"@types/eslint@npm:^8.4.10":
version: 8.4.10
resolution: "@types/eslint@npm:8.4.10"
dependencies:
"@types/estree": "*"
"@types/json-schema": "*"
checksum: 21e009ed9ed9bc8920fdafc6e11ff321c4538b4cc18a56fdd59dc5184ea7bbf363c71638c9bdb59fc1254dddcdd567485136ed68b0ee4750948d4e32cb79c689
languageName: node
linkType: hard

"@types/estree@npm:*, @types/estree@npm:^1.0.0":
version: 1.0.0
resolution: "@types/estree@npm:1.0.0"
checksum: 910d97fb7092c6738d30a7430ae4786a38542023c6302b95d46f49420b797f21619cdde11fa92b338366268795884111c2eb10356e4bd2c8ad5b92941e9e6443
Expand Down Expand Up @@ -3881,6 +3907,16 @@ __metadata:
languageName: node
linkType: hard

"@types/glob@npm:^8.0.0":
version: 8.0.0
resolution: "@types/glob@npm:8.0.0"
dependencies:
"@types/minimatch": "*"
"@types/node": "*"
checksum: 1817b05f5a8aed851d102a65b5e926d5c777bef927ea62b36d635860eef5364f2046bb5a692d135b6f2b28f34e4a9d44ade9396122c0845bcc7636d35f624747
languageName: node
linkType: hard

"@types/graceful-fs@npm:^4.1.3":
version: 4.1.5
resolution: "@types/graceful-fs@npm:4.1.5"
Expand Down Expand Up @@ -3925,7 +3961,7 @@ __metadata:
languageName: node
linkType: hard

"@types/json-schema@npm:^7.0.9":
"@types/json-schema@npm:*, @types/json-schema@npm:^7.0.9":
version: 7.0.11
resolution: "@types/json-schema@npm:7.0.11"
checksum: 527bddfe62db9012fccd7627794bd4c71beb77601861055d87e3ee464f2217c85fca7a4b56ae677478367bbd248dbde13553312b7d4dbc702a2f2bbf60c4018d
Expand All @@ -3946,6 +3982,13 @@ __metadata:
languageName: node
linkType: hard

"@types/minimatch@npm:*":
version: 5.1.2
resolution: "@types/minimatch@npm:5.1.2"
checksum: 0391a282860c7cb6fe262c12b99564732401bdaa5e395bee9ca323c312c1a0f45efbf34dce974682036e857db59a5c9b1da522f3d6055aeead7097264c8705a8
languageName: node
linkType: hard

"@types/minimist@npm:^1.2.0":
version: 1.2.2
resolution: "@types/minimist@npm:1.2.2"
Expand Down Expand Up @@ -6921,10 +6964,13 @@ __metadata:
"@babel/plugin-proposal-optional-chaining": ^7.18.9
"@babel/preset-env": ^7.20.2
"@babel/preset-typescript": ^7.18.6
"@rollup/plugin-terser": ^0.2.1
"@rollup/plugin-typescript": ^9.0.2
"@semantic-release/changelog": ^6.0.1
"@semantic-release/git": ^10.0.1
"@types/eslint": ^8.4.10
"@types/express": ^4.17.14
"@types/glob": ^8.0.0
"@types/jest": ^29.2.2
"@typescript-eslint/eslint-plugin": ^5.42.1
"@typescript-eslint/parser": ^5.42.1
Expand All @@ -6941,7 +6987,6 @@ __metadata:
node-fetch: ^3.2.10
prettier: ^2.7.1
rollup: ^3.2.5
rollup-plugin-terser: ^7.0.2
semantic-release: ^19.0.5
tslib: ^2.4.1
typedoc: ^0.23.20
Expand Down Expand Up @@ -8177,17 +8222,6 @@ __metadata:
languageName: node
linkType: hard

"jest-worker@npm:^26.2.1":
version: 26.6.2
resolution: "jest-worker@npm:26.6.2"
dependencies:
"@types/node": "*"
merge-stream: ^2.0.0
supports-color: ^7.0.0
checksum: f9afa3b88e3f12027901e4964ba3ff048285b5783b5225cab28fac25b4058cea8ad54001e9a1577ee2bed125fac3ccf5c80dc507b120300cc1bbcb368796533e
languageName: node
linkType: hard

"jest-worker@npm:^29.3.0":
version: 29.3.0
resolution: "jest-worker@npm:29.3.0"
Expand Down Expand Up @@ -10828,20 +10862,6 @@ __metadata:
languageName: node
linkType: hard

"rollup-plugin-terser@npm:^7.0.2":
version: 7.0.2
resolution: "rollup-plugin-terser@npm:7.0.2"
dependencies:
"@babel/code-frame": ^7.10.4
jest-worker: ^26.2.1
serialize-javascript: ^4.0.0
terser: ^5.0.0
peerDependencies:
rollup: ^2.0.0
checksum: af84bb7a7a894cd00852b6486528dfb8653cf94df4c126f95f389a346f401d054b08c46bee519a2ab6a22b33804d1d6ac6d8c90b1b2bf8fffb097eed73fc3c72
languageName: node
linkType: hard

"rollup@npm:^3.2.5":
version: 3.2.5
resolution: "rollup@npm:3.2.5"
Expand Down Expand Up @@ -11024,12 +11044,12 @@ __metadata:
languageName: node
linkType: hard

"serialize-javascript@npm:^4.0.0":
version: 4.0.0
resolution: "serialize-javascript@npm:4.0.0"
"serialize-javascript@npm:^6.0.0":
version: 6.0.0
resolution: "serialize-javascript@npm:6.0.0"
dependencies:
randombytes: ^2.1.0
checksum: 3273b3394b951671fcf388726e9577021870dfbf85e742a1183fb2e91273e6101bdccea81ff230724f6659a7ee4cef924b0ff9baca32b79d9384ec37caf07302
checksum: 56f90b562a1bdc92e55afb3e657c6397c01a902c588c0fe3d4c490efdcc97dcd2a3074ba12df9e94630f33a5ce5b76a74784a7041294628a6f4306e0ec84bf93
languageName: node
linkType: hard

Expand Down Expand Up @@ -11178,6 +11198,13 @@ __metadata:
languageName: node
linkType: hard

"smob@npm:^0.0.6":
version: 0.0.6
resolution: "smob@npm:0.0.6"
checksum: 360b8b72896974411ec6ca9a352b306bd4233aea44309dbebaeb41fc822cf770b094589e42a8a025ae291f043cbfc4199fc01dd909e45c7bd3c23d287c7e5bac
languageName: node
linkType: hard

"snake-case@npm:^3.0.4":
version: 3.0.4
resolution: "snake-case@npm:3.0.4"
Expand Down Expand Up @@ -11571,17 +11598,17 @@ __metadata:
languageName: node
linkType: hard

"terser@npm:^5.0.0":
version: 5.15.1
resolution: "terser@npm:5.15.1"
"terser@npm:^5.15.1":
version: 5.16.1
resolution: "terser@npm:5.16.1"
dependencies:
"@jridgewell/source-map": ^0.3.2
acorn: ^8.5.0
commander: ^2.20.0
source-map-support: ~0.5.20
bin:
terser: bin/terser
checksum: 9880a1e0956983a1ce5de204ea35121c0009fa41d582a6904ae850e1953a1a2cc021168439565280c5a8eee67c85a874175627e24989b046c7a72589b81c3979
checksum: cb524123504a2f0d9140c1e1a8628c83bba9cacc404c6aca79e2493a38dfdf21275617ba75b91006b3f1ff586e401ab31121160cd253699f334c6340ea2756f5
languageName: node
linkType: hard

Expand Down

0 comments on commit 83e89bc

Please sign in to comment.