Skip to content

Commit af3a1a0

Browse files
committed
fix: fix eslint config rules
1 parent ac4d14c commit af3a1a0

File tree

17 files changed

+39
-21
lines changed

17 files changed

+39
-21
lines changed

eslint.config.mjs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ export default [
2525
defaultVersion: '18', // Default React version to use when the version you have installed cannot be detected.
2626
// If not provided, defaults to the latest React version.
2727
},
28+
'import/resolver': {
29+
typescript: {
30+
project: [
31+
'./tsconfig.json', // Root config
32+
'./packages/**/tsconfig.json',
33+
],
34+
},
35+
},
2836
},
2937
languageOptions: {
3038
globals: {
@@ -35,7 +43,6 @@ export default [
3543
...scw.map(config => ({ ...config, files: ['**/*.js'] })),
3644
{
3745
files: ['**/*.js'],
38-
3946
languageOptions: {
4047
parser: babelParser,
4148
parserOptions: {
@@ -56,7 +63,9 @@ export default [
5663
sourceType: 'script',
5764

5865
parserOptions: {
59-
project: ['tsconfig.json'],
66+
project: ['tsconfig.json', 'packages/**/tsconfig.json'],
67+
projectService: true,
68+
tsconfigRootDir: import.meta.dirname,
6069
},
6170
},
6271
},
@@ -73,7 +82,7 @@ export default [
7382
sourceType: 'script',
7483

7584
parserOptions: {
76-
project: ['tsconfig.json'],
85+
project: ['tsconfig.json', 'packages/**/tsconfig.json'],
7786
},
7887
},
7988

packages/cookie-consent/src/CookieConsentProvider/CookieConsentProvider.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import type { SerializeOptions } from 'cookie'
21
import cookie from 'cookie'
3-
import type { PropsWithChildren } from 'react'
2+
import type { SerializeOptions } from 'cookie'
43
import {
54
createContext,
65
useCallback,
@@ -9,8 +8,9 @@ import {
98
useMemo,
109
useState,
1110
} from 'react'
12-
import { uniq } from '../helpers/array'
13-
import { stringToHash } from '../helpers/misc'
11+
import type { PropsWithChildren } from 'react'
12+
import { uniq } from 'helpers/array'
13+
import { stringToHash } from 'helpers/misc'
1414
import { isCategoryKind } from './helpers'
1515
import type { Config, Consent, Integrations } from './types'
1616
import { useSegmentIntegrations } from './useSegmentIntegrations'
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
{
22
"extends": "../../tsconfig.json",
3-
"include": ["src/**/*.ts", "src/**/*.tsx", "*.config.ts"]
3+
"include": ["src/**/*.ts", "src/**/*.tsx", "*.config.ts"],
4+
"compilerOptions": {
5+
"baseUrl": ".",
6+
"paths": {
7+
"helpers/*": ["src/helpers/*"]
8+
}
9+
}
410
}

packages/eslint-config-react/shared.mjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,13 @@ export default [
3737
},
3838

3939
groups: [
40-
['builtin', 'external'],
40+
'builtin',
41+
'external',
4142
'internal',
4243
'parent',
4344
'sibling',
4445
'index',
46+
// "type",
4547
],
4648
'newlines-between': 'never',
4749
},

packages/eslint-config-react/typescript.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export default [
1919
'airbnb-base',
2020
'plugin:@typescript-eslint/recommended',
2121
'plugin:@typescript-eslint/recommended-requiring-type-checking',
22+
'plugin:import/recommended',
2223
'plugin:import/typescript',
2324
),
2425
),

packages/use-dataloader/src/DataLoaderProvider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { ReactElement, ReactNode } from 'react'
21
import { createContext, useCallback, useContext, useMemo, useRef } from 'react'
2+
import type { ReactElement, ReactNode } from 'react'
33
import {
44
DEFAULT_MAX_CONCURRENT_REQUESTS,
55
KEY_IS_NOT_STRING_ERROR,

packages/use-i18n/src/__tests__/formatDate.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { describe, expect, test } from 'vitest'
2-
import type { FormatDateOptions } from '../formatDate'
32
import formatDate, { supportedFormats } from '../formatDate'
3+
import type { FormatDateOptions } from '../formatDate'
44

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

packages/use-i18n/src/__tests__/formatUnit.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { describe, expect, test } from 'vitest'
2-
import type { FormatUnitOptions } from '../formatUnit'
32
import formatUnit, { supportedUnits } from '../formatUnit'
3+
import type { FormatUnitOptions } from '../formatUnit'
44

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

packages/use-i18n/src/formatters.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { NumberFormatOptions } from '@formatjs/ecma402-abstract'
2-
import type { Cache } from '@formatjs/fast-memoize'
32
import { memoize, strategies } from '@formatjs/fast-memoize'
3+
import type { Cache } from '@formatjs/fast-memoize'
44
import IntlTranslationFormat from 'intl-messageformat'
55

66
// Deeply inspired by https://github.com/formatjs/formatjs/blob/7406e526a9c5666cee22cc2316dad1fa1d88697c/packages/intl-messageformat/src/core.ts

0 commit comments

Comments
 (0)