Skip to content

Commit a6f8404

Browse files
authored
Lint for stray console.logs (#2643)
* lint for stray console.logs * upgrade oxlint, add oxlint npm run script
1 parent 2fa9b42 commit a6f8404

File tree

7 files changed

+45
-43
lines changed

7 files changed

+45
-43
lines changed

.eslintrc.cjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ module.exports = {
7070
'import/no-default-export': 'error',
7171
'import/no-unresolved': 'off', // plugin doesn't know anything
7272
'jsx-a11y/label-has-associated-control': [2, { controlComponents: ['button'] }],
73+
// only worry about console.log
74+
'no-console': ['error', { allow: ['warn', 'error', 'info', 'table'] }],
7375
'no-param-reassign': 'error',
7476
'no-restricted-imports': [
7577
'error',

app/api/hooks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ export const wrapQueryClient = <A extends ApiClient>(api: A, queryClient: QueryC
346346
// directly without further processing
347347
throw data
348348
}
349-
console.log(options.explanation)
349+
console.info(options.explanation)
350350
return { type: 'error' as const, data }
351351
}),
352352
...options,

app/api/window.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function handleResult<T>(result: ApiResult<T>): T {
3434
}
3535

3636
function logHeading(s: string) {
37-
console.log(`%c${s}`, 'font-size: 16px; font-weight: bold;')
37+
console.info(`%c${s}`, 'font-size: 16px; font-weight: bold;')
3838
}
3939

4040
if (typeof window !== 'undefined') {

app/forms/image-upload.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ export function Component() {
515515
.catch((e) => {
516516
// eat a 404 since that's what we want. anything else should still blow up
517517
if (e.statusCode === 404) {
518-
console.log(
518+
console.info(
519519
'/v1/images 404 is expected. It means the image name is not taken.'
520520
)
521521
return null

app/msw-mock-api.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function getChaos() {
1515
const chaos = getChaos()
1616

1717
if (process.env.NODE_ENV !== 'production' && chaos) {
18-
console.log(`
18+
console.info(`
1919
▄████████ ▄█ █▄ ▄████████ ▄██████▄ ▄████████
2020
███ ███ ███ ███ ███ ███ ███ ███ ███ ███
2121
███ █▀ ███ ███ ███ ███ ███ ███ ███ █▀
@@ -34,7 +34,7 @@ if (process.env.NODE_ENV !== 'production' && chaos) {
3434
███ ███ ███ ███ ███ ███ ▄███ ███ ███
3535
▀█ ███ █▀ ▀██████▀ ████████▀ ██████████
3636
`)
37-
console.log(`Running MSW in CHAOS MODE with ${chaos}% likelihood of random failure`)
37+
console.info(`Running MSW in CHAOS MODE with ${chaos}% likelihood of random failure`)
3838
}
3939

4040
/** Return true for failure with a given likelihood */

package-lock.json

Lines changed: 36 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"e2e": "playwright test",
2323
"e2ec": "playwright test --project=chrome",
2424
"lint": "eslint --ext .js,.ts,.tsx app test mock-api",
25-
"lint-fast": "npm run lint -- --cache",
25+
"oxlint": "oxlint",
2626
"fmt": "prettier --cache --write . && npm run lint -- --fix",
2727
"openapi-gen-ts": "openapi-gen-ts",
2828
"prettier": "prettier",
@@ -109,7 +109,7 @@
109109
"ip-num": "^1.5.1",
110110
"jsdom": "^25.0.1",
111111
"msw": "^2.7.0",
112-
"oxlint": "^0.14.1",
112+
"oxlint": "^0.15.5",
113113
"patch-package": "^8.0.0",
114114
"postcss": "^8.4.49",
115115
"postcss-import": "^16.1.0",

0 commit comments

Comments
 (0)