Skip to content

Commit

Permalink
allow eslint --fix to sort and group all imports
Browse files Browse the repository at this point in the history
  • Loading branch information
narthur committed Apr 21, 2023
1 parent c740781 commit 898a093
Show file tree
Hide file tree
Showing 501 changed files with 2,386 additions and 2,379 deletions.
13 changes: 6 additions & 7 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ module.exports = {
'react-hooks',
'lodash',
'@calm/react-intl',
'simple-import-sort',
'import',
],
extends: [
'eslint:recommended',
Expand Down Expand Up @@ -51,13 +53,6 @@ module.exports = {
},
],
'@calm/react-intl/missing-values': 2,
'sort-imports': [
'error',
{
ignoreDeclarationSort: true,
ignoreCase: true,
},
],
'@typescript-eslint/no-unused-vars': [
'error',
{
Expand All @@ -75,6 +70,10 @@ module.exports = {
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'lodash/import-scope': ['error', 'method'],
'simple-import-sort/imports': 'error',
'import/first': 'error',
'import/newline-after-import': 'error',
'import/no-duplicates': 'error',
},
settings: {
react: {
Expand Down
2 changes: 1 addition & 1 deletion .graphqlrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ generates:
- 'typescript-react-query'
- 'graphql-plugin-getters.js'
config:
fetcher: '@lib/api/graphqlFetcher#graphqlFetcher'
fetcher: '~lib/api/graphqlFetcher#graphqlFetcher'
dedupeFragments: true
avoidOptionals: true
defaultScalarType: unknown
Expand Down
3 changes: 1 addition & 2 deletions __mocks__/next/router.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { ParsedUrlQuery } from 'querystring';

import Router_, { NextRouter } from 'next/router';
import { ParsedUrlQuery } from 'querystring';

const Router: typeof Router_ = {
events: {
Expand Down
2 changes: 1 addition & 1 deletion graphql-plugin-getters.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ module.exports = {

if (!result) return '';

return `import { fetchApi } from '@lib/api/fetchApi' \n${result}`;
return `import { fetchApi } from '~lib/api/fetchApi' \n${result}`;
},
};
3 changes: 2 additions & 1 deletion jest.config.strict.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import base from './jest.config';
import type { Config } from '@jest/types';

import base from './jest.config';

const config: Config.InitialOptions = {
...base,
setupFilesAfterEnv: ['<rootDir>/testSetup.strict.ts'],
Expand Down
2 changes: 1 addition & 1 deletion jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import getJestMappersFromTSConfig from 'tsconfig-paths-jest-mapper';
import type { Config } from '@jest/types';
import getJestMappersFromTSConfig from 'tsconfig-paths-jest-mapper';

const moduleNameMapper = getJestMappersFromTSConfig('');

Expand Down
121 changes: 74 additions & 47 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"audit": "audit-ci --config audit-ci.json",
"checkTs": "tsc --noEmit",
"format": "prettier --write .",
"lint": "eslint --max-warnings 0 --ext .ts --ext .tsx --ext .js --ext .jsx src/",
"lint:fix": "eslint --max-warnings 0 --fix --ext .ts --ext .tsx --ext .js --ext .jsx src/",
"lint": "eslint --max-warnings 0 .",
"lint:fix": "eslint --max-warnings 0 --fix .",
"start": "NODE_ICU_DATA=node_modules/full-icu next start",
"test": "TZ=UTC jest --maxWorkers=50%",
"test:watch": "TZ=UTC jest --watch --maxWorkers=25%",
Expand Down Expand Up @@ -103,10 +103,12 @@
"eslint": "^8.9.0",
"eslint-config-next": "^13.0.3",
"eslint-plugin-formatjs": "^3.0.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jest-dom": "^4.0.1",
"eslint-plugin-lodash": "^7.4.0",
"eslint-plugin-react": "^7.31.11",
"eslint-plugin-react-hooks": "^4.3.0",
"eslint-plugin-simple-import-sort": "^10.0.0",
"eslint-plugin-testing-library": "^5.0.5",
"graphql": "^16.3.0",
"graphql-tag": "^2.12.6",
Expand Down
File renamed without changes.
1 change: 0 additions & 1 deletion public/worker-ymWX0Gy9LQDCSp4OnpJ6y.js

This file was deleted.

4 changes: 2 additions & 2 deletions src/components/HOCs/__generated__/withAuthGuard.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions src/components/HOCs/withAuthGuard.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import { __loadRouter } from 'next/router';
import React, { ReactElement } from 'react';
import { QueryClient } from 'react-query';

import withAuthGuard from '@components/HOCs/withAuthGuard';
import { fetchApi } from '@lib/api/fetchApi';
import renderWithProviders from '@lib/test/renderWithProviders';
import withAuthGuard from '~components/HOCs/withAuthGuard';
import { RegisterSocialDocument } from '~containers/account/__generated__/register';
import { fetchApi } from '~lib/api/fetchApi';
import renderWithProviders from '~lib/test/renderWithProviders';

import { GetWithAuthGuardDataDocument } from './__generated__/withAuthGuard';
import { RegisterSocialDocument } from '@containers/account/__generated__/register';

function render() {
const Comp = withAuthGuard(() => <>hello world</>);
Expand Down
7 changes: 4 additions & 3 deletions src/components/HOCs/withAuthGuard.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React from 'react';

import Login from '@components/molecules/login';
import { getCurrentRequest } from '@lib/api/storeRequest';
import { getSessionToken } from '@lib/cookies';
import Login from '~components/molecules/login';
import { getCurrentRequest } from '~lib/api/storeRequest';
import { getSessionToken } from '~lib/cookies';

import { useGetWithAuthGuardDataQuery } from './__generated__/withAuthGuard';

function withAuthGuard<P>(
Expand Down
2 changes: 1 addition & 1 deletion src/components/HOCs/withFailStates.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { render } from '@testing-library/react';
import { useRouter } from 'next/router';
import React from 'react';

import withFailStates from '@components/HOCs/withFailStates';
import withFailStates from '~components/HOCs/withFailStates';

jest.mock('next/router');

Expand Down
4 changes: 2 additions & 2 deletions src/components/HOCs/withFailStates.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useRouter } from 'next/router';
import React from 'react';

import LoadingCards from '@components/molecules/loadingCards';
import NotFoundBase from '@components/organisms/notFound';
import LoadingCards from '~components/molecules/loadingCards';
import NotFoundBase from '~components/organisms/notFound';

type WithFailStateOptions<P> = {
useShould404?: (props: P) => boolean;
Expand Down
Loading

0 comments on commit 898a093

Please sign in to comment.