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