Skip to content

Commit

Permalink
feat(deps): update to @typescript-eslint/* v7 (#947)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDeBoey authored Oct 31, 2024
1 parent f07ee64 commit 330881f
Show file tree
Hide file tree
Showing 7 changed files with 146 additions and 154 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
PRESENCE_MATCHERS,
} from '../utils';

const SETTING_OPTION_OFF = 'off' as const;
const SETTING_OPTION_OFF = 'off';

export type TestingLibrarySettings = {
'testing-library/utils-module'?:
Expand Down
8 changes: 3 additions & 5 deletions lib/create-testing-library-rule/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
EnhancedRuleCreate,
} from './detect-testing-library-utils';

export function createTestingLibraryRule<
export const createTestingLibraryRule = <
TOptions extends readonly unknown[],
TMessageIds extends string,
TRuleListener extends TSESLint.RuleListener = TSESLint.RuleListener,
Expand All @@ -23,9 +23,8 @@ export function createTestingLibraryRule<
defaultOptions: Readonly<TOptions>;
detectionOptions?: Partial<DetectionOptions>;
create: EnhancedRuleCreate<TOptions, TMessageIds, TRuleListener>;
}>): TSESLint.RuleModule<TMessageIds, TOptions> {
// eslint-disable-next-line new-cap
return ESLintUtils.RuleCreator(getDocsUrl)({
}>): TSESLint.RuleModule<TMessageIds, TOptions> =>
ESLintUtils.RuleCreator(getDocsUrl)({
...remainingConfig,
create: detectTestingLibraryUtils<TOptions, TMessageIds, TRuleListener>(
create,
Expand All @@ -41,4 +40,3 @@ export function createTestingLibraryRule<
},
},
});
}
6 changes: 3 additions & 3 deletions lib/rules/no-await-sync-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import {
isProperty,
} from '../node-utils';

const USER_EVENT_ASYNC_EXCEPTIONS: string[] = ['type', 'keyboard'];
const FIRE_EVENT_OPTION = 'fire-event' as const;
const USER_EVENT_OPTION = 'user-event' as const;
const USER_EVENT_ASYNC_EXCEPTIONS = ['type', 'keyboard'];
const FIRE_EVENT_OPTION = 'fire-event';
const USER_EVENT_OPTION = 'user-event';
const VALID_EVENT_MODULES = [FIRE_EVENT_OPTION, USER_EVENT_OPTION];
const DEFAULT_EVENT_MODULES = [FIRE_EVENT_OPTION];

Expand Down
4 changes: 2 additions & 2 deletions lib/rules/prefer-query-by-disappearance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ export default createTestingLibraryRule<Options, MessageIds>({
/**
* Checks if node is reportable (starts with "get" or "find") and if it is, reports it with `context.report()`.
*
* @param {TSESTree.LeftHandSideExpression} node - Node to be tested
* @param {TSESTree.Expression} node - Node to be tested
* @returns {Boolean} Boolean indicating if expression was reported
*/
function reportExpression(node: TSESTree.LeftHandSideExpression): boolean {
function reportExpression(node: TSESTree.Expression): boolean {
const argumentProperty = isMemberExpression(node)
? getPropertyIdentifierNode(node.property)
: getPropertyIdentifierNode(node);
Expand Down
4 changes: 2 additions & 2 deletions lib/utils/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type RecommendedConfig<TOptions extends readonly unknown[]> =
// These 2 types are copied from `@typescript-eslint/utils`' `CreateRuleMeta`
// and modified to our needs
export type TestingLibraryRuleMetaDocs<TOptions extends readonly unknown[]> =
Omit<TSESLint.RuleMetaDataDocs, 'recommended' | 'url'> & {
Omit<TSESLint.RuleMetaDataDocs<TOptions>, 'recommended' | 'url'> & {
/**
* The recommendation level for the rule on a framework basis.
* Used by the build tools to generate the framework config.
Expand All @@ -22,7 +22,7 @@ export type TestingLibraryRuleMetaDocs<TOptions extends readonly unknown[]> =
export type TestingLibraryRuleMeta<
TMessageIds extends string,
TOptions extends readonly unknown[],
> = Omit<TSESLint.RuleMetaData<TMessageIds>, 'docs'> & {
> = Omit<TSESLint.RuleMetaData<TMessageIds, TOptions>, 'docs'> & {
docs: TestingLibraryRuleMetaDocs<TOptions>;
};

Expand Down
Loading

0 comments on commit 330881f

Please sign in to comment.