Skip to content

Commit

Permalink
internal: Update eslint-plugin + prettier 2 (#304)
Browse files Browse the repository at this point in the history
  • Loading branch information
ntucker committed Mar 22, 2020
1 parent 8744edf commit 210eabc
Show file tree
Hide file tree
Showing 18 changed files with 27 additions and 45 deletions.
1 change: 1 addition & 0 deletions .prettierrc
Expand Up @@ -2,5 +2,6 @@
"printWidth": 80,
"semi": true,
"singleQuote": true,
"arrowParens": "avoid",
"trailingComma": "all"
}
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -41,7 +41,7 @@
},
"devDependencies": {
"@anansi/babel-preset": "^1.2.0",
"@anansi/eslint-plugin": "^0.8.6",
"@anansi/eslint-plugin": "^0.9.0",
"@babel/cli": "^7.8.4",
"@babel/core": "^7.9.0",
"@commitlint/cli": "^8.3.5",
Expand All @@ -63,7 +63,7 @@
"jest": "^25.1.0",
"lerna": "^3.20.2",
"nock": "^12.0.0",
"prettier": "^1.19.1",
"prettier": "^2.0.1",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-test-renderer": "^16.13.1",
Expand Down
1 change: 0 additions & 1 deletion packages/legacy/src/__tests__/useStatefulResource.tsx
@@ -1,6 +1,5 @@
import { CoolerArticleResource } from '__tests__/common';
import { makeRenderRestHook, makeCacheProvider } from '@rest-hooks/test';

import nock from 'nock';

import { payload, users, nested } from './fixtures';
Expand Down
1 change: 0 additions & 1 deletion packages/legacy/src/index.ts
Expand Up @@ -6,7 +6,6 @@ import {
useDenormalized,
__INTERNAL__,
} from 'rest-hooks';

import { useContext } from 'react';

/** Ensure a resource is available; loading and error returned explicitly. */
Expand Down
Expand Up @@ -4,7 +4,6 @@ import {
ArticleResourceWithOtherListUrl,
StaticArticleResource,
} from '__tests__/common';

import React, { Suspense, useEffect } from 'react';
import { render } from '@testing-library/react';
import { renderHook } from '@testing-library/react-hooks';
Expand Down Expand Up @@ -367,10 +366,7 @@ describe('useRetrieve', () => {
global.Date.now = jest.fn(() => time);
nock.cleanAll();
const fetchMock = jest.fn(() => payload);
mynock
.get(`/article-cooler/${payload.id}`)
.reply(200, fetchMock)
.persist();
mynock.get(`/article-cooler/${payload.id}`).reply(200, fetchMock).persist();
const results: any[] = [
{
request: CoolerArticleResource.detailShape(),
Expand Down
Expand Up @@ -5,7 +5,6 @@ import {
UserResource,
ArticleResourceWithOtherListUrl,
} from '__tests__/common';

import React from 'react';
import nock from 'nock';
import { act } from '@testing-library/react-hooks';
Expand Down
Expand Up @@ -133,10 +133,7 @@ describe('useResource()', () => {
.get(`/article-cooler/${payload.id}`)
.delay(1000)
.reply(200, payload);
nock('http://test.com')
.get(`/user/`)
.delay(2000)
.reply(200, users);
nock('http://test.com').get(`/user/`).delay(2000).reply(200, users);

function MultiResourceTester() {
try {
Expand Down
@@ -1,7 +1,6 @@
import { StateContext } from 'rest-hooks/react-integration/context';
import { ReadShape, ParamsFromShape } from 'rest-hooks/resource';
import { useDenormalized } from 'rest-hooks/state/selectors';

import { useContext } from 'react';

/** Access a resource if it is available. */
Expand Down
Expand Up @@ -10,7 +10,6 @@ import SubscriptionManager from 'rest-hooks/state/SubscriptionManager';
import PollingSubscription from 'rest-hooks/state/PollingSubscription';
import { State, Manager } from 'rest-hooks/types';
import useEnhancedReducer from '@rest-hooks/use-enhanced-reducer';

import React, { ReactNode, useEffect, useMemo } from 'react';

interface ProviderProps {
Expand Down
@@ -1,6 +1,5 @@
import { CoolerArticleResource } from '__tests__/common';
import { RECEIVE_TYPE } from 'rest-hooks/actionTypes';

import React, { useContext } from 'react';
import { act, render } from '@testing-library/react';

Expand Down
18 changes: 9 additions & 9 deletions packages/rest-hooks/src/state/__tests__/merge.tsx
Expand Up @@ -85,8 +85,8 @@ describe('mergeDeepCopy()', () => {
});
});

describe('basics', function() {
it('should merge `source` into `object`', function() {
describe('basics', function () {
it('should merge `source` into `object`', function () {
const names = {
characters: [{ name: 'barney' }, { name: 'fred' }],
};
Expand All @@ -105,7 +105,7 @@ describe('mergeDeepCopy()', () => {
expect(mergeDeepCopy(names, ages)).toStrictEqual(expected);
});

it('should treat sparse array sources as dense', function() {
it('should treat sparse array sources as dense', function () {
const array = [1];
array[3] = 3;

Expand All @@ -121,26 +121,26 @@ describe('mergeDeepCopy()', () => {
expect(actual).toStrictEqual(expected);
});

it('should assign `null` values', function() {
it('should assign `null` values', function () {
const actual = mergeDeepCopy({ a: 1 }, { a: null });
expect(actual.a).toBe(null);
});

it('should assign non array/buffer/typed-array/plain-object source values directly', function() {
it('should assign non array/buffer/typed-array/plain-object source values directly', function () {
class Foo {}

const values = [true, new Date(), Foo, 5, '', new RegExp('')],
expected = values.map(() => true);

const actual = values.map(function(value) {
const actual = values.map(function (value) {
const object = mergeDeepCopy({}, { a: value, b: { c: value } });
return object.a === value && object.b.c === value;
});

expect(actual).toStrictEqual(expected);
});

it('should not augment source objects', function() {
it('should not augment source objects', function () {
const source1 = { a: [{ a: 1 }] },
source2 = { a: [{ b: 2 }] },
actual = mergeDeepCopy(source1, source2);
Expand All @@ -158,12 +158,12 @@ describe('mergeDeepCopy()', () => {
expect(actualb.a).toStrictEqual([[3, 4, 3]]);
});

it('should not overwrite existing values with `undefined` values of object sources', function() {
it('should not overwrite existing values with `undefined` values of object sources', function () {
const actual = mergeDeepCopy({ a: 1 }, { a: undefined, b: undefined });
expect(actual).toStrictEqual({ a: 1, b: undefined });
});

it('should not overwrite existing values with `undefined` values of array sources', function() {
it('should not overwrite existing values with `undefined` values of array sources', function () {
let array: any[] = [1];
array[2] = 3;

Expand Down
Expand Up @@ -7,7 +7,6 @@ import {
} from '__tests__/common';
import { normalize, NormalizedIndex } from 'rest-hooks/resource';
import { initialState } from 'rest-hooks/state/reducer';

import { renderHook, act } from '@testing-library/react-hooks';
import { useState } from 'react';

Expand Down
1 change: 0 additions & 1 deletion packages/rest-hooks/src/state/selectors/useDenormalized.ts
Expand Up @@ -6,7 +6,6 @@ import {
DenormalizeNullable,
ParamsFromShape,
} from 'rest-hooks/resource';

import { useMemo } from 'react';

import buildInferredResults from './buildInferredResults';
Expand Down
1 change: 0 additions & 1 deletion packages/test/src/MockProvider.tsx
@@ -1,5 +1,4 @@
import { __INTERNAL__, ActionTypes } from 'rest-hooks';

import React from 'react';

import mockState, { Fixture } from './mockState';
Expand Down
1 change: 0 additions & 1 deletion packages/test/src/makeRenderRestHook.tsx
@@ -1,5 +1,4 @@
import { State, SubscriptionManager, Manager } from 'rest-hooks';

import React from 'react';
import { renderHook, RenderHookOptions } from '@testing-library/react-hooks';

Expand Down
1 change: 0 additions & 1 deletion packages/test/src/managers.ts
Expand Up @@ -5,7 +5,6 @@ import {
Dispatch,
PollingSubscription,
} from 'rest-hooks';

import { act } from '@testing-library/react-hooks';

export class MockNetworkManager extends NetworkManager {
Expand Down
1 change: 0 additions & 1 deletion packages/test/src/providers.tsx
Expand Up @@ -6,7 +6,6 @@ import {
Manager,
PromiseifyMiddleware,
} from 'rest-hooks';

import React from 'react';

// Extension of the DeepPartial type defined by Redux which handles unknown
Expand Down
26 changes: 13 additions & 13 deletions yarn.lock
Expand Up @@ -33,13 +33,13 @@
path "^0.12.7"
stable "^0.1.8"

"@anansi/eslint-plugin@^0.8.6":
version "0.8.6"
resolved "https://registry.yarnpkg.com/@anansi/eslint-plugin/-/eslint-plugin-0.8.6.tgz#83c39b4b8601d55d4e9d8badc0c327260daf2f2f"
integrity sha512-ec+qUgzY8VvmzkaJQws/daRGDbpdsFIdLwUCdu22vf4b3l5kidWxwwcGrIwCdfnhgtiOwAZS2xcucV2hpV0lmw==
"@anansi/eslint-plugin@^0.9.0":
version "0.9.0"
resolved "https://registry.yarnpkg.com/@anansi/eslint-plugin/-/eslint-plugin-0.9.0.tgz#5eaf0a976afb1164baafecea6940168ca53fef3b"
integrity sha512-T9tGIgzPb1DXFv8imb9cJ0nSi+Z8HCTZ5ubMtTW2xmfGd232GqZ6TnCsZpSTnWvGjXhR8ZCnsMUOUa6li72ViA==
dependencies:
"@typescript-eslint/eslint-plugin" "^2.23.0"
"@typescript-eslint/parser" "^2.23.0"
"@typescript-eslint/eslint-plugin" "^2.24.0"
"@typescript-eslint/parser" "^2.24.0"
babel-eslint "^10.1.0"
babel-plugin-root-import "^6.4.1"
eslint-config-prettier "^6.10.0"
Expand All @@ -52,7 +52,7 @@
eslint-plugin-prettier "^3.1.2"
eslint-plugin-react "^7.19.0"
eslint-plugin-react-hooks "^2.5.0"
prettier "^1.19.1"
prettier "^2.0.1"
typescript "^3.7.5"

"@babel/cli@^7.8.4":
Expand Down Expand Up @@ -2649,7 +2649,7 @@
dependencies:
"@types/yargs-parser" "*"

"@typescript-eslint/eslint-plugin@^2.23.0":
"@typescript-eslint/eslint-plugin@^2.24.0":
version "2.24.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.24.0.tgz#a86cf618c965a462cddf3601f594544b134d6d68"
integrity sha512-wJRBeaMeT7RLQ27UQkDFOu25MqFOBus8PtOa9KaT5ZuxC1kAsd7JEHqWt4YXuY9eancX0GK9C68i5OROnlIzBA==
Expand All @@ -2669,7 +2669,7 @@
"@typescript-eslint/typescript-estree" "2.24.0"
eslint-scope "^5.0.0"

"@typescript-eslint/parser@^2.23.0":
"@typescript-eslint/parser@^2.24.0":
version "2.24.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-2.24.0.tgz#2cf0eae6e6dd44d162486ad949c126b887f11eb8"
integrity sha512-H2Y7uacwSSg8IbVxdYExSI3T7uM1DzmOn2COGtCahCC3g8YtM1xYAPi2MAHyfPs61VKxP/J/UiSctcRgw4G8aw==
Expand Down Expand Up @@ -8534,10 +8534,10 @@ prettier-linter-helpers@^1.0.0:
dependencies:
fast-diff "^1.1.2"

prettier@^1.19.1:
version "1.19.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb"
integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==
prettier@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.0.1.tgz#3f00ac71263be34684b2b2c8d7e7f63737592dac"
integrity sha512-piXGBcY1zoFOG0MvHpNE5reAGseLmaCRifQ/fmfF49BcYkInEs/naD/unxGNAeOKFA5+JxVrPyMvMlpzcd20UA==

pretty-format@^24.3.0:
version "24.9.0"
Expand Down

0 comments on commit 210eabc

Please sign in to comment.