Skip to content

Commit f790124

Browse files
committed
refactor: migrate codebase on typescript
BREAKING CHANGE: removed flowtype definitions; min supported nodejs version is 8
1 parent 71894a3 commit f790124

File tree

72 files changed

+2104
-12925
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+2104
-12925
lines changed

.babelrc

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

.eslintignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
flow-typed
21
lib
3-
mjs
2+
.eslintrc.js

.eslintrc

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

.eslintrc.js

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
const path = require('path');
2+
3+
module.exports = {
4+
parser: '@typescript-eslint/parser',
5+
plugins: ['@typescript-eslint', 'prettier'],
6+
extends: [
7+
'plugin:@typescript-eslint/recommended',
8+
'prettier/@typescript-eslint',
9+
'plugin:prettier/recommended',
10+
],
11+
parserOptions: {
12+
sourceType: 'module',
13+
useJSXTextNode: true,
14+
project: [
15+
path.resolve(__dirname, 'tsconfig.json'),
16+
path.resolve(__dirname, 'examples/tsconfig.json'),
17+
],
18+
},
19+
rules: {
20+
'no-underscore-dangle': 0,
21+
'arrow-body-style': 0,
22+
'no-unused-expressions': 0,
23+
'no-plusplus': 0,
24+
'no-console': 0,
25+
'func-names': 0,
26+
'comma-dangle': [
27+
'error',
28+
{
29+
arrays: 'always-multiline',
30+
objects: 'always-multiline',
31+
imports: 'always-multiline',
32+
exports: 'always-multiline',
33+
functions: 'ignore',
34+
},
35+
],
36+
'no-prototype-builtins': 0,
37+
'prefer-destructuring': 0,
38+
'no-else-return': 0,
39+
'lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: true }],
40+
'@typescript-eslint/explicit-member-accessibility': 0,
41+
'@typescript-eslint/no-explicit-any': 0,
42+
'@typescript-eslint/no-inferrable-types': 0,
43+
'@typescript-eslint/explicit-function-return-type': 0,
44+
'@typescript-eslint/no-use-before-define': 0,
45+
'@typescript-eslint/no-empty-function': 0,
46+
'@typescript-eslint/camelcase': 0,
47+
'@typescript-eslint/ban-ts-comment': 0,
48+
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
49+
},
50+
env: {
51+
jasmine: true,
52+
jest: true,
53+
},
54+
};

.flowconfig

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

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ notifications:
99
node_js:
1010
- "10"
1111
- "12"
12+
- "14"
1213
script:
1314
- yarn run test
1415
- yarn run build

examples/partialApi/index.js renamed to examples/fullApi/index.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
/* @flow */
2-
/* eslint-disable no-console */
3-
41
import express from 'express';
52
import graphqlHTTP from 'express-graphql';
63
import schema from './schema';
@@ -10,14 +7,14 @@ const expressPort = process.env.port || process.env.PORT || 4000;
107
const server = express();
118
server.use(
129
'/',
13-
(graphqlHTTP({
14-
schema: (schema: any),
10+
graphqlHTTP({
11+
schema,
1512
graphiql: true,
16-
formatError: error => ({
13+
customFormatErrorFn: (error) => ({
1714
message: error.message,
18-
stack: error.stack.split('\n'),
15+
stack: error?.stack?.split('\n'),
1916
}),
20-
}): any)
17+
})
2118
);
2219

2320
server.listen(expressPort, () => {

examples/fullApi/schema.js renamed to examples/fullApi/schema.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* @flow */
2-
31
import { GraphQLSchema, GraphQLObjectType } from 'graphql';
42
import awsSDK from 'aws-sdk';
53
import { AwsApiParser } from '../../src'; // from 'graphql-compose-aws';

examples/introspection/generate.js renamed to examples/introspection/generate.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* @flow */
2-
31
import fs from 'fs';
42
import path from 'path';
53
import { printSchema } from 'graphql';

examples/fullApi/index.js renamed to examples/partialApi/index.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
/* @flow */
2-
/* eslint-disable no-console */
3-
41
import express from 'express';
52
import graphqlHTTP from 'express-graphql';
63
import schema from './schema';
@@ -10,14 +7,14 @@ const expressPort = process.env.port || process.env.PORT || 4000;
107
const server = express();
118
server.use(
129
'/',
13-
(graphqlHTTP({
14-
schema: (schema: any),
10+
graphqlHTTP({
11+
schema,
1512
graphiql: true,
16-
formatError: error => ({
13+
customFormatErrorFn: (error) => ({
1714
message: error.message,
18-
stack: error.stack.split('\n'),
15+
stack: error?.stack?.split('\n'),
1916
}),
20-
}): any)
17+
})
2118
);
2219

2320
server.listen(expressPort, () => {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy