Skip to content

Commit b34a87c

Browse files
committed
Linting
1 parent 4d74760 commit b34a87c

File tree

11 files changed

+550
-48
lines changed

11 files changed

+550
-48
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

.eslintrc.js

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,16 @@
11
module.exports = {
22
parser: "babel-eslint",
3-
extends: ["airbnb", "prettier"],
4-
plugins: ["jest", "prettier"],
3+
extends: ["eslint:recommended", "prettier"],
4+
plugins: ["jest"],
55
env: {
66
jest: true,
7-
node: true
7+
node: true,
8+
es6: true,
89
},
910
rules: {
1011
// Autofix removes debugger automatically, which makes debugging annoying.
1112
"no-debugger": 0,
1213

13-
// Prettier
14-
"prettier/prettier": [
15-
"error",
16-
{
17-
trailingComma: "es5"
18-
}
19-
],
20-
2114
// Jest
2215
"jest/no-focused-tests": 2,
2316
"jest/no-identical-title": 2,
@@ -33,30 +26,30 @@ module.exports = {
3326
2,
3427
{
3528
argsIgnorePattern: "^_",
36-
varsIgnorePattern: "^_"
37-
}
29+
varsIgnorePattern: "^_",
30+
},
3831
],
3932
"no-cond-assign": [2, "except-parens"],
4033
"no-unused-expressions": [
4134
0,
4235
{
43-
allowTernary: true
44-
}
36+
allowTernary: true,
37+
},
4538
],
4639
"prefer-arrow-callback": [
4740
"error",
4841
{
49-
allowNamedFunctions: true
50-
}
42+
allowNamedFunctions: true,
43+
},
5144
],
5245
"no-param-reassign": [
5346
"error",
5447
{
5548
props: true,
5649
// Allow overwriting properties on 'memo' which is the name we tend to use in `.reduce(...)` calls
57-
ignorePropertyModificationsFor: ["memo"]
58-
}
50+
ignorePropertyModificationsFor: ["memo"],
51+
},
5952
],
60-
camelcase: 0
61-
}
53+
camelcase: 0,
54+
},
6255
};

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/

.prettierrc.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
trailingComma: "all",
3+
proseWrap: "always",
4+
};

gatsby-node.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ exports.sourceNodes = async (
1111
fieldName = "postgres",
1212
refetchInterval,
1313
...options
14-
}
14+
},
1515
) => {
1616
const { connectionString, schema: postgresSchema, ...rest } = options;
1717

lib/PostGraphileLink.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module.exports = class PostGraphileLink extends ApolloLink {
1616
this.schema,
1717
operation.query,
1818
operation.variables,
19-
operation.operationName
19+
operation.operationName,
2020
)
2121
.then(data => {
2222
if (!observer.closed) {

lib/RenamedQueryPlugin.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ module.exports = function RenamedQueryPlugin(builder) {
55
{
66
$$isQuery: Symbol("isQuery"),
77
},
8-
`Extending Build`
9-
)
8+
`Extending Build`,
9+
),
1010
);
1111
builder.hook("GraphQLSchema", (schema, build) => {
1212
const {
@@ -28,14 +28,14 @@ module.exports = function RenamedQueryPlugin(builder) {
2828
{
2929
__origin: `gatsby-source-pg override`,
3030
isRootQuery: true,
31-
}
31+
},
3232
);
3333
return extend(
3434
schema,
3535
{
3636
query: queryType,
3737
},
38-
`Adding 'query' type to Schema`
38+
`Adding 'query' type to Schema`,
3939
);
4040
});
4141
};

lib/createSchema.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function requireFrom(modules, moduleName) {
99
if (modules.length > 1) {
1010
const result = requireFrom(
1111
modules.slice(0, modules.length - 1),
12-
moduleName
12+
moduleName,
1313
);
1414
if (result) return result;
1515
}
@@ -21,7 +21,7 @@ function requireFrom(modules, moduleName) {
2121
}
2222
const graphileBuild = requireFrom(
2323
["postgraphile", "postgraphile-core"],
24-
"graphile-build"
24+
"graphile-build",
2525
);
2626

2727
const RenamedQueryPlugin = require("./RenamedQueryPlugin");

lib/performQuery.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module.exports = async function performQuery(
66
schema,
77
query,
88
variables,
9-
operationName
9+
operationName,
1010
) {
1111
const queryString = typeof query === "string" ? query : print(query);
1212
return withPostGraphileContext({ pgPool }, async context =>
@@ -16,7 +16,7 @@ module.exports = async function performQuery(
1616
null,
1717
{ ...context }, // You can add more to context if you like
1818
variables,
19-
operationName
20-
)
19+
operationName,
20+
),
2121
);
2222
};

package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
"description": "PostgreSQL source for Gatsby, powered by PostGraphile",
55
"main": "index.js",
66
"scripts": {
7+
"lint:fix": "yarn prettier --write && yarn eslint --fix",
8+
"prettier": "prettier --ignore-path .eslintignore '**/*.{js,jsx,ts,tsx,graphql,md,yaml,yml}'",
9+
"eslint": "eslint --ext js,jsx,ts,tsx .",
710
"test": "jest"
811
},
912
"repository": {
@@ -43,12 +46,12 @@
4346
},
4447
"devDependencies": {
4548
"babel-eslint": "^10.0.1",
46-
"eslint": "^5.8.0",
49+
"eslint": "^6.8.0",
4750
"eslint-config-airbnb": "^17.1.0",
48-
"eslint-config-prettier": "^3.1.0",
51+
"eslint-config-prettier": "^6.10.1",
4952
"eslint-plugin-graphql": "benjie/eslint-plugin-graphql#ignore-fragments-built",
5053
"eslint-plugin-import": "^2.14.0",
51-
"eslint-plugin-jest": "^21.26.2",
54+
"eslint-plugin-jest": "^23.8.2",
5255
"eslint-plugin-jsx-a11y": "^6.1.2",
5356
"eslint-plugin-prettier": "^3.0.0",
5457
"eslint-plugin-react": "^7.11.1",

0 commit comments

Comments
 (0)