Skip to content

Commit 74cd999

Browse files
better-salmonwmertens
authored andcommitted
chore(eslint): Update ESLint configurations and fix linting scripts
1 parent ad7178d commit 74cd999

File tree

60 files changed

+129
-178
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+129
-178
lines changed

.changeset/changelog-github-custom.ts

+10-6
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@ const changelogFunctions: ChangelogFunctions = {
1212
'Please provide a repo to this changelog generator like this:\n"changelog": ["@changesets/changelog-github", { "repo": "org/repo" }]'
1313
);
1414
}
15-
if (dependenciesUpdated.length === 0) return '';
15+
if (dependenciesUpdated.length === 0) {
16+
return '';
17+
}
1618

1719
const changesetLink = `- Updated dependencies [${(
1820
await Promise.all(
1921
changesets.map(async (cs) => {
2022
if (cs.commit) {
21-
let { links } = await getInfo({
23+
const { links } = await getInfo({
2224
repo: options.repo,
2325
commit: cs.commit,
2426
});
@@ -45,12 +47,14 @@ const changelogFunctions: ChangelogFunctions = {
4547

4648
let prFromSummary: number | undefined;
4749
let commitFromSummary: string | undefined;
48-
let usersFromSummary: string[] = [];
50+
const usersFromSummary: string[] = [];
4951

5052
const replacedChangelog = changeset.summary
5153
.replace(/^\s*(?:pr|pull|pull\s+request):\s*#?(\d+)/im, (_, pr) => {
52-
let num = Number(pr);
53-
if (!isNaN(num)) prFromSummary = num;
54+
const num = Number(pr);
55+
if (!isNaN(num)) {
56+
prFromSummary = num;
57+
}
5458
return '';
5559
})
5660
.replace(/^\s*commit:\s*([^\s]+)/im, (_, commit) => {
@@ -91,7 +95,7 @@ const changelogFunctions: ChangelogFunctions = {
9195
}
9296
const commitToFetchFrom = commitFromSummary || changeset.commit;
9397
if (commitToFetchFrom) {
94-
let { links } = await getInfo({
98+
const { links } = await getInfo({
9599
repo: options.repo,
96100
commit: commitToFetchFrom,
97101
});

.changeset/giant-carpets-brake.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'create-qwik': patch
3+
'@builder.io/qwik-city': patch
4+
'@builder.io/qwik': patch
5+
---
6+
7+
Fix linting errors which were previously being ignored across the monorepo.

eslint.config.js

+22-8
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,26 @@ const ignores = [
2222
'**/tsdoc-metadata.json',
2323
'**/.DS_Store',
2424
'**/*.mp4',
25-
'scripts/**/*',
25+
'scripts',
2626
'**/server/**/*.js',
2727
'**/*.tsbuildinfo',
28-
'packages/docs/api/**/*',
28+
'packages/docs/api',
2929
'packages/docs/public/repl/repl-sw.js*',
30-
'packages/docs/src/routes/examples/apps/**/*',
31-
'packages/docs/src/routes/playground/app/**/*',
32-
'packages/docs/src/routes/tutorial/**/*',
33-
'packages/qwik-labs/lib/**/*',
34-
'packages/qwik-labs/lib-types/**/*',
35-
'packages/qwik-labs/vite/**/*',
30+
'packages/docs/src/routes/examples/apps',
31+
'packages/docs/src/routes/playground/app',
32+
'packages/docs/src/routes/tutorial',
33+
'packages/qwik-labs/lib',
34+
'packages/qwik-labs/lib-types',
35+
'packages/qwik-labs/vite',
3636
'packages/insights/drizzle.config.ts',
3737
'packages/insights/panda.config.ts',
3838
'starters/apps/base',
3939
'starters/apps/library',
4040
'starters/templates',
4141
'**/vite.config.ts',
42+
// packages with eslint.config.mjs
43+
'packages/qwik-labs',
44+
'packages/insights',
4245
];
4346

4447
export default tseslint.config(
@@ -89,6 +92,17 @@ export default tseslint.config(
8992
'@typescript-eslint/no-var-requires': 'off',
9093
curly: 'error',
9194
'no-new-func': 'error',
95+
'@typescript-eslint/no-empty-object-type': 'off',
96+
'@typescript-eslint/no-unused-expressions': 'off',
97+
'@typescript-eslint/no-unsafe-function-type': 'off',
98+
'@typescript-eslint/no-require-imports': 'off',
99+
'@typescript-eslint/no-wrapper-object-types': 'off',
100+
},
101+
},
102+
{
103+
files: ['packages/docs/**/*.{ts,tsx}'],
104+
rules: {
105+
'no-console': 'off',
92106
},
93107
}
94108
);

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,8 @@
226226
"link.dist.npm": "cd packages/qwik && npm link && cd ../qwik-city && npm link && cd ../eslint-plugin-qwik && npm link && cd ../qwik-react && npm link",
227227
"link.dist.yarn": "cd packages/qwik && yarn link && cd ../qwik-city && yarn link && cd ../eslint-plugin-qwik && yarn link && cd ../qwik-react && yarn link",
228228
"lint": "pnpm lint.eslint && pnpm lint.prettier && pnpm lint.rust",
229-
"lint.eslint": "eslint --cache \"**/*.ts*\"",
230-
"lint.fix": "eslint --fix \"**/*.ts*\" && pnpm prettier.fix",
229+
"lint.eslint": "eslint --cache \"**/*.ts*\" && pnpm -r --parallel lint",
230+
"lint.fix": "eslint --fix \"**/*.ts*\" && pnpm -r --parallel lint.fix && pnpm prettier.fix",
231231
"lint.prettier": "prettier --cache --check .",
232232
"lint.rust": "make lint",
233233
"lint.syncpack": "syncpack list-mismatches",

packages/create-qwik/index.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable no-console */
21
import { runCreateCli } from './src/run-create-cli';
32
import { runCreateInteractiveCli } from './src/run-create-interactive-cli';
43
import { panic, printHeader } from '../qwik/src/cli/utils/utils';

packages/create-qwik/src/run-create-interactive-cli.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { join, relative } from 'node:path';
77
import type { CreateAppResult } from '../../qwik/src/cli/types';
88
import { clearDir } from './helpers/clearDir';
99
import { createApp } from './create-app';
10-
/* eslint-disable no-console */
10+
1111
import fs from 'node:fs';
1212
import { getRandomJoke } from './helpers/jokes';
1313
import { installDepsCli } from './helpers/installDepsCli';

packages/docs/codesandbox.sync.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable no-console */
21
import { readdirSync, readFileSync, writeFileSync } from 'node:fs';
32
import { join } from 'node:path';
43

packages/docs/contributors.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable no-console */
21
import { fetch } from 'undici';
32
import fs from 'node:fs';
43
import path from 'node:path';

packages/docs/src/components/router-head/router-head.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable no-console */
21
import { component$ } from '@builder.io/qwik';
32
import { useDocumentHead, useLocation } from '@builder.io/qwik-city';
43
import { Social } from './social';

packages/docs/src/repl/repl-version.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable no-console */
21
import { QWIK_PKG_NAME, bundled } from './bundled';
32

43
const bundledVersion = bundled[QWIK_PKG_NAME].version;

packages/docs/src/repl/repl.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable no-console */
21
import {
32
component$,
43
noSerialize,

packages/docs/src/repl/worker/app-bundle-client.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable no-console */
21
import type { InputOptions, OutputAsset, OutputChunk } from 'rollup';
32
import type { Diagnostic, QwikRollupPluginOptions } from '@builder.io/qwik/optimizer';
43
import type { ReplInputOptions, ReplModuleOutput, ReplResult } from '../types';

packages/docs/src/repl/worker/app-bundle-ssr.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable no-console */
21
import type { InputOptions } from 'rollup';
32
import type { Diagnostic, QwikRollupPluginOptions } from '@builder.io/qwik/optimizer';
43
import type { ReplInputOptions, ReplResult } from '../types';

packages/docs/src/repl/worker/app-ssr-html.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable no-console */
21
import type { RenderOptions, RenderToStringResult } from '@builder.io/qwik/server';
32
import type { ReplInputOptions, ReplResult } from '../types';
43
import type { QwikWorkerGlobal } from './repl-service-worker';

packages/docs/src/repl/worker/app-update.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable no-console */
21
import type { ReplInputOptions, ReplResult } from '../types';
32
import { appBundleClient } from './app-bundle-client';
43
import { appBundleSsr } from './app-bundle-ssr';

packages/docs/src/repl/worker/repl-dependencies.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable no-console */
21
import type { ReplInputOptions } from '../types';
32
import { QWIK_PKG_NAME, QWIK_REPL_DEPS_CACHE } from './repl-constants';
43
import type { QwikWorkerGlobal } from './repl-service-worker';

packages/docs/src/repl/worker/repl-server.ts

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
* - Public static html source file: "public/repl/~repl-server-host.html"
66
*/
77

8-
/* eslint-disable no-console */
98
import type { ReplMessage, ReplResult } from '../types';
109

1110
export const initReplServer = (win: Window, doc: Document, nav: Navigator) => {

packages/docs/src/routes/community/layout.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { OnThisPage } from '../../components/on-this-page/on-this-page';
66
import { ContentNav } from '../../components/content-nav/content-nav';
77
import styles from '../docs/docs.css?inline';
88

9-
// eslint-disable-next-line
109
export { useMarkdownItems } from '../../components/sidebar/sidebar';
1110

1211
export default component$(() => {

packages/docs/src/routes/demo/cookbook/drag&drop/advanced/index.tsx

+12-4
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ export default component$(() => {
5353
const targetId = parseInt(
5454
(e.target as HTMLDivElement).dataset.id || '0'
5555
);
56-
if (targetId === 0) return;
56+
if (targetId === 0) {
57+
return;
58+
}
5759

5860
const targetIndex = items1.value.findIndex(
5961
(i) => i.id === targetId
@@ -68,7 +70,9 @@ export default component$(() => {
6870
items1.value = newItems;
6971
} else {
7072
// Sorting between containers
71-
if (!item) return;
73+
if (!item) {
74+
return;
75+
}
7276
items2.value = items2.value.filter((i) => i.id !== itemId);
7377
insertElement(newItems, targetIndex, item);
7478
items1.value = newItems;
@@ -133,7 +137,9 @@ export default component$(() => {
133137
const targetId = parseInt(
134138
(e.target as HTMLDivElement).dataset.id || '0'
135139
);
136-
if (targetId === 0) return;
140+
if (targetId === 0) {
141+
return;
142+
}
137143
const newItems = [...items2.value];
138144
const draggedIndex = items2.value.findIndex(
139145
(i) => i.id === itemId
@@ -147,7 +153,9 @@ export default component$(() => {
147153
items2.value = newItems;
148154
} else {
149155
// Sorting between containers
150-
if (!item) return;
156+
if (!item) {
157+
return;
158+
}
151159
items1.value = items1.value.filter((i) => i.id !== itemId);
152160
insertElement(newItems, targetIndex, item);
153161
items2.value = newItems;

packages/docs/src/routes/demo/cookbook/portal/portal-provider.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ export const WrapJsxInContext = component$<{
9898
contexts: Array<ContextPair<any>>;
9999
}>(({ jsx, contexts }) => {
100100
contexts.forEach(({ id, value }) => {
101-
// eslint-disable-next-line
102101
useContextProvider(id, value);
103102
});
104103
return (

packages/docs/src/routes/demo/eslint.config.js

-47
This file was deleted.

packages/docs/src/routes/demo/integration/modular-forms/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// @ts-nocheck
2-
/* eslint-disable @typescript-eslint/no-unused-vars */
2+
33
import { $, component$, type QRL } from '@builder.io/qwik';
44
import { routeLoader$ } from '@builder.io/qwik-city';
55
import type { InitialValues, SubmitHandler } from '@modular-forms/qwik';

packages/docs/src/routes/demo/layout.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable no-console */
21
import { component$, Slot } from '@builder.io/qwik';
32
import { useStyles$ } from '@builder.io/qwik';
43
import STYLES from './demo-reset.css?inline';
@@ -21,6 +20,7 @@ function logQSymbols() {
2120
const consoleUl = document.getElementById('console')!;
2221
consoleUl.className = 'console';
2322
consoleUl.innerHTML = '<h1>Console</h1>';
23+
// eslint-disable-next-line no-constant-binary-expression
2424
false &&
2525
document.addEventListener('qsymbol', (e) => {
2626
const detail = (e as any as { detail: { symbol: string } }).detail;

packages/docs/src/routes/demo/react/children/react.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/** @jsxImportSource react */
2+
23
import { type ReactNode } from 'react';
34
import { qwikify$ } from '@builder.io/qwik-react';
45

packages/docs/src/routes/demo/react/counter-simple-hover/react.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/** @jsxImportSource react */
2+
23
import { qwikify$ } from '@builder.io/qwik-react';
34
import { useState } from 'react';
45

packages/docs/src/routes/demo/react/counter-two-islands-host/react.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/** @jsxImportSource react */
2+
23
import { qwikify$ } from '@builder.io/qwik-react';
34
import { type ReactNode } from 'react';
45

packages/docs/src/routes/demo/react/counter-two-islands/react.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/** @jsxImportSource react */
2+
23
import { qwikify$ } from '@builder.io/qwik-react';
34

45
function Button({ onClick }: { onClick: () => void }) {

packages/docs/src/routes/demo/react/mui/react.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/** @jsxImportSource react */
2+
23
import { qwikify$ } from '@builder.io/qwik-react';
34
import Tabs from '@mui/material/Tabs';
45
import Tab from '@mui/material/Tab';

packages/docs/src/routes/demo/resumability/index.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ export const HoverProvider = component$(() => {
4747
new CustomEvent('hover', {
4848
bubbles: true,
4949
detail: async (jsx: JSXOutput) => {
50-
if (state.close) return;
50+
if (state.close) {
51+
return;
52+
}
5153
state.currentTarget = e.target as HTMLElement;
5254
state.close = noSerialize(await portal('popup', jsx));
5355
},

0 commit comments

Comments
 (0)