mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
refactor: Enforce no-explicit-any
in design-system
(no-changelog) (#4937)
👕 Enforce `no-explicit-any` in design-system
This commit is contained in:
parent
4208040495
commit
d7b3d649d6
packages/design-system
|
@ -14,7 +14,6 @@ module.exports = {
|
||||||
// TODO: Remove these
|
// TODO: Remove these
|
||||||
'import/no-default-export': 'off',
|
'import/no-default-export': 'off',
|
||||||
'import/order': 'off',
|
'import/order': 'off',
|
||||||
'@typescript-eslint/no-explicit-any': 'warn',
|
|
||||||
'@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',
|
||||||
|
|
|
@ -75,12 +75,12 @@ import N8nInputLabel from '../N8nInputLabel';
|
||||||
import N8nCheckbox from '../N8nCheckbox';
|
import N8nCheckbox from '../N8nCheckbox';
|
||||||
|
|
||||||
import { getValidationError, VALIDATORS } from './validators';
|
import { getValidationError, VALIDATORS } from './validators';
|
||||||
import { Rule, RuleGroup, IValidator } from '../../types';
|
import { Rule, RuleGroup, IValidator, Validatable, FormState } from '../../types';
|
||||||
|
|
||||||
import { t } from '../../locale';
|
import { t } from '../../locale';
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
value: any;
|
value: Validatable;
|
||||||
label: string;
|
label: string;
|
||||||
infoText?: string;
|
infoText?: string;
|
||||||
required?: boolean;
|
required?: boolean;
|
||||||
|
@ -112,7 +112,7 @@ const props = withDefaults(defineProps<Props>(), {
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(event: 'validate', shouldValidate: boolean): void;
|
(event: 'validate', shouldValidate: boolean): void;
|
||||||
(event: 'input', value: any): void;
|
(event: 'input', value: unknown): void;
|
||||||
(event: 'focus'): void;
|
(event: 'focus'): void;
|
||||||
(event: 'blur'): void;
|
(event: 'blur'): void;
|
||||||
(event: 'enter'): void;
|
(event: 'enter'): void;
|
||||||
|
@ -169,7 +169,7 @@ function onBlur() {
|
||||||
emit('blur');
|
emit('blur');
|
||||||
}
|
}
|
||||||
|
|
||||||
function onInput(value: any) {
|
function onInput(value: FormState) {
|
||||||
state.isTyping = true;
|
state.isTyping = true;
|
||||||
emit('input', value);
|
emit('input', value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ export default Vue.extend({
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
showValidationWarnings: false,
|
showValidationWarnings: false,
|
||||||
values: {} as { [key: string]: any },
|
values: {} as { [key: string]: unknown },
|
||||||
validity: {} as { [key: string]: boolean },
|
validity: {} as { [key: string]: boolean },
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
@ -89,7 +89,7 @@ export default Vue.extend({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onInput(name: string, value: any) {
|
onInput(name: string, value: unknown) {
|
||||||
this.values = {
|
this.values = {
|
||||||
...this.values,
|
...this.values,
|
||||||
[name]: value, // eslint-disable-line @typescript-eslint/no-unsafe-assignment
|
[name]: value, // eslint-disable-line @typescript-eslint/no-unsafe-assignment
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
export type Rule = { name: string; config?: any };
|
export type Rule = { name: string; config?: unknown };
|
||||||
|
|
||||||
export type RuleGroup = {
|
export type RuleGroup = {
|
||||||
rules: Array<Rule | RuleGroup>;
|
rules: Array<Rule | RuleGroup>;
|
||||||
defaultError?: { messageKey: string; options?: any };
|
defaultError?: { messageKey: string; options?: unknown };
|
||||||
};
|
};
|
||||||
|
|
||||||
export type Validatable = string | number | boolean | null | undefined;
|
export type Validatable = string | number | boolean | null | undefined;
|
||||||
|
@ -10,8 +10,13 @@ export type Validatable = string | number | boolean | null | undefined;
|
||||||
export type IValidator = {
|
export type IValidator = {
|
||||||
validate: (
|
validate: (
|
||||||
value: Validatable,
|
value: Validatable,
|
||||||
config: any,
|
config: unknown,
|
||||||
) => false | { messageKey: string; options?: any } | null;
|
) => false | { messageKey: string; options?: unknown } | null;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type FormState = {
|
||||||
|
isTyping: boolean;
|
||||||
|
hasBlutted: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type IFormInput = {
|
export type IFormInput = {
|
||||||
|
|
Loading…
Reference in a new issue