Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(lint): lint ts types using CI #2956

Merged
merged 6 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,20 @@ module.exports = {
globals: {
jQuery: true,
},
overrides: [{
files: ['**/*.ts'],
parser: '@typescript-eslint/parser',
extends: [
'plugin:@typescript-eslint/recommended',
],
rules: {
// https://typescript-eslint.io/rules/no-use-before-define#how-to-use
'no-use-before-define': 'off',

// TODO rules with a lot of errors to be fixed manually, fix in a separate PR
'@typescript-eslint/ban-types': 'off', // 16 eslint errors only, help wanted!
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/triple-slash-reference': 'off',
},
}],
};
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
"scripts": {
"build": "gulp build",
"changelog": "auto-changelog -p",
"lint": "eslint --ext .js . && stylelint \"**/*.{css,less,overrides,variables}\"",
"lint-fix": "eslint --ext .js . --fix && stylelint \"**/*.{css,less,overrides,variables}\" --fix"
"lint": "eslint --ext .js,.ts . && stylelint \"**/*.{css,less,overrides,variables}\"",
"lint-fix": "eslint --ext .js,.ts . --fix && stylelint \"**/*.{css,less,overrides,variables}\" --fix"
},
"dependencies": {
"@actions/core": "^1.6.0",
Expand Down
2 changes: 1 addition & 1 deletion types/fomantic-ui-accordion.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ declare namespace FomanticUI {
(behavior: 'toggle', index: number): JQuery;

(behavior: 'destroy'): JQuery;
<K extends keyof AccordionSettings>(behavior: 'setting', name: K, value?: undefined, ): Partial<Pick<AccordionSettings, keyof AccordionSettings>>;
<K extends keyof AccordionSettings>(behavior: 'setting', name: K, value?: undefined,): Partial<Pick<AccordionSettings, keyof AccordionSettings>>;
<K extends keyof AccordionSettings>(behavior: 'setting', name: K, value: AccordionSettings[K]): JQuery;
(behavior: 'setting', value: Partial<Pick<AccordionSettings, keyof AccordionSettings>>): JQuery;
(settings?: Partial<Pick<AccordionSettings, keyof AccordionSettings>>): JQuery;
Expand Down
2 changes: 1 addition & 1 deletion types/fomantic-ui-api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ declare namespace FomanticUI {
*/
(behavior: 'destroy'): JQuery;

<K extends keyof APISettings | JQueryAjaxSettings>(behavior: 'setting', name: K, value?: undefined, ): Partial<Pick<APISettings, keyof APISettings>> | Partial<Pick<JQueryAjaxSettings, keyof JQueryAjaxSettings>>;
<K extends keyof APISettings | JQueryAjaxSettings>(behavior: 'setting', name: K, value?: undefined,): Partial<Pick<APISettings, keyof APISettings>> | Partial<Pick<JQueryAjaxSettings, keyof JQueryAjaxSettings>>;
<K extends keyof APISettings>(behavior: 'setting', name: K, value: APISettings[K]): JQuery;
(behavior: 'setting', value: Partial<Pick<APISettings, keyof APISettings>> | Partial<Pick<JQueryAjaxSettings, keyof JQueryAjaxSettings>>): JQuery;
(settings?: Partial<Pick<APISettings, keyof APISettings>> | Partial<Pick<JQueryAjaxSettings, keyof JQueryAjaxSettings>>): JQuery;
Expand Down
8 changes: 4 additions & 4 deletions types/fomantic-ui-calendar.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ declare namespace FomanticUI {

interface Formatters {
/**
*
*
*/
yearHeader(date: Date, settings?: CalendarSettings): string;

Expand Down Expand Up @@ -580,14 +580,14 @@ declare namespace FomanticUI {
* @default 'YYYY'
*/
year: string;

/**
*
*
*/
today(settings: CalendarSettings): string;

/**
*
*
*/
cell(cell: string, date: Date, cellOptions: any): any
}
Expand Down
2 changes: 1 addition & 1 deletion types/fomantic-ui-dimmer.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ declare namespace FomanticUI {
(behavior: 'set disabled'): JQuery;

(behavior: 'destroy'): JQuery;
<K extends keyof DimmerSettings>(behavior: 'setting', name: K, value?: undefined, ): Partial<Pick<DimmerSettings, keyof DimmerSettings>>;
<K extends keyof DimmerSettings>(behavior: 'setting', name: K, value?: undefined,): Partial<Pick<DimmerSettings, keyof DimmerSettings>>;
<K extends keyof DimmerSettings>(behavior: 'setting', name: K, value: DimmerSettings[K]): JQuery;
(behavior: 'setting', value: Partial<Pick<DimmerSettings, keyof DimmerSettings>>): JQuery;
(settings?: Partial<Pick<DimmerSettings, keyof DimmerSettings>>): JQuery;
Expand Down
36 changes: 18 additions & 18 deletions types/fomantic-ui-dropdown.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ declare namespace FomanticUI {
(behavior: 'get placeholder text'): string;

(behavior: 'destroy'): JQuery;
<K extends keyof DropdownSettings>(behavior: 'setting', name: K, value?: undefined, ): Partial<Pick<DropdownSettings, keyof DropdownSettings>>;
<K extends keyof DropdownSettings>(behavior: 'setting', name: K, value?: undefined,): Partial<Pick<DropdownSettings, keyof DropdownSettings>>;
<K extends keyof DropdownSettings>(behavior: 'setting', name: K, value: DropdownSettings[K]): JQuery;
(behavior: 'setting', value: Partial<Pick<DropdownSettings, keyof DropdownSettings>>): JQuery;
(settings?: Partial<Pick<DropdownSettings, keyof DropdownSettings>>): JQuery;
Expand Down Expand Up @@ -345,7 +345,7 @@ declare namespace FomanticUI {
*
* @default 'auto'
*/
placeholder: 'auto' | String | false;
placeholder: 'auto' | string | false;

/**
* Whether HTML included in dropdown values should be preserved.
Expand Down Expand Up @@ -577,22 +577,22 @@ declare namespace FomanticUI {
message: Dropdown.MessageSettings;

/**
*
*
*/
regExp: Dropdown.RegExpSettings;

/**
*
*
*/
metadata: Dropdown.MetadataSettings;

/**
*
*
*/
fields: Dropdown.FieldsSettings;

/**
*
*
*/
keys: Dropdown.KeysSettings;

Expand Down Expand Up @@ -738,7 +738,7 @@ declare namespace FomanticUI {
*/
clearIcon: string;
}

interface ClassNames {
/**
* @default 'active'
Expand Down Expand Up @@ -915,7 +915,7 @@ declare namespace FomanticUI {
*/
actionable: string;
}

interface Messages {
/**
* @default 'Add <b>{term}</b>'
Expand Down Expand Up @@ -947,9 +947,9 @@ declare namespace FomanticUI {
/**
* @default '/[-[\]{}()*+?.,\\^$|#\s]/g'
*/
escape: string;
escape: string;
}

interface Metadatas {
/**
* @default 'defaultText'
Expand All @@ -959,24 +959,24 @@ declare namespace FomanticUI {
/**
* @default 'defaultValue'
*/
defaultValue: string;
defaultValue: string;

/**
* @default 'placeholderText'
*/
placeholderText: string;
placeholderText: string;

/**
* @default 'text'
*/
text: string;
text: string;

/**
* @default 'value'
*/
value: string;
value: string;
}

interface Fields {
/**
* Grouping for api results
Expand All @@ -988,13 +988,13 @@ declare namespace FomanticUI {
* Grouping for all dropdown values
* @default 'values'
*/
values: string;
values: string;

/**
* Whether value should be disabled
* @default 'disabled'
*/
disabled: string;
disabled: string;

/**
* Displayed dropdown text
Expand Down Expand Up @@ -1074,7 +1074,7 @@ declare namespace FomanticUI {
*/
actionable: string;
}

interface Keys {
/**
* @default 8
Expand Down
2 changes: 1 addition & 1 deletion types/fomantic-ui-embed.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ declare namespace FomanticUI {
*/
(behavior: 'destroy'): JQuery;

<K extends keyof EmbedSettings>(behavior: 'setting', name: K, value?: undefined, ): Partial<Pick<EmbedSettings, keyof EmbedSettings>>;
<K extends keyof EmbedSettings>(behavior: 'setting', name: K, value?: undefined,): Partial<Pick<EmbedSettings, keyof EmbedSettings>>;
<K extends keyof EmbedSettings>(behavior: 'setting', name: K, value: EmbedSettings[K]): JQuery;
(behavior: 'setting', value: Partial<Pick<EmbedSettings, keyof EmbedSettings>>): JQuery;
(settings?: Partial<Pick<EmbedSettings, keyof EmbedSettings>>): JQuery;
Expand Down
6 changes: 3 additions & 3 deletions types/fomantic-ui-flyout.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ declare namespace FomanticUI {
(behavior: keyof Flyout.TemplatesSettings, ...args: any): Partial<Pick<FlyoutSettings, keyof FlyoutSettings>>;

(behavior: 'destroy'): JQuery;
<K extends keyof FlyoutSettings>(behavior: 'setting', name: K, value?: undefined, ): Partial<Pick<FlyoutSettings, keyof FlyoutSettings>>;
<K extends keyof FlyoutSettings>(behavior: 'setting', name: K, value?: undefined,): Partial<Pick<FlyoutSettings, keyof FlyoutSettings>>;
<K extends keyof FlyoutSettings>(behavior: 'setting', name: K, value: FlyoutSettings[K]): JQuery;
(behavior: 'setting', value: Partial<Pick<FlyoutSettings, keyof FlyoutSettings>>): JQuery;
(settings?: Partial<Pick<FlyoutSettings, keyof FlyoutSettings>>): JQuery;
Expand Down Expand Up @@ -372,7 +372,7 @@ declare namespace FomanticUI {
*/
deny: string;
}

interface ClassNames {
/**
* @default 'ui flyout'
Expand Down Expand Up @@ -489,7 +489,7 @@ declare namespace FomanticUI {
*/
prompt: string;
}

interface RegExps {
/**
* @default /(iPad|iPhone|iPod)/g
Expand Down
2 changes: 1 addition & 1 deletion types/fomantic-ui-form.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ declare namespace FomanticUI {
* Destroys instance and removes all events.
*/
(behavior: 'destroy'): JQuery;
<K extends keyof FormSettings>(behavior: 'setting', name: K, value?: undefined, ): Partial<Pick<FormSettings, keyof FormSettings>>;
<K extends keyof FormSettings>(behavior: 'setting', name: K, value?: undefined,): Partial<Pick<FormSettings, keyof FormSettings>>;
<K extends keyof FormSettings>(behavior: 'setting', name: K, value: FormSettings[K]): JQuery;
(behavior: 'setting', value: Partial<Pick<FormSettings, keyof FormSettings>>): JQuery;
(settings?: Partial<Pick<FormSettings, keyof FormSettings>>): JQuery;
Expand Down
6 changes: 3 additions & 3 deletions types/fomantic-ui-modal.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ declare namespace FomanticUI {
(behavior: keyof Modal.TemplatesSettings, ...args: any): Partial<Pick<ModalSettings, keyof ModalSettings>>;

(behavior: 'destroy'): JQuery;
<K extends keyof ModalSettings>(behavior: 'setting', name: K, value?: undefined, ): Partial<Pick<ModalSettings, keyof ModalSettings>>;
<K extends keyof ModalSettings>(behavior: 'setting', name: K, value?: undefined,): Partial<Pick<ModalSettings, keyof ModalSettings>>;
<K extends keyof ModalSettings>(behavior: 'setting', name: K, value: ModalSettings[K]): JQuery;
(behavior: 'setting', value: Partial<Pick<ModalSettings, keyof ModalSettings>>): JQuery;
(settings?: Partial<Pick<ModalSettings, keyof ModalSettings>>): JQuery;
Expand Down Expand Up @@ -244,13 +244,13 @@ declare namespace FomanticUI {
closeIcon: boolean;

/**
*
*
* @default false
*/
actions: any;

/**
*
*
* @default true
*/
preserveHTML: boolean;
Expand Down
6 changes: 3 additions & 3 deletions types/fomantic-ui-nag.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ declare namespace FomanticUI {
(behavior: 'clear'): JQuery;

(behavior: 'destroy'): JQuery;
<K extends keyof NagSettings>(behavior: 'setting', name: K, value?: undefined, ): Partial<Pick<NagSettings, keyof NagSettings>>;
<K extends keyof NagSettings>(behavior: 'setting', name: K, value?: undefined,): Partial<Pick<NagSettings, keyof NagSettings>>;
<K extends keyof NagSettings>(behavior: 'setting', name: K, value: NagSettings[K]): JQuery;
(behavior: 'setting', value: Partial<Pick<NagSettings, keyof NagSettings>>): JQuery;
(settings?: Partial<Pick<NagSettings, keyof NagSettings>>): JQuery;
Expand Down Expand Up @@ -231,7 +231,7 @@ declare namespace FomanticUI {
*/
close: string;
}

interface ClassNames {
/**
* @default 'bottom'
Expand All @@ -243,7 +243,7 @@ declare namespace FomanticUI {
*/
fixed: string;
}

interface Errors {
/**
* @default 'Unsupported storage method'
Expand Down
6 changes: 3 additions & 3 deletions types/fomantic-ui-popup.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ declare namespace FomanticUI {
*/
(behavior: 'destroy'): JQuery;

<K extends keyof PopupSettings>(behavior: 'setting', name: K, value?: undefined, ): Partial<Pick<PopupSettings, keyof PopupSettings>>;
<K extends keyof PopupSettings>(behavior: 'setting', name: K, value?: undefined,): Partial<Pick<PopupSettings, keyof PopupSettings>>;
<K extends keyof PopupSettings>(behavior: 'setting', name: K, value: PopupSettings[K]): JQuery;
(behavior: 'setting', value: Partial<Pick<PopupSettings, keyof PopupSettings>>): JQuery;
(settings?: Partial<Pick<PopupSettings, keyof PopupSettings>>): JQuery;
Expand Down Expand Up @@ -402,7 +402,7 @@ declare namespace FomanticUI {
*/
popup: string;
}

interface Metadatas {
/**
* @default 'activator'
Expand Down Expand Up @@ -439,7 +439,7 @@ declare namespace FomanticUI {
*/
variation: string;
}

interface ClassNames {
/**
* @default 'active'
Expand Down
12 changes: 6 additions & 6 deletions types/fomantic-ui-progress.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ declare namespace FomanticUI {
*/
(behavior: 'destroy'): JQuery;

<K extends keyof ProgressSettings>(behavior: 'setting', name: K, value?: undefined, ): Partial<Pick<ProgressSettings, keyof ProgressSettings>>;
<K extends keyof ProgressSettings>(behavior: 'setting', name: K, value?: undefined,): Partial<Pick<ProgressSettings, keyof ProgressSettings>>;
<K extends keyof ProgressSettings>(behavior: 'setting', name: K, value: ProgressSettings[K]): JQuery;
(behavior: 'setting', value: Partial<Pick<ProgressSettings, keyof ProgressSettings>>): JQuery;
(settings?: Partial<Pick<ProgressSettings, keyof ProgressSettings>>): JQuery;
Expand Down Expand Up @@ -355,7 +355,7 @@ declare namespace FomanticUI {
*/
progress: string;
}

interface ClassNames {
/**
* @default 'active'
Expand All @@ -377,7 +377,7 @@ declare namespace FomanticUI {
*/
warning: string;
}

interface Texts {
/**
* @default false
Expand Down Expand Up @@ -414,14 +414,14 @@ declare namespace FomanticUI {
*/
bars: string[];
}

interface RegExps {
/**
* @default /\{\$*[A-z0-9]+\}/g
*/
variable: RegExp;
}

interface Metadatas {
/**
* @default 'percent'
Expand All @@ -438,7 +438,7 @@ declare namespace FomanticUI {
*/
value: string;
}

interface Errors {
/**
* @default 'The method you called is not defined.'
Expand Down
Loading