Skip to content

Commit

Permalink
Merge pull request #445 from convoyinc/jdeff/update-eslint
Browse files Browse the repository at this point in the history
Update eslint and other development dependencies
  • Loading branch information
Jayme Deffenbaugh authored Aug 6, 2020
2 parents 8679ef0 + 3d2bb9e commit 217b53e
Show file tree
Hide file tree
Showing 11 changed files with 2,593 additions and 2,482 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: 2

base_image: &base_image
image: convoyinc/circleci-node:10.13.0
image: circleci/node:12.13.0

job_common: &job_common
docker:
Expand Down
38 changes: 25 additions & 13 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ extends:
- eslint:recommended
- plugin:eslint-comments/recommended

parser: typescript-eslint-parser
parser: '@typescript-eslint/parser'
parserOptions:
ecmaVersion: 2017
sourceType: module
jsx: true

plugins:
- '@typescript-eslint'
- eslint-comments
- import
- jest
- typescript

settings:
import/resolver:
Expand Down Expand Up @@ -40,6 +40,7 @@ rules:
no-prototype-builtins: error
no-undef: off # enforced by TypeScript
no-unused-vars: off # enforced by TypeScript
no-redeclare: off # enforced by TypeScript

# Best Practices

Expand Down Expand Up @@ -92,7 +93,13 @@ rules:
block-spacing: error
brace-style: [error, 1tbs]
camelcase: error
comma-dangle: [error, always-multiline]
comma-dangle: [error, {
arrays: always-multiline,
objects: always-multiline,
imports: always-multiline,
exports: always-multiline,
functions: only-multiline,
}]
comma-spacing: error
comma-style: error
computed-property-spacing: error
Expand Down Expand Up @@ -200,19 +207,24 @@ rules:

# https://github.com/nzakas/eslint-plugin-typescript#supported-rules

typescript/adjacent-overload-signatures: error
typescript/class-name-casing: error
typescript/interface-name-prefix: [error, never]
typescript/member-delimiter-style: [error, {
'@typescript-eslint/adjacent-overload-signatures': error
'@typescript-eslint/member-delimiter-style': [error, {
overrides: {
typeLiteral: { delimiter: comma, requireLast: true, ignoreSingleLine: true }
typeLiteral: {
multiline: { delimiter: comma, requireLast: true },
singleline: { delimiter: comma, requireLast: false }
}
}
}]
typescript/member-naming: [error, { private: ^_ }]
typescript/no-angle-bracket-type-assertion: error
typescript/no-triple-slash-reference: error
typescript/no-unused-vars: error
typescript/type-annotation-spacing: error
'@typescript-eslint/naming-convention': [
error,
{ selector: typeLike, format: [PascalCase] },
{ selector: memberLike, modifiers: [private], format: [camelCase], leadingUnderscore: require },
{ selector: interface, format: [PascalCase], custom: { regex: '^I[A-Z]', match: false } }
]
'@typescript-eslint/consistent-type-assertions': error
'@typescript-eslint/triple-slash-reference': [error, { path: never, types: never, lib: never }]
'@typescript-eslint/type-annotation-spacing': error

# https://github.com/mysticatea/eslint-plugin-eslint-comments#rules

Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
10.13.0
12.13.0
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,25 +43,25 @@
"@types/lodash.set": "^4.3.3",
"@types/node": "^14.0.27",
"@types/react": "^16.9.44",
"@typescript-eslint/eslint-plugin": "^3.8.0",
"@typescript-eslint/parser": "^3.8.0",
"audit-ci": "^2.4.0",
"chai": "^4.1.2",
"chai-as-promised": "^7.1.1",
"chai-jest-diff": "nevir/chai-jest-diff#built-member-assertions",
"chai-jest-diff": "^1.0.2",
"codecov": "^3.0.0",
"eslint": "^5.0.0",
"eslint": "^7.6.0",
"eslint-plugin-eslint-comments": "^3.0.0",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jest": "^22.0.0",
"eslint-plugin-typescript": "^0.12.0",
"graphql": "^15.3.0",
"graphql-tag": "^2.11.0",
"jest": "^23.0.0",
"jest": "^26.2.2",
"jest-junit": "^5.0.0",
"lodash": "^4.17.5",
"react": "^16.13.1",
"rimraf": "^2.6.2",
"typescript": "^3.9.7",
"typescript-eslint-parser": "^20.0.0"
"typescript": "^3.9.7"
},
"dependencies": {
"@apollo/client": "^3.1.2",
Expand Down
4 changes: 2 additions & 2 deletions src/context/ConsoleTracer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@ export namespace ConsoleTracer {
warn: _makeDefaultEmitter('warn'),
// Grouping:
group: _makeDefaultEmitter('group'),
groupEnd: console.groupEnd ? console.groupEnd.bind(console) : () => {}, // eslint-disable-line no-console
groupEnd: console.groupEnd ? console.groupEnd.bind(console) : () => {},
};
}

function _makeDefaultEmitter(level: 'debug' | 'info' | 'warn' | 'group') {
const method = console[level] || console.log; // eslint-disable-line no-console
const method = console[level] || console.log;
return function defaultLogger(message: string, ...args: any[]) {
method.call(console, `[Cache] ${message}`, ...args);
};
Expand Down
6 changes: 3 additions & 3 deletions src/operations/SnapshotEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { InvalidPayloadError, OperationError } from '../errors';
import { GraphSnapshot } from '../GraphSnapshot';
import { cloneNodeSnapshot, EntitySnapshot, NodeSnapshot, ParameterizedValueSnapshot } from '../nodes';
import { FieldArguments, ParsedQuery } from '../ParsedQueryNode';
import { JsonArray, JsonObject, JsonValue, nil, PathPart } from '../primitive';
import { JsonArray, JsonObject, JsonValue, Nil, PathPart } from '../primitive';
import { NodeId, OperationInstance, RawOperation } from '../schema';
import {
addNodeReference,
Expand Down Expand Up @@ -327,8 +327,8 @@ export class SnapshotEditor {
prefixPath: PathPart[],
path: PathPart[],
parsed: ParsedQuery,
payload: JsonArray | nil,
previousValue: JsonArray | nil,
payload: JsonArray | Nil,
previousValue: JsonArray | Nil,
) {
if (isNil(payload)) {
// Note that we mark this as an edit, as this method is only ever called
Expand Down
6 changes: 3 additions & 3 deletions src/primitive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
/**
* A primitive value.
*/
export type scalar = undefined | null | boolean | number | string | Symbol;
export type Scalar = undefined | null | boolean | number | string | Symbol;

/**
* A missing object.
*/
export type nil = undefined | null;
export type Nil = undefined | null;

/**
* A component of a path through objects/arrays.
Expand Down Expand Up @@ -47,7 +47,7 @@ export type DeepReadonly<TType> = {
*/
export type NestedValue<TValue> = TValue | NestedArray<TValue> | NestedObject<TValue>;
export interface NestedArray<TValue> extends Array<NestedValue<TValue>> {}
export interface NestedObject<TValue> { [key: string]: NestedValue<TValue>; }
export interface NestedObject<TValue> { [key: string]: NestedValue<TValue> }

// JSON

Expand Down
4 changes: 2 additions & 2 deletions src/util/ast.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// We only depend on graphql for its types; nothing at runtime.
import { // eslint-disable-line import/no-extraneous-dependencies
import {
ArgumentNode,
DocumentNode,
FieldNode,
Expand All @@ -8,7 +8,7 @@ import { // eslint-disable-line import/no-extraneous-dependencies
SelectionNode,
SelectionSetNode,
ValueNode,
} from 'graphql';
} from 'graphql'; // eslint-disable-line import/no-extraneous-dependencies
import { getOperationDefinition, FragmentMap } from '@apollo/client/utilities';
import invariant from 'ts-invariant';

Expand Down
6 changes: 3 additions & 3 deletions src/util/primitive.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { JsonObject, nil, scalar } from '../primitive';
import { JsonObject, Nil, Scalar } from '../primitive';

export function isScalar(value: any): value is scalar {
export function isScalar(value: any): value is Scalar {
return value === null || typeof value !== 'object';
}

Expand All @@ -12,7 +12,7 @@ export function isObjectOrNull(value: any): value is JsonObject | null {
return typeof value === 'object' && !Array.isArray(value);
}

export function isNil(value: any): value is nil {
export function isNil(value: any): value is Nil {
return value === null || value === undefined || Number.isNaN(value);
}

Expand Down
2 changes: 1 addition & 1 deletion test/unit/jest.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"<rootDir>/test/"
],
"rootDir": "../..",
"setupTestFrameworkScriptFile": "./test/env/unit.js",
"setupFilesAfterEnv": ["./test/env/unit.js"],
"testMatch": ["<rootDir>/test/unit/**/*.js"],
"reporters": ["default", "jest-junit"]
}
Loading

0 comments on commit 217b53e

Please sign in to comment.