Skip to content

Commit 04f46a9

Browse files
style: update linting
1 parent 35ed434 commit 04f46a9

File tree

7 files changed

+15
-14
lines changed

7 files changed

+15
-14
lines changed

.eslintrc.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@
101101
"@typescript-eslint/no-explicit-any": "off",
102102
"@typescript-eslint/no-unused-expressions": "off",
103103
"@typescript-eslint/no-unused-vars": "off",
104+
"@typescript-eslint/prefer-function-type": "off",
105+
"@typescript-eslint/consistent-generic-constructors": "off",
104106
"import/no-unresolved": "off",
105107
"init-declarations": "off",
106108
"jsdoc/require-jsdoc": "off",

knip.jsonc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
"project": ["src/**/*.ts!", "tests/**/*.ts", "cz-adapter/**/*.ts"],
55
"ignoreDependencies": [
66
"@typescript-eslint/eslint-plugin-disable-type-checked"
7-
]
7+
],
8+
"ignore": ["tests/fixture/file.ts"]
89
}

src/rules/no-expression-statements.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ function checkExpressionStatement(
103103

104104
const { ignoreVoid } = optionsObject;
105105

106-
if (ignoreVoid === true) {
106+
if (ignoreVoid) {
107107
const type = getTypeOfNode(node.expression, context);
108108

109109
return {

src/rules/no-mixed-types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ export const rule = createRuleUsingFunction<
173173
>(name, meta, defaultOptions, (context, options) => {
174174
const [{ checkInterfaces, checkTypeLiterals }] = options;
175175

176-
return Object.fromEntries<any>(
176+
return Object.fromEntries(
177177
(
178178
[
179179
[
@@ -186,5 +186,5 @@ export const rule = createRuleUsingFunction<
186186
],
187187
] as const
188188
).filter(([sel, fn]) => fn !== undefined),
189-
);
189+
) as Record<string, any>;
190190
});

src/rules/prefer-readonly-type.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ function checkArrayOrTupleType(
207207

208208
if (
209209
shouldIgnoreClasses(node, context, ignoreClass) ||
210-
(ignoreInterface === true && isInInterface(node)) ||
210+
(ignoreInterface && isInInterface(node)) ||
211211
shouldIgnoreInFunction(node, context, allowLocalMutation) ||
212212
shouldIgnorePattern2(node, context, ignorePattern) ||
213213
ignoreCollections
@@ -263,7 +263,7 @@ function checkMappedType(
263263

264264
if (
265265
shouldIgnoreClasses(node, context, ignoreClass) ||
266-
(ignoreInterface === true && isInInterface(node)) ||
266+
(ignoreInterface && isInInterface(node)) ||
267267
shouldIgnoreInFunction(node, context, allowLocalMutation) ||
268268
shouldIgnorePattern2(node, context, ignorePattern)
269269
) {
@@ -312,7 +312,7 @@ function checkTypeReference(
312312

313313
if (
314314
shouldIgnoreClasses(node, context, ignoreClass) ||
315-
(ignoreInterface === true && isInInterface(node)) ||
315+
(ignoreInterface && isInInterface(node)) ||
316316
shouldIgnoreInFunction(node, context, allowLocalMutation) ||
317317
shouldIgnorePattern2(node, context, ignorePattern)
318318
) {
@@ -379,7 +379,7 @@ function checkProperty(
379379

380380
if (
381381
shouldIgnoreClasses(node, context, ignoreClass) ||
382-
(ignoreInterface === true && isInInterface(node)) ||
382+
(ignoreInterface && isInInterface(node)) ||
383383
shouldIgnoreInFunction(node, context, allowLocalMutation) ||
384384
shouldIgnorePattern2(node, context, ignorePattern)
385385
) {
@@ -392,8 +392,7 @@ function checkProperty(
392392
return {
393393
context,
394394
descriptors:
395-
node.readonly !== true &&
396-
(!allowMutableReturnType || !isInReturnType(node))
395+
!node.readonly && (!allowMutableReturnType || !isInReturnType(node))
397396
? [
398397
{
399398
node,
@@ -444,7 +443,7 @@ function checkImplicitType(
444443
if (
445444
!checkImplicit ||
446445
shouldIgnoreClasses(node, context, ignoreClass) ||
447-
(ignoreInterface === true && isInInterface(node)) ||
446+
(ignoreInterface && isInInterface(node)) ||
448447
shouldIgnoreInFunction(node, context, allowLocalMutation) ||
449448
shouldIgnorePattern2(node, context, ignorePattern)
450449
) {

src/settings/immutability.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ declare module "@typescript-eslint/utils" {
3131
/**
3232
* The settings that have been loaded - so we don't have to reload them.
3333
*/
34-
const cachedSettings: WeakMap<
34+
const cachedSettings = new WeakMap<
3535
NonNullable<SharedConfigurationSettings["immutability"]>,
3636
ImmutabilityOverrides | undefined
37-
> = new WeakMap();
37+
>();
3838

3939
/**
4040
* Get the immutability overrides defined in the settings.

tests/helpers/util.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
type ValidTestCase,
88
type InvalidTestCase,
99
type RunTests,
10-
type RuleListener,
1110
} from "@typescript-eslint/utils/ts-eslint";
1211

1312
import ts from "~/conditional-imports/typescript";

0 commit comments

Comments
 (0)