Skip to content

Commit

Permalink
fix: fix eslint config rules
Browse files Browse the repository at this point in the history
Signed-off-by: Alexandre Philibeaux <aphilibeaux@scaleway.com>
  • Loading branch information
philibea committed Dec 8, 2024
1 parent 3d63b26 commit 89bdde7
Show file tree
Hide file tree
Showing 16 changed files with 37 additions and 18 deletions.
15 changes: 12 additions & 3 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ export default [
defaultVersion: '18', // Default React version to use when the version you have installed cannot be detected.
// If not provided, defaults to the latest React version.
},
'import/resolver': {
typescript: {
project: [
'./tsconfig.json', // Root config
'./packages/**/tsconfig.json',
],
},
},
},
languageOptions: {
globals: {
Expand All @@ -35,7 +43,6 @@ export default [
...scw.map(config => ({ ...config, files: ['**/*.js'] })),
{
files: ['**/*.js'],

languageOptions: {
parser: babelParser,
parserOptions: {
Expand All @@ -56,7 +63,9 @@ export default [
sourceType: 'script',

parserOptions: {
project: ['tsconfig.json'],
project: ['tsconfig.json', 'packages/**/tsconfig.json'],
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
},
Expand All @@ -73,7 +82,7 @@ export default [
sourceType: 'script',

parserOptions: {
project: ['tsconfig.json'],
project: ['tsconfig.json', 'packages/**/tsconfig.json'],
},
},

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { SerializeOptions } from 'cookie'
import cookie from 'cookie'
import type { PropsWithChildren } from 'react'
import type { SerializeOptions } from 'cookie'
import {
createContext,
useCallback,
Expand All @@ -9,6 +8,7 @@ import {
useMemo,
useState,
} from 'react'
import type { PropsWithChildren } from 'react'
import { uniq } from '../helpers/array'
import { stringToHash } from '../helpers/misc'
import { isCategoryKind } from './helpers'
Expand Down
4 changes: 3 additions & 1 deletion packages/eslint-config-react/shared.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,13 @@ export default [
},

groups: [
['builtin', 'external'],
'builtin',
'external',
'internal',
'parent',
'sibling',
'index',
// "type",
],
'newlines-between': 'never',
},
Expand Down
8 changes: 8 additions & 0 deletions packages/eslint-config-react/stylistic.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ export default [
'@stylistic/arrow-parens': 'off',
'@stylistic/multiline-ternary': 'off',
'@stylistic/no-trailing-spaces': 'off',
'@stylistic/comma-style': 'off',
'@stylistic/func-call-spacing': 'off',
'@stylistic/jsx-wrap-multilines': 'off',
'@stylistic/member-delimiter-style': 'off',
'@stylistic/jsx-curly-brace-presence': 'off',
'@stylistic/jsx-curly-newline': 'off',
'@stylistic/jsx-one-expression-per-line': 'off',
'@stylistic/max-statements-per-line ': 'off',
// -------------------------------------- ///

'@stylistic/brace-style': defaultAirBnbRules['brace-style'],
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-config-react/typescript.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { fixupConfigRules } from '@eslint/compat'
import { FlatCompat } from '@eslint/eslintrc'
import deprecation from 'eslint-plugin-deprecation'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import shared from './shared.mjs'
Expand All @@ -19,6 +18,7 @@ export default [
'airbnb-base',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:import/recommended',
'plugin:import/typescript',
),
),
Expand Down
2 changes: 1 addition & 1 deletion packages/use-dataloader/src/DataLoaderProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ReactElement, ReactNode } from 'react'
import { createContext, useCallback, useContext, useMemo, useRef } from 'react'
import type { ReactElement, ReactNode } from 'react'
import {
DEFAULT_MAX_CONCURRENT_REQUESTS,
KEY_IS_NOT_STRING_ERROR,
Expand Down
2 changes: 1 addition & 1 deletion packages/use-i18n/src/__tests__/formatDate.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, expect, test } from 'vitest'
import type { FormatDateOptions } from '../formatDate'
import formatDate, { supportedFormats } from '../formatDate'
import type { FormatDateOptions } from '../formatDate'

const locales = ['en', 'fr', 'de', 'ro', 'es']

Expand Down
2 changes: 1 addition & 1 deletion packages/use-i18n/src/__tests__/formatUnit.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, expect, test } from 'vitest'
import type { FormatUnitOptions } from '../formatUnit'
import formatUnit, { supportedUnits } from '../formatUnit'
import type { FormatUnitOptions } from '../formatUnit'

const locales = ['en', 'fr', 'ro']

Expand Down
2 changes: 1 addition & 1 deletion packages/use-i18n/src/formatters.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { NumberFormatOptions } from '@formatjs/ecma402-abstract'
import type { Cache } from '@formatjs/fast-memoize'
import { memoize, strategies } from '@formatjs/fast-memoize'
import type { Cache } from '@formatjs/fast-memoize'
import IntlTranslationFormat from 'intl-messageformat'

// Deeply inspired by https://github.com/formatjs/formatjs/blob/7406e526a9c5666cee22cc2316dad1fa1d88697c/packages/intl-messageformat/src/core.ts
Expand Down
2 changes: 1 addition & 1 deletion packages/use-i18n/src/usei18n.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import type {
import { formatDistanceToNow } from 'date-fns/formatDistanceToNow'
import { formatDistanceToNowStrict } from 'date-fns/formatDistanceToNowStrict'
import type { BaseLocale } from 'international-types'
import type { ReactElement, ReactNode } from 'react'
import {
createContext,
useCallback,
Expand All @@ -16,6 +15,7 @@ import {
useMemo,
useState,
} from 'react'
import type { ReactElement, ReactNode } from 'react'
import dateFormat, { type FormatDateOptions } from './formatDate'
import unitFormat, { type FormatUnitOptions } from './formatUnit'
import formatters, { type IntlListFormatOptions } from './formatters'
Expand Down
4 changes: 2 additions & 2 deletions packages/use-query-params/src/__tests__/index.test.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { act, renderHook } from '@testing-library/react'
import type { History } from 'history'
import { createMemoryHistory } from 'history'
import type { ReactNode } from 'react'
import type { History } from 'history'
import { useLayoutEffect, useState } from 'react'
import type { ReactNode } from 'react'
import { MemoryRouter, Router } from 'react-router-dom'
import { describe, expect, it, test } from 'vitest'
import useQueryParams from '..'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Context } from '@segment/analytics-next'
import { AnalyticsBrowser } from '@segment/analytics-next'
import type { Context } from '@segment/analytics-next'
import { render, screen, waitFor } from '@testing-library/react'
import { describe, expect, it, vi } from 'vitest'
import SegmentProvider from '..'
Expand Down
2 changes: 1 addition & 1 deletion packages/use-segment/src/__tests__/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Context } from '@segment/analytics-next'
import { AnalyticsBrowser } from '@segment/analytics-next'
import type { Context } from '@segment/analytics-next'
import { renderHook, waitFor } from '@testing-library/react'
import type { ReactNode } from 'react'
import { beforeEach, describe, expect, it, vi } from 'vitest'
Expand Down
2 changes: 1 addition & 1 deletion packages/use-segment/src/useSegment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import type {
AnalyticsBrowserSettings,
InitOptions,
} from '@segment/analytics-next'
import type { ReactNode } from 'react'
import { createContext, useContext, useMemo, useState } from 'react'
import type { ReactNode } from 'react'
import { useDeepCompareEffectNoCheck } from 'use-deep-compare-effect'

export type OnEventError = (error: Error) => Promise<void> | void
Expand Down
2 changes: 1 addition & 1 deletion packages/validate-icu-locales/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env node

import * as fs from 'fs/promises'
import { parse } from '@formatjs/icu-messageformat-parser'
import type { ParserError } from '@formatjs/icu-messageformat-parser/error'
import * as fs from 'fs/promises'
import { globby } from 'globby'
import { importFromString } from 'module-from-string'

Expand Down

0 comments on commit 89bdde7

Please sign in to comment.