Skip to content

Commit 69b2f34

Browse files
authored
chore(prettier): enable trailing commas (#7330)
Also changes the `prettier.config` file to ES Module and adds it to the `tsconfig`.
1 parent 7b76a7e commit 69b2f34

File tree

481 files changed

+3346
-3328
lines changed

Some content is hidden

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

481 files changed

+3346
-3328
lines changed

eslint.config.mjs

Lines changed: 51 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import tseslint from 'typescript-eslint';
1212

1313
const ignorePatterns = {
1414
ignores: [
15+
'packages/ai/dist',
1516
'packages/base/dist',
1617
'packages/base/types',
1718
'packages/charts/dist',
@@ -22,13 +23,14 @@ const ignorePatterns = {
2223
'packages/main/src/i18n/i18n-defaults.ts',
2324
'packages/main/src/generated',
2425
'packages/cypress-commands/dist',
26+
'**/generated',
2527
'**/scripts',
2628
'**/shared',
2729
'**/examples',
2830
'**/templates',
2931
'**/*.module.css.ts',
30-
'.yarn'
31-
]
32+
'.yarn',
33+
],
3234
};
3335

3436
const config = tseslint.config(
@@ -46,14 +48,14 @@ const config = tseslint.config(
4648
// eslint-plugin-react-hooks
4749
{
4850
plugins: {
49-
'react-hooks': reactHooksPlugin
51+
'react-hooks': reactHooksPlugin,
5052
},
51-
rules: reactHooksPlugin.configs.recommended.rules
53+
rules: reactHooksPlugin.configs.recommended.rules,
5254
},
5355
{
5456
languageOptions: {
5557
globals: {
56-
...globals.browser
58+
...globals.browser,
5759
},
5860

5961
ecmaVersion: 'latest',
@@ -63,15 +65,15 @@ const config = tseslint.config(
6365
projectService: {
6466
allowDefaultProject: ['packages/*/postcss.config.mjs'],
6567
// eslint-disable-next-line camelcase
66-
maximumDefaultProjectFileMatchCount_THIS_WILL_SLOW_DOWN_LINTING: 1000
67-
}
68-
}
68+
maximumDefaultProjectFileMatchCount_THIS_WILL_SLOW_DOWN_LINTING: 1000,
69+
},
70+
},
6971
},
7072

7173
settings: {
7274
react: {
73-
version: 'detect'
74-
}
75+
version: 'detect',
76+
},
7577
},
7678

7779
rules: {
@@ -89,9 +91,9 @@ const config = tseslint.config(
8991
'sap_horizon',
9092
'sap_horizon_dark',
9193
'sap_horizon_hcb',
92-
'sap_horizon_hcw'
93-
]
94-
}
94+
'sap_horizon_hcw',
95+
],
96+
},
9597
],
9698

9799
'import/order': [
@@ -101,25 +103,25 @@ const config = tseslint.config(
101103

102104
alphabetize: {
103105
order: 'asc',
104-
caseInsensitive: true
105-
}
106-
}
106+
caseInsensitive: true,
107+
},
108+
},
107109
],
108110

109111
'import/no-duplicates': 'error',
110112
'import/no-unresolved': 'off',
111113

112114
// recommended eslint rules
113-
'no-extra-boolean-cast': 'warn'
114-
}
115+
'no-extra-boolean-cast': 'warn',
116+
},
115117
},
116118
{
117119
files: ['**/*.ts', '**/*.tsx'],
118120

119121
settings: {
120122
'import/resolver': {
121-
typescript: true
122-
}
123+
typescript: true,
124+
},
123125
},
124126

125127
rules: {
@@ -136,16 +138,16 @@ const config = tseslint.config(
136138
'@typescript-eslint/consistent-type-exports': [
137139
'error',
138140
{
139-
fixMixedExportsWithInlineTypeSpecifier: false
140-
}
141+
fixMixedExportsWithInlineTypeSpecifier: false,
142+
},
141143
],
142144

143145
'@typescript-eslint/consistent-type-imports': [
144146
'error',
145147
{
146148
prefer: 'type-imports',
147-
fixStyle: 'separate-type-imports'
148-
}
149+
fixStyle: 'separate-type-imports',
150+
},
149151
],
150152

151153
'@typescript-eslint/no-floating-promises': 'warn',
@@ -155,55 +157,55 @@ const config = tseslint.config(
155157
{
156158
varsIgnorePattern: '^_',
157159
argsIgnorePattern: '^_',
158-
caughtErrorsIgnorePattern: '^_'
159-
}
160+
caughtErrorsIgnorePattern: '^_',
161+
},
160162
],
161163

162164
'import/named': 'off',
163165
'import/namespace': 'off',
164166
'import/default': 'off',
165-
'import/no-named-as-default-member': 'off'
166-
}
167+
'import/no-named-as-default-member': 'off',
168+
},
167169
},
168170
{
169171
files: ['**/*.mjs'],
170-
...tseslint.configs.disableTypeChecked
172+
...tseslint.configs.disableTypeChecked,
171173
},
172174
{
173175
files: [
174176
'packages/main/src/webComponents/*/index.tsx',
175177
'packages/compat/src/components/TableCell/index.tsx',
176-
'packages/compat/src/components/TableGroupRow/index.tsx'
178+
'packages/compat/src/components/TableGroupRow/index.tsx',
177179
],
178180

179181
rules: {
180-
'@typescript-eslint/no-empty-object-type': 'off'
181-
}
182+
'@typescript-eslint/no-empty-object-type': 'off',
183+
},
182184
},
183185
{
184186
files: [
185187
'packages/main/src/components/AnalyticalTable/defaults/**/*.tsx',
186188
'packages/main/src/components/AnalyticalTable/hooks/*.ts',
187189
'packages/main/src/components/AnalyticalTable/hooks/*.tsx',
188-
'packages/main/src/components/AnalyticalTable/TableBody/VirtualTableBodyContainer.tsx'
190+
'packages/main/src/components/AnalyticalTable/TableBody/VirtualTableBodyContainer.tsx',
189191
],
190192

191193
rules: {
192-
'react/prop-types': 'off'
193-
}
194+
'react/prop-types': 'off',
195+
},
194196
},
195197
{
196198
files: ['cypress/**/*'],
197199

198200
rules: {
199-
'@typescript-eslint/no-namespace': 'off'
200-
}
201+
'@typescript-eslint/no-namespace': 'off',
202+
},
201203
},
202204
{
203205
files: ['**/*.cy.ts', '**/*.cy.tsx'],
204206

205207
plugins: {
206-
'no-only-tests': noOnlyTests
208+
'no-only-tests': noOnlyTests,
207209
},
208210

209211
rules: {
@@ -212,8 +214,8 @@ const config = tseslint.config(
212214
'react/no-unescaped-entities': 'off',
213215
'@typescript-eslint/unbound-method': 'warn',
214216
'react/display-name': 'off',
215-
'no-only-tests/no-only-tests': 'error'
216-
}
217+
'no-only-tests/no-only-tests': 'error',
218+
},
217219
},
218220

219221
// Storybook
@@ -223,8 +225,8 @@ const config = tseslint.config(
223225
rules: {
224226
'react/prop-types': 'off',
225227
'@typescript-eslint/no-unused-vars': 'warn',
226-
'react/no-unescaped-entities': 'off'
227-
}
228+
'react/no-unescaped-entities': 'off',
229+
},
228230
},
229231

230232
// no-restricted-imports rule for compat package
@@ -238,16 +240,16 @@ const config = tseslint.config(
238240
{
239241
name: '@ui5/webcomponents-react',
240242
message:
241-
"Please use deep imports from @ui5/webcomponents-react. Example: import { Button } from '@ui5/webcomponents-react/dist/webComponents/Button/index.js';"
242-
}
243-
]
244-
}
245-
]
246-
}
243+
"Please use deep imports from @ui5/webcomponents-react. Example: import { Button } from '@ui5/webcomponents-react/dist/webComponents/Button/index.js';",
244+
},
245+
],
246+
},
247+
],
248+
},
247249
},
248250

249251
// prettier plugin must be the last entry in the config!
250-
prettierPlugin
252+
prettierPlugin,
251253
);
252254

253255
export default config;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"test": "yarn test:prepare && cypress run --component --browser chrome",
1919
"clean": "tsc --build --clean && tsc --build tsconfig.build.json --clean && rimraf temp .out && lerna run clean",
2020
"clean:remove-modules": "yarn clean && rimraf node_modules",
21-
"prettier:all": "prettier --write --config ./prettier.config.cjs \"packages/**/*.{js,jsx,ts,tsx,mdx,json,md}\"",
21+
"prettier:all": "prettier --write --config ./prettier.config.js \"packages/**/*.{js,jsx,ts,tsx,mdx,json,md,mjs,cjs}\"",
2222
"lint": "eslint packages",
2323
"lerna:version-dryrun": "lerna version --conventional-graduate --no-git-tag-version --no-push",
2424
"wrappers:main": "node packages/cli/dist/bin/index.js create-wrappers --packageName @ui5/webcomponents --out ./packages/main/src/webComponents --additionalComponentNote 'This is a UI5 Web Component! [Repository](https://github.com/SAP/ui5-webcomponents) | [Documentation](https://sap.github.io/ui5-webcomponents/)'",

packages/ai/src/components/Button/Button.stories.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ const meta = {
1414
title: 'Button',
1515
component: Button,
1616
argTypes: {
17-
children: { control: 'text' }
17+
children: { control: 'text' },
1818
},
1919
args: {
20-
design: ButtonDesign.Default
20+
design: ButtonDesign.Default,
2121
},
22-
tags: ['package:@ui5/webcomponents-ai']
22+
tags: ['package:@ui5/webcomponents-ai'],
2323
} satisfies Meta<typeof Button>;
2424

2525
export default meta;
@@ -106,5 +106,5 @@ export const Default: Story = {
106106
)}
107107
</>
108108
);
109-
}
109+
},
110110
};

packages/ai/src/components/Button/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ const Button = withWebComponent<ButtonPropTypes, ButtonDomRef>(
100100
['design', 'state'],
101101
['arrowButtonPressed', 'disabled'],
102102
[],
103-
['arrow-button-click', 'click']
103+
['arrow-button-click', 'click'],
104104
);
105105

106106
Button.displayName = 'Button';

packages/ai/src/components/ButtonState/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ const ButtonState = withWebComponent<ButtonStatePropTypes, ButtonStateDomRef>(
7373
['endIcon', 'icon', 'name', 'text'],
7474
['showArrowButton'],
7575
[],
76-
[]
76+
[],
7777
);
7878

7979
ButtonState.displayName = 'ButtonState';

packages/ai/src/components/PromptInput/PromptInput.stories.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ const meta = {
77
component: PromptInput,
88
argTypes: {
99
children: { control: { disable: true } },
10-
valueStateMessage: { control: { disable: true } }
10+
valueStateMessage: { control: { disable: true } },
1111
},
1212
args: {
13-
valueState: ValueState.None
13+
valueState: ValueState.None,
1414
},
15-
tags: ['package:@ui5/webcomponents-ai']
15+
tags: ['package:@ui5/webcomponents-ai'],
1616
} satisfies Meta<typeof PromptInput>;
1717

1818
export default meta;

packages/ai/src/components/PromptInput/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ const PromptInput = withWebComponent<PromptInputPropTypes, PromptInputDomRef>(
185185
['label', 'maxlength', 'placeholder', 'value', 'valueState'],
186186
['disabled', 'readonly', 'showClearIcon', 'showExceededText', 'showSuggestions'],
187187
['valueStateMessage'],
188-
['change', 'input', 'submit']
188+
['change', 'input', 'submit'],
189189
);
190190

191191
PromptInput.displayName = 'PromptInput';

packages/base/src/Device/Media.cy.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ describe('Device - Media', () => {
77
expect(getCurrentRange()).to.deep.equal({
88
from: 1440,
99
name: 'LargeDesktop',
10-
unit: 'px'
10+
unit: 'px',
1111
});
1212
});
1313

@@ -16,7 +16,7 @@ describe('Device - Media', () => {
1616
from: 0,
1717
name: 'Phone',
1818
to: 599,
19-
unit: 'px'
19+
unit: 'px',
2020
});
2121
});
2222

packages/base/src/Device/Media.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ const RANGE_DEFINITIONS: Record<RANGE_4_STEPS, [number, number]> = {
1010
S: [0, 599],
1111
M: [600, 1023],
1212
L: [1024, 1439],
13-
XL: [1440, -1]
13+
XL: [1440, -1],
1414
};
1515

1616
const newRangeToLegacyRangeMap: Record<RANGE_4_STEPS, RANGE_LEGACY_4_STEPS> = {
1717
S: 'Phone',
1818
M: 'Tablet',
1919
L: 'Desktop',
20-
XL: 'LargeDesktop'
20+
XL: 'LargeDesktop',
2121
};
2222

2323
function getQuery(from: number, to: number) {
@@ -35,7 +35,7 @@ function resolveRangeInfo(name: RANGE_4_STEPS): RangeInfo {
3535
const params: RangeInfo = {
3636
from: RANGE_DEFINITIONS[name][0],
3737
name: newRangeToLegacyRangeMap[name],
38-
unit: 'px'
38+
unit: 'px',
3939
};
4040
if (RANGE_DEFINITIONS[name][1] > 0) {
4141
params.to = RANGE_DEFINITIONS[name][1];
@@ -51,7 +51,7 @@ function initMediaQueries() {
5151
S: window.matchMedia(getQuery(...RANGE_DEFINITIONS.S)),
5252
M: window.matchMedia(getQuery(...RANGE_DEFINITIONS.M)),
5353
L: window.matchMedia(getQuery(...RANGE_DEFINITIONS.L)),
54-
XL: window.matchMedia(getQuery(...RANGE_DEFINITIONS.XL))
54+
XL: window.matchMedia(getQuery(...RANGE_DEFINITIONS.XL)),
5555
};
5656

5757
for (const mediaQueriesKey in mediaQueries) {
@@ -74,7 +74,7 @@ export const getCurrentRange = (width?: number): RangeInfo => {
7474
from: 1024,
7575
to: 1439,
7676
name: 'Desktop',
77-
unit: 'px'
77+
unit: 'px',
7878
};
7979
}
8080
// @ts-expect-error: width can only be undefined or a number, therefore `isNaN` works here

0 commit comments

Comments
 (0)