Skip to content

Commit 9f28276

Browse files
chore: update ts config structure (#6008)
1 parent 068e441 commit 9f28276

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+181
-167
lines changed

.eslintrc.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,16 @@ rules:
4141
order: asc
4242
caseInsensitive: true
4343
import/no-duplicates: 'error'
44-
import/no-unresolved: 'error'
44+
import/no-unresolved: 'off'
4545
overrides:
4646
# add config for all TypeScript files
4747
- files:
4848
- '*.ts'
4949
- '*.tsx'
5050
parserOptions:
51-
project:
52-
- './tsconfig.spec.json'
53-
- './tsconfig.node.json'
54-
- './packages/*/tsconfig.json'
51+
EXPERIMENTAL_useProjectService:
52+
# TODO https://github.com/typescript-eslint/typescript-eslint/issues/9450
53+
maximumDefaultProjectFileMatchCount_THIS_WILL_SLOW_DOWN_LINTING: 1000
5554
plugins:
5655
- '@typescript-eslint'
5756
extends:
@@ -124,7 +123,6 @@ overrides:
124123
rules:
125124
'@typescript-eslint/no-empty-function': 'off'
126125
'import/order': 'warn'
127-
'import/no-unresolved': 'off'
128126
'react/no-unescaped-entities': 'off'
129127
'@typescript-eslint/unbound-method': 'warn'
130128
'react/display-name': 'off'

.storybook/components/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ export * from './ProductsTable';
66
export * from './ProjectTemplate';
77
export * from './TableOfContent';
88
export * from './LabelWithWrapping';
9+
export * from './CommandsAndQueries';

.storybook/utils.ts

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import { DocsContext } from '@storybook/blocks';
22
import { useContext, useMemo } from 'react';
3+
// @ts-expect-error: storybook can handle this
34
import cemFiori from './custom-element-manifests/fiori.json';
5+
// @ts-expect-error: storybook can handle this
46
import cemMain from './custom-element-manifests/main.json';
7+
58
export const isChromatic = process.env.STORYBOOK_ENV === 'chromatic';
69

710
export const MAPPED_THEMES = [
@@ -23,19 +26,22 @@ export const excludePropsForAbstract = ['className', 'style'];
2326

2427
export function useGetCem() {
2528
const docsContext = useContext(DocsContext);
29+
// @ts-expect-error: private but existing
2630
const { attachedCSFFiles } = docsContext;
2731

28-
const storyTagsSet: Set<string> | undefined = attachedCSFFiles?.size
29-
? Array.from(attachedCSFFiles).reduce((acc, cur) => {
30-
const tags: string[] | undefined = cur?.meta?.tags;
31-
if (tags?.length) {
32-
tags.forEach((tag) => {
33-
acc.add(tag);
34-
});
35-
}
36-
return acc;
37-
}, new Set<string>())
38-
: undefined;
32+
const storyTagsSet = new Set<string>();
33+
34+
if (attachedCSFFiles?.size) {
35+
Array.from(attachedCSFFiles).forEach((cur) => {
36+
// @ts-expect-error: private but existing
37+
const tags: string[] | undefined = cur?.meta?.tags;
38+
if (tags?.length) {
39+
tags.forEach((tag) => {
40+
storyTagsSet.add(tag);
41+
});
42+
}
43+
});
44+
}
3945

4046
const storyTags = storyTagsSet?.size ? Array.from(storyTagsSet) : [];
4147
const packageAnnotation = storyTags?.find((tag) => tag.startsWith('package:'));
@@ -46,6 +52,7 @@ export function useGetCem() {
4652
return cemFiori;
4753
}
4854
}
55+
4956
const replaceSubComps = {
5057
ListItemBase: ['ListItemStandard', 'ListItemCustom', 'ListItemGroup'],
5158
InputSuggestionItem: ['SuggestionItem', 'SuggestionGroupItem'],
@@ -83,6 +90,7 @@ function findSubComponentsRecursively(moduleName: string, cem: any): string[] {
8390

8491
return Array.from(subComponentsSet);
8592
}
93+
8694
export function useGetSubComponentsOfModule(moduleName: string) {
8795
const cem = useGetCem(); // Assuming useGetCem() is defined elsewhere
8896
return useMemo(() => {

cypress.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import codeCoverageTask from '@cypress/code-coverage/task';
1+
import codeCoverageTask from '@cypress/code-coverage/task.js';
22
import { defineConfig } from 'cypress';
33

44
export default defineConfig({

docs/Formhandling.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ You can then create a form with UI5 Web Components for React as follows. Also, y
2121
<summary>Show code</summary>
2222

2323
```jsx
24-
import React, { useState } from 'react';
24+
import { useState } from 'react';
2525
import {
2626
ThemeProvider,
2727
Form,

docs/Welcome.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ You can find all available interfaces of the main package [here](https://github.
148148
Small app with a popover opened by clicking a button including type declarations:
149149

150150
```tsx
151-
import React, { useState, useRef } from 'react';
151+
import { useState, useRef } from 'react';
152152
import type { ButtonPropTypes, PopoverDomRef, PopoverPropTypes } from '@ui5/webcomponents-react';
153153
import { ThemeProvider, Button, Popover } from '@ui5/webcomponents-react';
154154

docs/knowledge-base/Styling.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ In order to reuse our central styling approach, you can import the `ThemingParam
7777
You can then create a custom component by following this recipe:
7878

7979
```tsx
80-
import React from 'react';
8180
import { ThemingParameters } from '@ui5/webcomponents-react-base';
8281
import './MyCustomElement.css';
8382

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010
"start:watcher": "lerna run watch:css",
1111
"start:storybook": "storybook dev -p 6006",
1212
"setup": "lerna run build:i18n && lerna run build:css && lerna run build:css-bundle && rimraf node_modules/@types/mocha",
13-
"build": "yarn setup && tsc --build && lerna run build:client && lerna run build:wrapper && lerna run build:ssr",
13+
"build": "yarn setup && tsc --build tsconfig.build.json && lerna run build:client && lerna run build:wrapper && lerna run build:ssr",
1414
"build:storybook": "lerna run build:i18n && yarn create-cypress-commands-docs && storybook build -o .out",
1515
"build:storybook-sitemap": "node ./scripts/create-storybook-sitemap.js --directory .out",
1616
"test:prepare": "rimraf temp && lerna run build",
1717
"test:cypress": "cypress run --component --browser chrome",
1818
"test:cypress:open": "CYPRESS_COVERAGE=false cypress open --component --browser chrome",
1919
"test": "yarn test:prepare && yarn test:cypress",
20-
"clean": "tsc --build --clean && rimraf temp .out && lerna run clean",
20+
"clean": "tsc --build --clean && tsc --build tsconfig.build.json --clean && rimraf temp .out && lerna run clean",
2121
"clean:remove-modules": "yarn clean && rimraf node_modules",
2222
"prettier:all": "prettier --write --config ./prettier.config.cjs \"packages/**/*.{js,jsx,ts,tsx,mdx,json,md}\"",
2323
"lint": "eslint packages --ext .ts,.tsx",

packages/base/src/hooks/useStylesheet.cy.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
import { ObjectStatus } from '@ui5/webcomponents-react';
12
import { useReducer } from 'react';
2-
import { ObjectStatus } from '@/packages/main/src';
33

44
interface CondRenderCompProps {
55
testid?: string;
66
}
7+
78
const CondRenderComp = ({ testid }: CondRenderCompProps) => {
89
const [visible, toggle] = useReducer((prev) => !prev, true);
910
return (

packages/base/tsconfig.build.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"exclude": ["node_modules", "**/*.cy.ts", "**/*.cy.tsx"]
4+
}

packages/base/tsconfig.json

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
11
{
22
"extends": "../../tsconfig.base.json",
33
"compilerOptions": {
4-
"module": "NodeNext",
5-
"moduleResolution": "NodeNext",
6-
"baseUrl": ".",
7-
"outDir": "./dist",
8-
"declarationDir": "./dist",
94
"strict": true,
10-
"noImplicitAny": false,
11-
"rootDir": "./src"
5+
"noImplicitAny": false
126
},
13-
"include": ["src/**/*"],
14-
"exclude": ["node_modules", "**/*.cy.ts", "**/*.cy.tsx"]
7+
"include": ["src"]
158
}

packages/charts/src/components/LineChart/LineChart.stories.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type { Meta, StoryObj } from '@storybook/react';
2-
import React from 'react';
32
import { bigDataSet, complexDataSet, secondaryDimensionDataSet, simpleDataSet } from '../../resources/DemoProps.js';
43
import { LineChart } from './LineChart.js';
54

packages/charts/src/components/TimelineChart/TimeLineChart.stories.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import type { Meta, StoryObj } from '@storybook/react';
22
import { ThemingParameters } from '@ui5/webcomponents-react-base';
3-
import React from 'react';
43
import { Invention, TimingFigure } from './examples/Annotations.js';
54
import { dummyDataSet, dummyDiscreteDataSet, inventionDataset, schedulingEDFData } from './examples/Dataset.js';
65
import { TimelineChart } from './TimelineChart.js';

packages/charts/tsconfig.build.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"references": [
4+
{
5+
"path": "../base/tsconfig.build.json"
6+
},
7+
{
8+
"path": "../main/tsconfig.build.json"
9+
}
10+
],
11+
"exclude": ["node_modules", "**/*.cy.ts", "**/*.cy.tsx", "**/*.stories.tsx"]
12+
}

packages/charts/tsconfig.json

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,12 @@
11
{
22
"extends": "../../tsconfig.base.json",
3-
"compilerOptions": {
4-
"module": "NodeNext",
5-
"moduleResolution": "NodeNext",
6-
"baseUrl": ".",
7-
"outDir": "./dist",
8-
"declarationDir": "./dist",
9-
"rootDir": "./src"
10-
},
113
"references": [
124
{
13-
"path": "../base"
5+
"path": "../base/tsconfig.json"
146
},
157
{
16-
"path": "../main"
8+
"path": "../main/tsconfig.json"
179
}
1810
],
19-
"include": ["src/**/*"],
20-
"exclude": ["node_modules", "**/*.cy.ts", "**/*.cy.tsx", "**/*.stories.tsx"]
11+
"include": ["src"]
2112
}

packages/cli/tsconfig.build.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "./tsconfig.json"
3+
}

packages/cli/tsconfig.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,7 @@
33
"compilerOptions": {
44
"target": "es2022",
55
"lib": ["ES2023", "dom"],
6-
"module": "NodeNext",
7-
"moduleResolution": "NodeNext",
86
"noEmitOnError": true,
9-
"baseUrl": ".",
10-
"outDir": "./dist",
11-
"declarationDir": "./dist",
12-
"rootDir": "./src",
137
"strict": true,
148
"types": ["node"],
159
"skipLibCheck": true

packages/compat/tsconfig.build.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"references": [
4+
{
5+
"path": "../base/tsconfig.build.json"
6+
},
7+
{
8+
"path": "../main/tsconfig.build.json"
9+
}
10+
],
11+
"exclude": ["node_modules", "**/*.cy.ts", "**/*.cy.tsx", "**/*.stories.tsx"]
12+
}

packages/compat/tsconfig.json

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,18 @@
11
{
22
"extends": "../../tsconfig.base.json",
33
"compilerOptions": {
4-
"module": "NodeNext",
5-
"moduleResolution": "NodeNext",
6-
"baseUrl": ".",
7-
"outDir": "./dist",
8-
"declarationDir": "./dist",
9-
"rootDir": "./src",
104
"strict": true,
115
"noImplicitAny": false,
126
"strictNullChecks": false,
137
"isolatedModules": true
148
},
159
"references": [
1610
{
17-
"path": "../base"
11+
"path": "../base/tsconfig.json"
1812
},
1913
{
20-
"path": "../main"
14+
"path": "../main/tsconfig.json"
2115
}
2216
],
23-
"include": ["src/**/*"],
24-
"exclude": ["node_modules", "**/*.cy.ts", "**/*.cy.tsx", "**/*.stories.tsx"]
17+
"include": ["src/**/*"]
2518
}
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { Footer, TableOfContent } from '@sb/components';
1+
import { CommandsAndQueries, Footer, TableOfContent } from '@sb/components';
22
import { Meta } from '@storybook/addon-docs';
33
import API from './api.json';
4-
import { CommandsAndQueries } from './CommandsAndQueries.tsx';
54

65
<Meta title="Commands" />
76

@@ -12,7 +11,7 @@ import { CommandsAndQueries } from './CommandsAndQueries.tsx';
1211
Here you can find all available Commands of the `@ui5/webcomponents-cypress-commands` package.
1312

1413
<CommandsAndQueries
15-
api={API.children.find((file) => file.name === 'src/commands')?.children?.[0]?.children?.[0]?.children ?? []}
14+
api={API.children.find((file) => file.name === 'commands')?.children?.[0]?.children?.[0]?.children ?? []}
1615
/>
1716

1817
<Footer />

packages/cypress-commands/Queries.mdx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { Footer, TableOfContent } from '@sb/components';
1+
import { CommandsAndQueries, Footer, TableOfContent } from '@sb/components';
22
import { Meta } from '@storybook/addon-docs';
33
import API from './api.json';
4-
import { CommandsAndQueries } from './CommandsAndQueries.tsx';
54

65
<Meta title="Queries" />
76

@@ -12,7 +11,7 @@ import { CommandsAndQueries } from './CommandsAndQueries.tsx';
1211
Here you can find all available Queries of the `@ui5/webcomponents-cypress-commands` package.
1312

1413
<CommandsAndQueries
15-
api={API.children.find((file) => file.name === 'src/queries')?.children?.[0]?.children?.[0]?.children ?? []}
14+
api={API.children.find((file) => file.name === 'queries')?.children?.[0]?.children?.[0]?.children ?? []}
1615
/>
1716

1817
<Footer />
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "./tsconfig.json"
3+
}

packages/cypress-commands/tsconfig.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
"module": "NodeNext",
55
"moduleResolution": "NodeNext",
66
"noEmitOnError": true,
7-
"baseUrl": ".",
8-
"outDir": "./dist",
9-
"declarationDir": "./dist",
10-
"rootDir": "./src",
117
"types": ["cypress"],
128
"strict": true,
139
"skipLibCheck": true
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
{
22
"extends": "./tsconfig.json",
3-
"compilerOptions": {
4-
"rootDir": "."
5-
},
6-
"include": ["src", "CommandsAndQueries.tsx"]
3+
"include": ["src"]
74
}

packages/main/.babelrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,5 @@
4848
]
4949
}
5050
},
51-
"ignore": ["**/*.cy.ts", "**/*.cy.tsx", "**/CodeGen.tsx", "**/*.stories.tsx"]
51+
"ignore": ["dist", "**/*.cy.ts", "**/*.cy.tsx", "**/CodeGen.tsx", "**/*.stories.tsx"]
5252
}

packages/main/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@
4444
"scripts": {
4545
"clean": "rimraf dist tmp wrappers ssr",
4646
"build:i18n": "node scripts/generateI18n.mjs",
47-
"build:client": "babel src --out-dir dist --extensions .ts,.tsx --env-name client && tsc --declarationDir dist",
48-
"build:ssr": "babel src --out-dir ssr --extensions .ts,.tsx --env-name ssr && tsc --declarationDir ssr",
49-
"build:wrapper": "babel src --out-dir wrappers --extensions .ts,.tsx --env-name wrapper && tsc --declarationDir wrappers",
47+
"build:client": "babel src --out-dir dist --extensions .ts,.tsx --env-name client && tsc --project tsconfig.build.json --declarationDir dist",
48+
"build:ssr": "babel src --out-dir ssr --extensions .ts,.tsx --env-name ssr && tsc --project tsconfig.build.json --declarationDir ssr",
49+
"build:wrapper": "babel src --out-dir wrappers --extensions .ts,.tsx --env-name wrapper && tsc --project tsconfig.build.json --declarationDir wrappers",
5050
"build:css": "postcss --base src --dir dist/css src/**/*.css",
5151
"build:css-bundle": "node ../../config/merge-css-modules.js",
5252
"watch:css": "yarn build:css --watch"

packages/main/src/components/AnalyticalTable/AnalyticalTable.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { Meta, StoryObj } from '@storybook/react';
44
import '@ui5/webcomponents-icons/dist/delete.js';
55
import '@ui5/webcomponents-icons/dist/edit.js';
66
import '@ui5/webcomponents-icons/dist/settings.js';
7-
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
7+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
88
import {
99
AnalyticalTableScaleWidthMode,
1010
AnalyticalTableSelectionBehavior,

packages/main/src/components/AnalyticalTable/AnalyticalTableHooks.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import dataManualSelect from '@sb/mockData/FriendsManualSelect25.json';
44
import dataTree from '@sb/mockData/FriendsTree.json';
55
import type { Meta, StoryObj } from '@storybook/react';
66
import InputType from '@ui5/webcomponents/dist/types/InputType.js';
7-
import React, { useReducer, useState } from 'react';
7+
import { useReducer, useState } from 'react';
88
import { AnalyticalTableSelectionMode, FlexBoxAlignItems, FlexBoxDirection } from '../../enums';
99
import { Button, CheckBox, Input, Label, ToggleButton, Text } from '../../webComponents';
1010
import { FlexBox } from '../FlexBox';

packages/main/src/components/Grid/Grid.stories.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type { Meta, StoryObj } from '@storybook/react';
2-
import React from 'react';
32
import { Grid } from './index.js';
43

54
const meta = {

0 commit comments

Comments
 (0)