Skip to content

Commit 4f88cb2

Browse files
committed
chore: add lint rule for no-console
1 parent c8cff40 commit 4f88cb2

File tree

8 files changed

+49
-27
lines changed

8 files changed

+49
-27
lines changed

docs/highlight.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ export default function highlight() {
5959
node.value = fragment.querySelector('.shiki-snippet')?.outerHTML;
6060
node.type = 'html';
6161
} catch (err) {
62+
// eslint-disable-next-line no-console
6263
console.error(err);
64+
// eslint-disable-next-line no-console
6365
console.log(node.lang);
6466
}
6567
}

docs/src/utils/github.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export function fetchStarCount() {
55
return json.stargazers_count as number;
66
})
77
.catch(err => {
8+
// eslint-disable-next-line no-console
89
console.error(err);
910

1011
return 0;

eslint.config.js

Lines changed: 38 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import eslint from '@eslint/js';
2-
import globals from "globals";
2+
import globals from 'globals';
33
import tseslint from 'typescript-eslint';
44

55
export default tseslint.config(
@@ -10,44 +10,57 @@ export default tseslint.config(
1010
sourceType: 'module',
1111
globals: {
1212
...globals.browser,
13-
}
13+
},
1414
},
1515
rules: {
16-
"@typescript-eslint/camelcase": "off",
17-
"@typescript-eslint/explicit-function-return-type": "off",
18-
"@typescript-eslint/no-use-before-define": "off",
19-
"@typescript-eslint/explicit-module-boundary-types": "off",
20-
"@typescript-eslint/no-explicit-any": "warn"
16+
'@typescript-eslint/camelcase': 'off',
17+
'@typescript-eslint/explicit-function-return-type': 'off',
18+
'@typescript-eslint/no-use-before-define': 'off',
19+
'@typescript-eslint/explicit-module-boundary-types': 'off',
20+
'@typescript-eslint/no-explicit-any': 'warn',
21+
'no-console': 'error',
2122
},
2223
},
2324
{
24-
files: ["scripts/**/*"],
25+
files: ['scripts/**/*'],
2526
languageOptions: {
26-
'sourceType': 'commonjs',
27+
sourceType: 'commonjs',
2728
globals: {
28-
...globals.nodeBuiltin
29-
}
29+
...globals.nodeBuiltin,
30+
},
3031
},
3132
},
3233
{
33-
files: [ "docs/scripts/**/*", "docs/*.config.js"],
34+
files: ['docs/scripts/**/*', 'docs/*.config.js'],
3435
languageOptions: {
35-
'sourceType': 'commonjs',
36+
sourceType: 'commonjs',
3637
globals: {
37-
...globals.node
38-
}
38+
...globals.node,
39+
},
40+
},
41+
},
42+
{
43+
files: ['scripts/**/*', 'packages/**/*.spec.ts'],
44+
languageOptions: {
45+
sourceType: 'commonjs',
46+
globals: {
47+
...globals.nodeBuiltin,
48+
},
49+
},
50+
rules: {
51+
'no-console': 'off',
3952
},
4053
},
4154
{
4255
ignores: [
43-
"packages/vee-validate/dist/*",
44-
"packages/yup/dist/*",
45-
"packages/zod/dist/*",
46-
"packages/valibot/dist/*",
47-
"packages/joi/dist/*",
48-
"packages/rules/dist/*",
49-
"packages/i18n/dist/*",
50-
"packages/nuxt/dist/*",
51-
]
52-
}
56+
'packages/vee-validate/dist/*',
57+
'packages/yup/dist/*',
58+
'packages/zod/dist/*',
59+
'packages/valibot/dist/*',
60+
'packages/joi/dist/*',
61+
'packages/rules/dist/*',
62+
'packages/i18n/dist/*',
63+
'packages/nuxt/dist/*',
64+
],
65+
},
5366
);

packages/i18n/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,14 @@ async function loadLocaleFromURL(url: string) {
153153
}).then(res => res.json());
154154

155155
if (!locale.code) {
156+
// eslint-disable-next-line no-console
156157
console.error('Could not identify locale, ensure the locale file contains `code` field');
157158
return;
158159
}
159160

160161
localize({ [locale.code]: locale });
161162
} catch (err) {
163+
// eslint-disable-next-line no-console
162164
console.error(`Failed to load locale `);
163165
}
164166
}

packages/valibot/src/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import {
2424
StrictObjectSchema,
2525
LooseObjectSchema,
2626
getDotPath,
27-
Config,
27+
Config,
2828
} from 'valibot';
2929
import { isIndex, isObject, merge, normalizeFormPath } from '../../shared';
3030

@@ -34,7 +34,7 @@ export function toTypedSchema<
3434
| BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>,
3535
TInferOutput = InferOutput<TSchema>,
3636
TInferInput = PartialDeep<InferInput<TSchema>>,
37-
>(valibotSchema: TSchema, config?: Config<InferIssue<TSchema>> ): TypedSchema<TInferInput, TInferOutput> {
37+
>(valibotSchema: TSchema, config?: Config<InferIssue<TSchema>>): TypedSchema<TInferInput, TInferOutput> {
3838
const schema: TypedSchema = {
3939
__type: 'VVTypedSchema',
4040
async parse(value) {
@@ -93,6 +93,7 @@ export function toTypedSchema<
9393
};
9494
} catch {
9595
if (__DEV__) {
96+
// eslint-disable-next-line no-console
9697
console.warn(`Failed to describe path ${path} on the schema, returning a default description.`);
9798
}
9899

packages/vee-validate/src/useField.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,7 @@ function useVModel<TValue = unknown>({ prop, value, handleChange, shouldValidate
552552
/* istanbul ignore next */
553553
if (!vm || !prop) {
554554
if (__DEV__) {
555+
// eslint-disable-next-line no-console
555556
console.warn('Failed to setup model events because `useField` was not called in setup.');
556557
}
557558
return;

packages/yup/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ export function toTypedSchema<TSchema extends Schema, TOutput = InferType<TSchem
8383
return getDescriptionFromYupSpec(description);
8484
} catch {
8585
if (__DEV__) {
86+
// eslint-disable-next-line no-console
8687
console.warn(`Failed to describe path ${path} on the schema, returning a default description.`);
8788
}
8889

packages/zod/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ export function toTypedSchema<
7777
};
7878
} catch {
7979
if (__DEV__) {
80+
// eslint-disable-next-line no-console
8081
console.warn(`Failed to describe path ${path} on the schema, returning a default description.`);
8182
}
8283

0 commit comments

Comments
 (0)