fix: Fix storybook (no-changelog) (#4624)

since we migrated to vite, storybook/webpack aren't doing all the babel transforms. that's we we need to revert all optional-chaining and nullish-coalescing in design-system.

Hopefully this will be remedied after we move to vite for storybook.
This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™ 2022-11-16 16:35:02 +01:00 committed by GitHub
parent 423ee81e33
commit 58630e43c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 13 additions and 11 deletions

View file

@ -18,6 +18,8 @@ module.exports = {
'@typescript-eslint/no-unsafe-argument': 'warn', '@typescript-eslint/no-unsafe-argument': 'warn',
'@typescript-eslint/no-unsafe-return': 'warn', '@typescript-eslint/no-unsafe-return': 'warn',
'@typescript-eslint/no-unsafe-member-access': 'warn', '@typescript-eslint/no-unsafe-member-access': 'warn',
'@typescript-eslint/prefer-optional-chain': 'off',
'@typescript-eslint/prefer-nullish-coalescing': 'off',
}, },
overrides: [ overrides: [

View file

@ -128,10 +128,10 @@ const slots = useSlots();
const inputRef = ref<HTMLTextAreaElement | null>(null); const inputRef = ref<HTMLTextAreaElement | null>(null);
function getInputValidationError(): ReturnType<IValidator['validate']> { function getInputValidationError(): ReturnType<IValidator['validate']> {
const rules = props.validationRules ?? []; const rules = props.validationRules || [];
const validators = { const validators = {
...VALIDATORS, ...VALIDATORS,
...(props.validators ?? {}), ...(props.validators || {}),
} as { [key: string]: IValidator | RuleGroup }; } as { [key: string]: IValidator | RuleGroup };
if (props.required) { if (props.required) {

View file

@ -49,7 +49,7 @@ export const VALIDATORS: { [key: string]: IValidator | RuleGroup } = {
return false; return false;
} }
const numberCount = (value.match(/\d/g) ?? []).length; const numberCount = (value.match(/\d/g) || []).length;
if (numberCount < config.minimum) { if (numberCount < config.minimum) {
return { return {
messageKey: 'formInput.validator.numbersRequired', messageKey: 'formInput.validator.numbersRequired',
@ -77,7 +77,7 @@ export const VALIDATORS: { [key: string]: IValidator | RuleGroup } = {
return false; return false;
} }
const uppercaseCount = (value.match(/[A-Z]/g) ?? []).length; const uppercaseCount = (value.match(/[A-Z]/g) || []).length;
if (uppercaseCount < config.minimum) { if (uppercaseCount < config.minimum) {
return { return {
messageKey: 'formInput.validator.uppercaseCharsRequired', messageKey: 'formInput.validator.uppercaseCharsRequired',

View file

@ -104,7 +104,7 @@ export default Vue.extend({
const found = this.items.find((item) => { const found = this.items.find((item) => {
return ( return (
(Array.isArray(item.activateOnRouteNames) && (Array.isArray(item.activateOnRouteNames) &&
item.activateOnRouteNames.includes(this.$route.name ?? '')) || item.activateOnRouteNames.includes(this.$route.name || '')) ||
(Array.isArray(item.activateOnRoutePaths) && (Array.isArray(item.activateOnRoutePaths) &&
item.activateOnRoutePaths.includes(this.$route.path)) item.activateOnRoutePaths.includes(this.$route.path))
); );

View file

@ -134,7 +134,7 @@ export default Vue.extend({
} else if (item.activateOnRouteNames) { } else if (item.activateOnRouteNames) {
return ( return (
Array.isArray(item.activateOnRouteNames) && Array.isArray(item.activateOnRouteNames) &&
item.activateOnRouteNames.includes(this.$route.name ?? '') item.activateOnRouteNames.includes(this.$route.name || '')
); );
} }
return false; return false;

View file

@ -74,7 +74,7 @@ export default Vue.extend({
if (event.target.localName !== 'a') return; if (event.target.localName !== 'a') return;
if (event.target.dataset?.key) { if (event.target.dataset && event.target.dataset.key) {
event.stopPropagation(); event.stopPropagation();
event.preventDefault(); event.preventDefault();

View file

@ -82,13 +82,13 @@ export default mixins(Locale).extend({
}; };
}, },
computed: { computed: {
fitleredUsers(): IUser[] { filteredUsers(): IUser[] {
return (this.users as IUser[]).filter((user) => { return (this.users as IUser[]).filter((user) => {
if (user.isPendingUser || !user.email) { if (user.isPendingUser || !user.email) {
return false; return false;
} }
if (this.ignoreIds?.includes(user.id)) { if (this.ignoreIds && this.ignoreIds.includes(user.id)) {
return false; return false;
} }
@ -103,7 +103,7 @@ export default mixins(Locale).extend({
}); });
}, },
sortedUsers(): IUser[] { sortedUsers(): IUser[] {
return [...this.fitleredUsers].sort((a: IUser, b: IUser) => { return [...this.filteredUsers].sort((a: IUser, b: IUser) => {
if (a.lastName && b.lastName && a.lastName !== b.lastName) { if (a.lastName && b.lastName && a.lastName !== b.lastName) {
return a.lastName > b.lastName ? 1 : -1; return a.lastName > b.lastName ? 1 : -1;
} }

View file

@ -1,3 +1,3 @@
export function addTargetBlank(html: string) { export function addTargetBlank(html: string) {
return html?.includes('href=') ? html.replace(/href=/g, 'target="_blank" href=') : html; return html && html.includes('href=') ? html.replace(/href=/g, 'target="_blank" href=') : html;
} }