Skip to content

Commit 330881f

Browse files
feat(deps): update to @typescript-eslint/* v7 (#947)
1 parent f07ee64 commit 330881f

7 files changed

+146
-154
lines changed

lib/create-testing-library-rule/detect-testing-library-utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import {
2525
PRESENCE_MATCHERS,
2626
} from '../utils';
2727

28-
const SETTING_OPTION_OFF = 'off' as const;
28+
const SETTING_OPTION_OFF = 'off';
2929

3030
export type TestingLibrarySettings = {
3131
'testing-library/utils-module'?:

lib/create-testing-library-rule/index.ts

+3-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
EnhancedRuleCreate,
99
} from './detect-testing-library-utils';
1010

11-
export function createTestingLibraryRule<
11+
export const createTestingLibraryRule = <
1212
TOptions extends readonly unknown[],
1313
TMessageIds extends string,
1414
TRuleListener extends TSESLint.RuleListener = TSESLint.RuleListener,
@@ -23,9 +23,8 @@ export function createTestingLibraryRule<
2323
defaultOptions: Readonly<TOptions>;
2424
detectionOptions?: Partial<DetectionOptions>;
2525
create: EnhancedRuleCreate<TOptions, TMessageIds, TRuleListener>;
26-
}>): TSESLint.RuleModule<TMessageIds, TOptions> {
27-
// eslint-disable-next-line new-cap
28-
return ESLintUtils.RuleCreator(getDocsUrl)({
26+
}>): TSESLint.RuleModule<TMessageIds, TOptions> =>
27+
ESLintUtils.RuleCreator(getDocsUrl)({
2928
...remainingConfig,
3029
create: detectTestingLibraryUtils<TOptions, TMessageIds, TRuleListener>(
3130
create,
@@ -41,4 +40,3 @@ export function createTestingLibraryRule<
4140
},
4241
},
4342
});
44-
}

lib/rules/no-await-sync-events.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import {
99
isProperty,
1010
} from '../node-utils';
1111

12-
const USER_EVENT_ASYNC_EXCEPTIONS: string[] = ['type', 'keyboard'];
13-
const FIRE_EVENT_OPTION = 'fire-event' as const;
14-
const USER_EVENT_OPTION = 'user-event' as const;
12+
const USER_EVENT_ASYNC_EXCEPTIONS = ['type', 'keyboard'];
13+
const FIRE_EVENT_OPTION = 'fire-event';
14+
const USER_EVENT_OPTION = 'user-event';
1515
const VALID_EVENT_MODULES = [FIRE_EVENT_OPTION, USER_EVENT_OPTION];
1616
const DEFAULT_EVENT_MODULES = [FIRE_EVENT_OPTION];
1717

lib/rules/prefer-query-by-disappearance.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ export default createTestingLibraryRule<Options, MessageIds>({
5353
/**
5454
* Checks if node is reportable (starts with "get" or "find") and if it is, reports it with `context.report()`.
5555
*
56-
* @param {TSESTree.LeftHandSideExpression} node - Node to be tested
56+
* @param {TSESTree.Expression} node - Node to be tested
5757
* @returns {Boolean} Boolean indicating if expression was reported
5858
*/
59-
function reportExpression(node: TSESTree.LeftHandSideExpression): boolean {
59+
function reportExpression(node: TSESTree.Expression): boolean {
6060
const argumentProperty = isMemberExpression(node)
6161
? getPropertyIdentifierNode(node.property)
6262
: getPropertyIdentifierNode(node);

lib/utils/types.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ type RecommendedConfig<TOptions extends readonly unknown[]> =
88
// These 2 types are copied from `@typescript-eslint/utils`' `CreateRuleMeta`
99
// and modified to our needs
1010
export type TestingLibraryRuleMetaDocs<TOptions extends readonly unknown[]> =
11-
Omit<TSESLint.RuleMetaDataDocs, 'recommended' | 'url'> & {
11+
Omit<TSESLint.RuleMetaDataDocs<TOptions>, 'recommended' | 'url'> & {
1212
/**
1313
* The recommendation level for the rule on a framework basis.
1414
* Used by the build tools to generate the framework config.
@@ -22,7 +22,7 @@ export type TestingLibraryRuleMetaDocs<TOptions extends readonly unknown[]> =
2222
export type TestingLibraryRuleMeta<
2323
TMessageIds extends string,
2424
TOptions extends readonly unknown[],
25-
> = Omit<TSESLint.RuleMetaData<TMessageIds>, 'docs'> & {
25+
> = Omit<TSESLint.RuleMetaData<TMessageIds, TOptions>, 'docs'> & {
2626
docs: TestingLibraryRuleMetaDocs<TOptions>;
2727
};
2828

0 commit comments

Comments
 (0)