Skip to content

Commit ec2a3ac

Browse files
Robin Offeljschroeter
Robin Offel
authored andcommitted
FSR-64: bump @knime/eslint-config version to 9.0.0
FSR-64 (Update to Eslint 9)
1 parent 58fa384 commit ec2a3ac

File tree

25 files changed

+100
-177
lines changed

25 files changed

+100
-177
lines changed

Diff for: .changeset/sweet-mayflies-bow.md

-44
This file was deleted.

Diff for: eslint.config.js

+6
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,10 @@ export default [
1818
},
1919
},
2020
},
21+
{
22+
files: ["packages/lint/**/*.js"],
23+
rules: {
24+
"no-magic-numbers": "off",
25+
},
26+
},
2127
];

Diff for: packages/components/src/components/forms/NumberInput/NumberInput.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ export default {
204204
205205
/** Mimic stepping to nearest step with safe value rounding */
206206
let parsedVal = value + increment;
207-
parsedVal = Math.round(parsedVal * 10) / 10; // eslint-disable-line no-magic-numbers
207+
parsedVal = Math.round(parsedVal * 10) / 10;
208208
209209
/**
210210
* All measures have been taken to ensure a valid value at this point, so if the last

Diff for: packages/components/src/components/forms/SearchInput/SearchInput.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ export default {
9999
"toggle-inverse-search",
100100
"focus",
101101
],
102+
expose: ["focus"],
102103
data() {
103104
return {
104105
caseSensitiveSearch: this.initialCaseSensitiveSearch,
@@ -119,7 +120,6 @@ export default {
119120
return { ...defaultTooltips, ...this.tooltips };
120121
},
121122
},
122-
expose: ["focus"],
123123
async mounted() {
124124
if (this.focusOnMount) {
125125
await nextTick();

Diff for: packages/components/src/components/forms/TimePartInput/TimePartInput.vue

+1-3
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ export default {
152152
if (isNaN(value) || (!value && value !== 0) || value < 0) {
153153
return value;
154154
}
155-
// eslint-disable-next-line no-magic-numbers
156155
const strValue = value.toString(10);
157156
return this.minDigits < 1
158157
? strValue
@@ -175,7 +174,6 @@ export default {
175174
this.localValue = "";
176175
} else {
177176
// use parsed value and convert back to string to remove leading zeros etc.
178-
// eslint-disable-next-line no-magic-numbers
179177
const inputLength = inputNum.toString(10).length;
180178
// skip empty values (they become NaN which is 3 long)
181179
if (rawValue === "") {
@@ -235,7 +233,7 @@ export default {
235233
236234
/** Mimic stepping to nearest step with safe value rounding */
237235
let parsedVal = value + increment;
238-
parsedVal = Math.round(parsedVal * 10) / 10; // eslint-disable-line no-magic-numbers
236+
parsedVal = Math.round(parsedVal * 10) / 10;
239237
240238
/**
241239
* All measures have been taken to ensure a valid value at this point, so if the last

Diff for: packages/components/src/components/node/NodePreview.vue

-2
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,12 @@ export default {
8585
const portSize = 9;
8686
const bgSize = 32;
8787
88-
/* eslint-disable no-magic-numbers */
8988
let spacing = 1;
9089
if (total === 2) {
9190
spacing = 12;
9291
} else if (total === 3) {
9392
spacing = 1.5;
9493
}
95-
/* eslint-enable no-magic-numbers */
9694
9795
const totalHeight = total * portSize + (total - 1) * spacing;
9896
const delta = (bgSize - totalHeight) / 2;

Diff for: packages/components/src/components/node/PortIcon.vue

-2
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,8 @@ export default {
4949
];
5050
5151
// y and d are chosen so the triangle (including strokeWidth) fits precisely in the 9x9 port
52-
/* eslint-disable no-magic-numbers */
5352
const d = Math.sqrt(5) / 2;
5453
const y = d / 2 + 1 / 4;
55-
/* eslint-enable no-magic-numbers */
5654
5755
// move points towards the center of the triangle according to strokeWidth
5856
const { strokeWidth } = this;

Diff for: packages/hub-features/src/components/versions/ManageVersions.vue

-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ const labelsEventBus = useEventBus("versionLabels");
4242
4343
const closeLabelPopovers = throttle(() => {
4444
labelsEventBus.emit("versionLabelShowPopover");
45-
// eslint-disable-next-line no-magic-numbers
4645
}, 10000); // Arbitrary delay to reduce overhead, is automatically reset @scrollend
4746
</script>
4847

Diff for: packages/hub-features/src/useFileUpload/useFileUpload.ts

-1
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,6 @@ export const useFileUpload = (options: UseFileUploadOptions = {}) => {
277277
const uploadPayload = await promise.retryPromise({
278278
fn: () => prepareUpload(parentId, enqueableFiles),
279279
excludeError: (error: FetchError) =>
280-
// eslint-disable-next-line no-magic-numbers
281280
Boolean(error.statusCode && error.statusCode < 500),
282281
retryDelayMS: DEFAULT_RETRY_DELAY_MS,
283282
});

Diff for: packages/jsonforms/src/uiComponents/__tests__/IntegerControl.test.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ describe("IntegerControl.vue", () => {
6262
});
6363

6464
it("renders", () => {
65-
// @ts-expect-error Property 'exists' does not exist on type
66-
expect(wrapper.getComponent(NumberInput).exists()).toBe(true);
65+
expect(wrapper.findComponent(NumberInput).exists()).toBe(true);
6766
});
6867

6968
it("sets labelForId", () => {

Diff for: packages/jsonforms/src/uiComponents/__tests__/NumberControl.test.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ describe("NumberControl.vue", () => {
6666
});
6767

6868
it("renders", () => {
69-
// @ts-expect-error Property 'exists' does not exist on type
70-
expect(wrapper.getComponent(NumberInput).exists()).toBe(true);
69+
expect(wrapper.findComponent(NumberInput).exists()).toBe(true);
7170
});
7271

7372
it("sets labelForId", () => {

Diff for: packages/jsonforms/src/uiComponents/__tests__/OneOfDropdown.test.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ describe("OneOfDropdown.vue", () => {
5959
});
6060

6161
it("renders", () => {
62-
// @ts-expect-error Property 'exists' does not exist on type
63-
expect(wrapper.getComponent(Dropdown).exists()).toBe(true);
62+
expect(wrapper.findComponent(Dropdown).exists()).toBe(true);
6463
});
6564

6665
it("computed dropdown options from oneof options", async () => {

Diff for: packages/jsonforms/src/utils/localTimeUtils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export const fromString = (value: string): Date => {
3333
];
3434

3535
for (const format of otherFormats) {
36-
const parsed = parse(value, format, new Date(1970, 0, 1)); // eslint-disable-line no-magic-numbers
36+
const parsed = parse(value, format, new Date(1970, 0, 1));
3737
if (!isNaN(parsed.getTime())) {
3838
return parsed;
3939
}

Diff for: packages/licenses/src/collect-packages.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env node
22

33
/* eslint-disable no-console */
4-
/* eslint-disable import/extensions */
4+
55
import fs from "node:fs";
66
import { readFile } from "node:fs/promises";
77
import path from "path";

Diff for: packages/lint/CHANGELOG.md

+45
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,50 @@
11
# @knime/eslint-config
22

3+
## 9.0.0
4+
5+
### Major Changes
6+
7+
- 649f9b6: update to eslint 9 and migrate eslint configs to flat config format
8+
9+
- upgrade to eslint 9
10+
- update dependencies
11+
- migrate eslint configs to flat config and add names to each config object
12+
- use `eslint-plugin-import-x` instead of `eslint-plugin-import` (compatibility with nuxt3 ruleset)
13+
- remove configs for jest, vue2, nuxt2 and the legacy config
14+
- add `vue3-typescript-strict` config which enforces components to be written in TypeScript
15+
16+
Using this version will require you to also update to eslint 9.x.x and use the flat config format and write the configs as es modules.
17+
Extending a config form `@knime/eslint-config` looks something like this then:
18+
19+
```js
20+
import config from "@knime/eslint-config/<config>.js";
21+
22+
export default [
23+
...config,
24+
{
25+
// additional config
26+
},
27+
// additional configs
28+
];
29+
```
30+
31+
If you need to extend the files covered with the base config you will need to do it like this:
32+
33+
```js
34+
...config.map((conf) => {
35+
if (conf.name?.includes("@knime/eslint-config/<config>")) {
36+
return {
37+
...conf,
38+
files: [...conf.files, "*.ts", "*.tsx", "*.mts", "*.cts", "*.vue"],
39+
};
40+
}
41+
return conf;
42+
})
43+
```
44+
45+
All config objects we export have a name, so should any other configs need adjustment afterwards they can be found through the name and then be adjusted.
46+
The config objects are generally named after the config file with the "@knime/eslint-config/" prefix. Exceptions for this are the nuxt and vue-typescript configs as they use special helper functions to assemble the config that we couldn't pass a name to.
47+
348
## 8.3.0
449
550
### Minor Changes

Diff for: packages/lint/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@knime/eslint-config",
3-
"version": "8.3.0",
3+
"version": "9.0.0",
44
"description": "ESLint/Stylelint configs designed for typical KNIME frontend projects using JavaScript/TypeScript as well as Vue, Nuxt and Vitest.",
55
"type": "module",
66
"scripts": {
@@ -23,10 +23,10 @@
2323
"@nuxt/eslint-config": "^1.2.0",
2424
"@typescript-eslint/eslint-plugin": "^8.26.1",
2525
"@typescript-eslint/parser": "^8.26.1",
26-
"@typescript-eslint/utils": "^8.25.0",
27-
"@vitest/eslint-plugin": "1.1.37",
26+
"@typescript-eslint/utils": "^8.26.1",
27+
"@vitest/eslint-plugin": "1.1.38",
2828
"@vue/eslint-config-typescript": "^14.5.0",
29-
"eslint-config-prettier": "^10.0.1",
29+
"eslint-config-prettier": "^10.1.1",
3030
"eslint-flat-config-utils": "^2.0.1",
3131
"eslint-import-resolver-custom-alias": "^1.3.2",
3232
"eslint-plugin-import-x": "^4.8.0",

Diff for: packages/lint/vue3-typescript-strict.js

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import knimeVue3TS from "vue3-typescript.js";
2+
3+
export default [
4+
...knimeVue3TS,
5+
{
6+
name: "@knime/eslint-config/vue3-typescript-strict",
7+
rules: {
8+
"vue/block-lang": [
9+
"error",
10+
{
11+
script: {
12+
lang: "ts",
13+
},
14+
},
15+
],
16+
},
17+
},
18+
];

Diff for: packages/lint/vue3-typescript.js

+1-8
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,6 @@ export default defineConfigWithVueTs({
4949
"import/no-duplicates": "error",
5050
"no-duplicate-imports": "off",
5151
"unused-imports/no-unused-vars": "off",
52-
"vue/block-lang": [
53-
"warn",
54-
{
55-
script: {
56-
lang: "ts",
57-
},
58-
},
59-
],
52+
"vue/block-lang": "off",
6053
},
6154
});

Diff for: packages/rte/src/components/CreateLinkModal.vue

-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ watch(
2525
editedUrl.value = props.url.value;
2626
setTimeout(() => {
2727
inputRef.value?.focus();
28-
// eslint-disable-next-line no-magic-numbers
2928
}, 200);
3029
},
3130
{ deep: true },

Diff for: packages/ui-extension-renderer/src/api/services/alert.ts

-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ export type WarningAlert = {
1818
warnings: WarningData[];
1919
};
2020

21-
export type ErrorDetails = unknown;
22-
2321
export type UserErrorAlert = {
2422
type: "error";
2523
code: UserErrorCode;

Diff for: packages/ui-extension-service/src/services/__tests__/mocks/extensionConfig.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable no-magic-numbers */
21
import type { UIExtensionServiceConfig } from "@knime/ui-extension-renderer/api";
32

43
export const extensionConfig: UIExtensionServiceConfig = {

Diff for: packages/utils/src/intervalUtils.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ const extractDurationFromRegexMatch = (
5252
negative: boolean,
5353
match: RegExpExecArray,
5454
): Duration => {
55-
// eslint-disable-next-line no-magic-numbers
5655
const milliseconds = parseInt(match[4]?.padEnd(3, "0") ?? "0", 10);
5756

5857
return {
@@ -104,7 +103,6 @@ export const formatIntervalToISOIntervalString = (
104103
} else {
105104
output += `T${toFormat.interval.hours}H${toFormat.interval.minutes}M${toFormat.interval.seconds}.${toFormat.interval.milliseconds
106105
.toString()
107-
// eslint-disable-next-line no-magic-numbers
108106
.padStart(3, "0")}S`;
109107
}
110108

@@ -160,7 +158,7 @@ export const formatIntervalToHumanReadableIntervalString = (
160158
if (milliSecondsZero) {
161159
output += formatPart(toFormat.interval.seconds, "second");
162160
} else {
163-
output += `${toFormat.interval.seconds}.${toFormat.interval.milliseconds.toString().padStart(3, "0")} seconds `; // eslint-disable-line no-magic-numbers
161+
output += `${toFormat.interval.seconds}.${toFormat.interval.milliseconds.toString().padStart(3, "0")} seconds `;
164162
}
165163
}
166164
}

Diff for: packages/utils/src/uploadManager/index.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { AbortError, createAbortablePromise, retryPromise } from "../promise";
22

3-
// eslint-disable-next-line no-magic-numbers
43
const CHUNK_SIZE = 50 * 1024 * 1024; // 50 MB per chunk
54

65
const DEFAULT_RETRY_COUNT = 5;

Diff for: packages/virtual-tree/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
"consola": "catalog:peer"
3333
},
3434
"devDependencies": {
35-
"@knime/eslint-config": "workspace:*",
3635
"@vitejs/plugin-vue": "catalog:",
3736
"@vue/test-utils": "catalog:",
3837
"consola": "catalog:",

0 commit comments

Comments
 (0)