Skip to content

Commit

Permalink
Spell-checking with cspell (#5989)
Browse files Browse the repository at this point in the history
This commit adds CI using the cspell spell-checker. This is the
command-line form of the VSCode Code Spell Checker extension, which is
now "recommended" if you use this repository. This extension understands
camel-casing in code and has some helpful built-in dictionaries. It is
configured in cspell.yaml; I've set up some nice tweaks like "ignore
things that look like GitHub usernames in CHANGELOG.md".

We have our own dictionary at `cspell-dict.txt` that you can add words
to (either by hand or via the "add word to dictionary" quick fix if
using the extension).  You can also use things like cSpell:ignore,
cSpell:disable-next-line, and cSpell:disable to customize its behavior
on a single file or line if that's helpful.

This commit also fixes a whole bunch of existing spelling errors.  When
easy I've chosen to regard runningwordstogether as a typo to be fixed
rather than as a pattern to allow (the spell checker is fine with
runningWordsTogether).

Like Prettier, we don't run the spell-checker on generated files. To
make configuring this simpler I've moved the output of
graphql-code-generator to a `generated` file just like the protobuf
generated files.
  • Loading branch information
glasser authored Jan 6, 2022
1 parent dad2cdd commit 0d000e0
Show file tree
Hide file tree
Showing 45 changed files with 3,163 additions and 947 deletions.
8 changes: 8 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ jobs:
- common_node_steps
- run: npm run prettier-check

Spell check:
docker:
- image: cimg/node:16.10.0
steps:
- common_node_steps
- run: npm run spell-check

# We make CI fail if any file contains FIX and ME right next to each other.
# This means that when working on a big PR, you can throw in notes that you
# are forced to come back to before merging the PR. Note that we don't block
Expand Down Expand Up @@ -137,6 +144,7 @@ workflows:
<<: *common_non_publish_filters
- "Check for FIXM\x45"
- Prettier
- Spell check
- oss/lerna_tarballs:
name: Package tarballs
<<: *common_non_publish_filters
Expand Down
3 changes: 1 addition & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ dist/
docs/.cache/

# Don't format generated files!
packages/apollo-reporting-protobuf/generated/
packages/apollo-server-core/src/plugin/schemaReporting/operations.d.ts
**/generated/**
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["streetsidesoftware.code-spell-checker"]
}
16 changes: 8 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ The version headers in this history reflect the versions of Apollo Server itself

## v3.1.2

- `apollo-server-core`: Update versions of `@graphql-tools/schema` and `@graphql-tools/utils` from v7 to v8. While there is no change in behavior in these versions, a recently-released version of `@graphql-tools/mock` depends on them, and so without this change, you tpyically end up with two copies of them installed.
- `apollo-server-core`: Update versions of `@graphql-tools/schema` and `@graphql-tools/utils` from v7 to v8. While there is no change in behavior in these versions, a recently-released version of `@graphql-tools/mock` depends on them, and so without this change, you typically end up with two copies of them installed.

## v3.1.1

Expand Down Expand Up @@ -363,7 +363,7 @@ Certain undersupported and underused Apollo Server features have been removed in
## v2.16.0
- `apollo-server-fastify`: Pass Fastify's `request` and `reply` objects into the `context` function, which previously had been receiving nothing. [Issue #3156](https://github.com/apollographql/apollo-server/issues/3156) [PR #3895(https://github.com/apollographql/apollo-server/pull/3895)
- `apollo-server-lamdbda`: Automatically decode payloads which are Base64-encoded when the `isBase64Encoded` boolean is present on Lambda `event` payloads. [PR #4311](https://github.com/apollographql/apollo-server/pull/4311)
- `apollo-server-lambda`: Automatically decode payloads which are Base64-encoded when the `isBase64Encoded` boolean is present on Lambda `event` payloads. [PR #4311](https://github.com/apollographql/apollo-server/pull/4311)
## v2.15.1
Expand Down Expand Up @@ -811,7 +811,7 @@ Certain undersupported and underused Apollo Server features have been removed in
## v2.3.2

- Switch from `json-stable-stringify` to `fast-json-stable-stringify`. [PR #2065](https://github.com/apollographql/apollo-server/pull/2065)
- Fix cache hints of `maxAge: 0` to mean "uncachable". [#2197](https://github.com/apollographql/apollo-server/pull/2197)
- Fix cache hints of `maxAge: 0` to mean "uncacheable". [#2197](https://github.com/apollographql/apollo-server/pull/2197)
- Apply `defaultMaxAge` to scalar fields on the root object. [#2210](https://github.com/apollographql/apollo-server/pull/2210)
- Don't write to the persisted query cache until execution will begin. [PR #2227](https://github.com/apollographql/apollo-server/pull/2227)

Expand Down Expand Up @@ -1024,7 +1024,7 @@ Data sources
## v2.0.0-beta.3

- remove registerServer configuration from `apollo-server`'s listen ([#1090](https://github.com/apollographql/apollo-server/pull/1090))
- move healthcheck into variants ([#1086](https://github.com/apollographql/apollo-server/pull/1086))
- move health check into variants ([#1086](https://github.com/apollographql/apollo-server/pull/1086))
- Add file uploads, **breaking** requires removing `scalar Upload` from the typeDefs ([#1071](https://github.com/apollographql/apollo-server/pull/1071))
- Add reporting to Engine as apollo-engine-reporting ([#1105](https://github.com/apollographql/apollo-server/pull/1105))
- Allow users to define extensions ([#1105](https://github.com/apollographql/apollo-server/pull/1105))
Expand All @@ -1049,7 +1049,7 @@ ListenOptions:
- add hapi 16 next() invocation [PR #743](https://github.com/apollographql/apollo-server/pull/743)
- Add skipValidation option [PR #839](https://github.com/apollographql/apollo-server/pull/839)
- `apollo-server-module-graphiql`: adds an option to the constructor to disable url rewriting when editing a query [PR #1047](https://github.com/apollographql/apollo-server/pull/1047)
- Upgrade `subscription-transport-ws` to 0.9.9 for Graphiql
- Upgrade `subscription-transport-ws` to 0.9.9 for GraphiQL

## v1.3.6

Expand All @@ -1060,7 +1060,7 @@ ListenOptions:
- `apollo-server-adonis`: The `Content-type` of an operation response will now be correctly set to `application/json`. [PR #842](https://github.com/apollographql/apollo-server/pull/842) [PR #910](https://github.com/apollographql/apollo-server/pull/910)
- `apollo-server-azure-functions`: Fix non-functional Azure Functions implementation and update examples in Azure Functions' `README.md`. [PR #753](https://github.com/apollographql/apollo-server/pull/753) [Issue #684](https://github.com/apollographql/apollo-server/issues/684)
- Fix `TypeError` on GET requests with missing `query` parameter. [PR #964](https://github.com/apollographql/apollo-server/pull/964)
- The typing on the context of `GraphQLServerOptions` now matches the equivilent type used by `graphql-tools`. [PR #919](https://github.com/apollographql/apollo-server/pull/919)
- The typing on the context of `GraphQLServerOptions` now matches the equivalent type used by `graphql-tools`. [PR #919](https://github.com/apollographql/apollo-server/pull/919)
- Middleware handlers now used named (rather than anonymous) functions to enable easier identification during debugging/profiling. [PR #827](https://github.com/apollographql/apollo-server/pull/827)
- The `npm-check-updates` package has been removed as a "dev dependency" which was resulting in an _older_ version of `npm` being used during testing. [PR #959](https://github.com/apollographql/apollo-server/pull/959)
- The typing on `HttpQueryRequest`'s `query` attribute now enforces that its object properties' keys be `String`s. [PR #834](https://github.com/apollographql/apollo-server/pull/834)
Expand Down Expand Up @@ -1185,7 +1185,7 @@ ListenOptions:

## v0.7.1

- Fix graphiql fetcher to use endpointURL parameter instead of hardcoded URI.[#365](https://github.com/apollographql/graphql-server/issues/356)
- Fix GraphiQL fetcher to use endpointURL parameter instead of hardcoded URI.[#365](https://github.com/apollographql/graphql-server/issues/356)

## v0.7.0

Expand Down Expand Up @@ -1255,7 +1255,7 @@ ListenOptions:
[PR #127](https://github.com/apollostack/apollo-server/pull/127)
- Add support for route options in Hapi integration. Issue #97. ([@nnance](https://github.com/nnance)) in
[PR #127](https://github.com/apollostack/apollo-server/pull/127)
- Camelcase Hapi. Issue #129. ([@nnance](https://github.com/nnance)) in
- CamelCase Hapi. Issue #129. ([@nnance](https://github.com/nnance)) in
[PR #132](https://github.com/apollostack/apollo-server/pull/132)
- Fix error handling when parsing variables parameter. Issue #130. ([@nnance](https://github.com/nnance)) in
[PR #131](https://github.com/apollostack/apollo-server/pull/131)
Expand Down
2 changes: 1 addition & 1 deletion codegen.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
schema: https://graphql.api.apollographql.com/api/graphql
generates:
./packages/apollo-server-core/src/plugin/schemaReporting/operations.d.ts:
./packages/apollo-server-core/src/plugin/schemaReporting/generated/operations.d.ts:
documents: packages/apollo-server-core/src/plugin/schemaReporting/schemaReporter.ts
plugins:
- typescript
Expand Down
163 changes: 163 additions & 0 deletions cspell-dict.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
afterware
Afterware
afterwares
Afterwares
apng
apolloexample
apollographql
appenders
asynciterable
autodeploys
automerge
Automerge
automerges
backoff
beyoncé
blahblah
Blocklist
bodyparser
boomify
bwvllq
cacheability
cacheable
Cacheable
circleci
codecov
codegen
codepaths
codesandbox
dataloaders
datasource
datasources
deduplicates
deduplicating
deduplication
deps
deserialization
direnv
Direnv
docset
docstrings
DRYRUN
eastus
endregion
engineproxy
Engineproxy
errored
esque
evenodd
falsey
fastify
Fastify
Fastify's
Fastly
fauxpaque
Fauxpaque
Firestore
Fitzwilliam
functionapp
Fuzzer
gcloud
goofql
graphiql
graphqlcodegenerator
GraphQLJSON
herokuapp
hrtime
htmls
httpcache
IHTTP
instanceof
iteratees
josephg
jsdelivr
KHTML
Kubernetes
linearizability
linearizable
Loftis
loglevel
MAXAGE
mget
Mget
microrouter
middlewares
Middlewares
millis
mygraph
myvariant
namespacing
nanos
npmrc
nsolid
oneof
onwarn
paque
parseurl
pbjs
pbts
pook
Pook
pooks
prepended
prestart
Procfile
promisified
proto
protobuf
Protobuf
proxied
Quickstart
Relatedly
retryable
revalidates
roadmap
ROADMAP
runtimes
safelist
safelisting
Safelisting
Scheer
SCRIPTNAME
SIGINT
SIGTERM
sinonjs
sint
sortby
stringifiable
stringification
subchain
subclassing
subpackage
subqueries
sumby
supergraph
Supergraph
testful
testonly
testsuite
tsbuildinfo
typecheck
typeis
typeof
typesafe
unawaited
uncacheable
undersupported
undici
unexecutable
uninstrumented
unparsable
unref
unsubscriber
Unsubscriber
Unversioned
Uppercasing
USERCONFIG
uuidv
vendia
Wallclock
websockets
Wheelock's
xorby
YOURNAME
38 changes: 38 additions & 0 deletions cspell.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Configuration for the cspell command-line tool and the Code Spell Checker
# VSCode extension
# (https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker).

# Add a repo-specific dictionary. Any new real words can be added to
# cspell-dict.txt, one per line.
dictionaryDefinitions:
- name: workspace
path: './cspell-dict.txt'
description: Custom Workspace Dictionary
addWords: true
scope: workspace
dictionaries:
- workspace

# Ignore files that aren't check in to git as well as files that aren't written
# by hand. Note that we do want to check, say, JSON files (as package.json
# contains English text like package descriptions).
useGitignore: true
ignorePaths:
- '**/generated/**'
- '**/*.sketch'
- '**/*.svg'
- cspell.yaml

ignoreRegExpList:
# GitHub Security Advisories
- GHSA-[-\w]+

overrides:
# Ignore anything in a changelog file that looks like a GitHub username.
- filename: '**/CHANGELOG.md'
ignoreRegExpList:
- "@[-\\w]+"
# Ignore the targets of links in Markdown/MDX files.
- filename: '**/*.md*'
ignoreRegExpList:
- "\\]\\([^)]+\\)"
2 changes: 1 addition & 1 deletion docs/source/api/plugin/cache-control.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ By default, root fields and fields that return a composite type (object, interfa
</td>
<td>

By default, the cache control plugin sets the `cache-control` HTTP response header to `max-age=MAXAGE, public` or `max-age=MAXAGE, private` if the request is cacheable. If you specify `caclculateHttpHeaders: false`, it will not set this header. The `requestContext.overallCachePolicy` field will still be calculated, and the [response cache plugin](../../performance/caching/#caching-with-responsecacheplugin-advanced) will still work.
By default, the cache control plugin sets the `cache-control` HTTP response header to `max-age=MAXAGE, public` or `max-age=MAXAGE, private` if the request is cacheable. If you specify `calculateHttpHeaders: false`, it will not set this header. The `requestContext.overallCachePolicy` field will still be calculated, and the [response cache plugin](../../performance/caching/#caching-with-responsecacheplugin-advanced) will still work.

</td>
</tr>
Expand Down
2 changes: 1 addition & 1 deletion docs/source/data/data-sources.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ flowchart LR;

All data source implementations extend the generic [`DataSource` abstract class](https://github.com/apollographql/apollo-server/blob/main/packages/apollo-datasource/src/index.ts), which is included in the `apollo-datasource` package. Subclasses of a `DataSource` should define whatever logic is required to communicate with a particular store or API.

Apollo and the larger community maintain the following open-source implementatons:
Apollo and the larger community maintain the following open-source implementations:

> Do you maintain a `DataSource` implementation that isn't listed here? Please [submit a PR](https://github.com/apollographql/apollo-server/blob/main/docs/source/data/data-sources.md) to be added to the list!
Expand Down
2 changes: 2 additions & 0 deletions docs/source/data/errors.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ title: Error handling
description: Making errors actionable on the client and server
---

<!-- cSpell:ignore typenam -->

import {ExpansionPanel} from 'gatsby-theme-apollo-docs';

Whenever Apollo Server encounters errors while processing a GraphQL operation, its response to the client includes an `errors` array that contains each error that occurred. Each error in the array has an `extensions` field that provides additional useful information, including an error `code` and (while in development mode) an `exception.stacktrace`.
Expand Down
2 changes: 1 addition & 1 deletion docs/source/data/file-uploads.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ const app = require('fastify')({

const start = async () => {
try {
// Handle all requests that have the `Content-Type` header set as mutlipart
// Handle all requests that have the `Content-Type` header set as multipart
app.addContentTypeParser('multipart', (request, payload, done) => {
request.isMultipart = true;
done();
Expand Down
1 change: 1 addition & 0 deletions docs/source/deployment/lambda.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ First, it builds the functions, zips up the artifacts, and uploads the artifacts

The resulting S3 buckets and Lambda functions can be viewed and managed after logging in to the [AWS Console](https://console.aws.amazon.com).

<!-- cSpell:disable-next-line -->
- To find the created S3 bucket, search the listed services for S3. For this example, the bucket created by Serverless was named `apollo-lambda-dev-serverlessdeploymentbucket-1s10e00wvoe5f`
- To find the created Lambda function, search the listed services for `Lambda`. If the list of Lambda functions is empty, or missing the newly created function, double check the region at the top right of the screen. The default region for Serverless deployments is `us-east-1` (N. Virginia)

Expand Down
6 changes: 3 additions & 3 deletions docs/source/integrations/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const myPlugin = {
You can define a plugin in the same file where you initialize Apollo Server, or
you can export it as a separate module:

```js:title=myplugin.js
```js:title=myPlugin.js
module.exports = {
async serverWillStart() {
console.log('Server starting up!');
Expand All @@ -36,7 +36,7 @@ module.exports = {
To create a plugin that accepts options, create a function that accepts an
`options` object and returns a properly structured plugin object, like so:

```js:title=myplugin.js
```js:title=myPlugin.js
module.exports = (options) => {
return {
async serverWillStart() {
Expand Down Expand Up @@ -145,7 +145,7 @@ Event handlers for the following events can optionally return a function that is

([`executionDidStart`](./plugins-event-reference/#executiondidstart) returns an _object_ containing an `executionDidEnd` function instead of just a function as an end hook. This is because the returned object can also contain `willResolveField`.)

Just like the event handers themselves, these end hooks are async functions (except for the end hook for `willResolveField`).
Just like the event handlers themselves, these end hooks are async functions (except for the end hook for `willResolveField`).

End hooks are passed any errors that occurred during the execution of that lifecycle phase. For example, the following plugin logs any errors that occur during any of the above lifecycle events:

Expand Down
2 changes: 1 addition & 1 deletion docs/source/monitoring/health-checks.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Health checks are often used by load balancers to determine if a server is avail

The most natural way to determine if your GraphQL server is healthy is to run a GraphQL operation!

Every GraphQL server supports the trival query that asks for the "type name" of the top-level query. So you can run a health check as a GET against an URL like:
Every GraphQL server supports the trivial query that asks for the "type name" of the top-level query. So you can run a health check as a GET against an URL like:

```
https://your.server/graphql?query=%7B__typename%7D
Expand Down
Loading

0 comments on commit 0d000e0

Please sign in to comment.