Skip to content

Commit 108ff6d

Browse files
Merge pull request #13 from wimpyprogrammer/feature/upgrade-dependencies
Upgrade all dependencies to latest
2 parents 50f5dfb + 0863a2a commit 108ff6d

34 files changed

+164
-420
lines changed

.eslintrc.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
"plugin:jest/recommended",
66
"plugin:@typescript-eslint/eslint-recommended",
77
"plugin:@typescript-eslint/recommended",
8-
"prettier",
9-
"prettier/@typescript-eslint"
8+
"prettier"
109
],
1110
"parserOptions": {
12-
"ecmaVersion": 2018
11+
"ecmaVersion": 2018,
12+
"project": ["./**/tsconfig.json", "./**/tsconfig.test.json"]
1313
},
1414
"rules": {
1515
"import/extensions": [
@@ -22,7 +22,7 @@
2222
"import/no-extraneous-dependencies": [
2323
"error",
2424
{
25-
"devDependencies": ["**/*.spec.{js,ts}", "**/jest.config.js"]
25+
"devDependencies": ["**/*.spec.{js,ts}", "**/*.config.js"]
2626
}
2727
],
2828
"import/no-unresolved": [
@@ -49,7 +49,8 @@
4949
"LabeledStatement",
5050
"WithStatement"
5151
],
52-
"@typescript-eslint/explicit-function-return-type": "off"
52+
"@typescript-eslint/explicit-function-return-type": "off",
53+
"@typescript-eslint/explicit-module-boundary-types": "off"
5354
},
5455
"settings": {
5556
"import/parsers": {

demo/src/components/demo-form.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ export default class DemoForm {
2727
protected $errorContainer: HTMLDivElement;
2828
protected $errorMessage: HTMLPreElement;
2929

30+
// eslint-disable-next-line @typescript-eslint/no-empty-function
3031
public onSubmit: () => void = () => {};
32+
// eslint-disable-next-line @typescript-eslint/no-empty-function
3133
public onCancel: () => void = () => {};
3234

3335
private onInputKeydown(event: KeyboardEvent): boolean {

demo/src/components/demo-output.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ export default class DemoOutput {
3232

3333
if (isBlockOutput) {
3434
this.$expansions.innerHTML = expansions
35-
.map(string => `<div class="alert alert-light">${escape(string)}</div>`)
35+
.map((value) => `<div class="alert alert-light">${escape(value)}</div>`)
3636
.join('\n');
3737
} else {
3838
this.$expansions.innerHTML = expansions
39-
.map(string => `<span>${escape(string)}</span>`)
39+
.map((value) => `<span>${escape(value)}</span>`)
4040
.join(delimiter);
4141
}
4242

demo/src/demo.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
isCountResult,
1212
isExpandResult,
1313
} from './worker/messages';
14-
// @ts-ignore Ignore lack of default export. This is handled by worker-loader.
14+
// @ts-expect-error Ignore lack of default export. This is handled by worker-loader.
1515
import DemoWorker from './worker';
1616

1717
import './demo.scss';
@@ -97,7 +97,7 @@ $form.onCancel = () => {
9797
hideWaitingState();
9898
};
9999

100-
UrlStorage.onChange(newData => {
100+
UrlStorage.onChange((newData) => {
101101
$form.populate(newData);
102102
if (!$form.validate()) return;
103103

demo/src/utils/auto-expand-field.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
/* eslint no-param-reassign: ["error", { "props": true, "ignorePropertyModificationsFor": ["field"] }] */
22
import './auto-expand-field.scss';
33

4+
type anyFn = (...args: unknown[]) => void;
5+
46
/* eslint-disable @typescript-eslint/no-explicit-any */
57
/**
68
* @see https://gist.github.com/fr-ser/ded7690b245223094cd876069456ed6c
79
*/
8-
function debounce<F extends Function>(func: F, wait: number): F {
10+
function debounce<F extends anyFn>(func: F, wait: number): F {
911
let timeoutID: number;
1012

1113
return (function debounced(this: any, ...args: any[]) {
1214
clearTimeout(timeoutID);
13-
const context = this;
14-
15-
timeoutID = window.setTimeout(() => func.apply(context, args), wait);
15+
timeoutID = window.setTimeout(() => func.apply(this, args), wait);
1616
} as any) as F;
1717
}
1818
/* eslint-enable @typescript-eslint/no-explicit-any */

demo/src/utils/dom.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
export function getElement<T extends Element>(selector: string) {
2-
return document.querySelector(selector) as T;
1+
export function getElement<T extends Element>(selector: string): T {
2+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
3+
return document.querySelector(selector)!;
34
}

demo/src/utils/url-storage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export function write(data: FormInput) {
5656
* @param fn The function to run and receive the new data
5757
*/
5858
export function onChange(fn: (newData: StoredInput) => void) {
59-
return history.listen(location => {
59+
return history.listen((location) => {
6060
const newData = parse(location);
6161
fn(newData);
6262
});

demo/src/worker/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
isExpandRequest,
1010
OptimizeResult,
1111
} from './messages';
12-
import { expand, toRegExp } from '../../../src/index';
12+
import { expand, toRegExp } from '../../../src';
1313

1414
function assertNeverRequest(x: never): never {
1515
throw new TypeError(`Unexpected message: ${x}`);

demo/src/worker/messages.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
/* eslint-disable no-empty-function, no-useless-constructor, @typescript-eslint/no-parameter-properties */
2-
import { expand } from '../../../src/index';
1+
/* eslint-disable max-classes-per-file, no-useless-constructor */
2+
import { expand } from '../../../src';
33

44
interface WorkerMessage {
55
readonly kind: string;

demo/src/worker/polyfills.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const featuresToPolyfill = [
1313
'es.symbol.iterator',
1414
].join(',');
1515

16-
// @ts-ignore worker-specific function that is unrecognized
16+
// @ts-expect-error worker-specific function that is unrecognized
1717
importScripts(
1818
`https://polyfill.app/api/polyfill?features=${featuresToPolyfill}&context=worker`
1919
);

0 commit comments

Comments
 (0)