Skip to content

Commit

Permalink
feat: prefer importing jest globals for specific types
Browse files Browse the repository at this point in the history
Accessing the `jest` global in ESM must be done either through
`import.meta.jest` or by importing it from `@jest/globals`. The latter
is useful while migrating to ESM because the former is not accessible
in non-ESM.

This adds an option to specify the types of globals for which we want
to enforce the import.
  • Loading branch information
tomquist committed Apr 26, 2024
1 parent 20c8703 commit 5b7aa20
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 3 deletions.
36 changes: 36 additions & 0 deletions docs/rules/prefer-importing-jest-globals.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,42 @@ describe('foo', () => {
});
```

## Options

This rule can be configured as follows

```json5
{
type: 'object',
properties: {
types: {
type: 'array',
items: {
type: 'string',
enum: ['hook', 'describe', 'test', 'expect', 'jest', 'unknown'],
},
},
},
additionalProperties: false,
}
```

#### types

A list of Jest global types to enforce explicit imports for. By default, all
Jest globals are enforced.

This option is useful when you only want to enforce explicit imports for a
subset of Jest globals. For instance, when migrating to ESM, you might want to
enforce explicit imports only for the `jest` global, as of
[Jest's ESM documentation](https://jestjs.io/docs/ecmascript-modules#differences-between-esm-and-commonjs).

```json5
{
'jest/prefer-importing-jest-globals': ['error', { types: ['jest'] }],
}
```

## Further Reading

- [Documentation](https://jestjs.io/docs/api)
46 changes: 46 additions & 0 deletions src/rules/__tests__/prefer-importing-jest-globals.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,25 @@ ruleTester.run('prefer-importing-jest-globals', rule, {
`,
parserOptions: { sourceType: 'module' },
},
{
code: dedent`
test('should pass', () => {
expect(true).toBeDefined();
});
`,
parserOptions: { sourceType: 'module' },
options: [{ types: ['jest'] }],

Check failure on line 32 in src/rules/__tests__/prefer-importing-jest-globals.test.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x, eslint v7, and ts-eslint/plugin v6

The properties of a test case should be placed in a consistent order: [code, options, parserOptions]

Check failure on line 32 in src/rules/__tests__/prefer-importing-jest-globals.test.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v16.x, eslint v7, and ts-eslint/plugin v6

The properties of a test case should be placed in a consistent order: [code, options, parserOptions]

Check failure on line 32 in src/rules/__tests__/prefer-importing-jest-globals.test.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v16.x, eslint v8, and ts-eslint/plugin v6

The properties of a test case should be placed in a consistent order: [code, options, parserOptions]

Check failure on line 32 in src/rules/__tests__/prefer-importing-jest-globals.test.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x, eslint v8, and ts-eslint/plugin v6

The properties of a test case should be placed in a consistent order: [code, options, parserOptions]

Check failure on line 32 in src/rules/__tests__/prefer-importing-jest-globals.test.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x, eslint v7, and ts-eslint/plugin v6

The properties of a test case should be placed in a consistent order: [code, options, parserOptions]

Check failure on line 32 in src/rules/__tests__/prefer-importing-jest-globals.test.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x, eslint v8, and ts-eslint/plugin v7

The properties of a test case should be placed in a consistent order: [code, options, parserOptions]

Check failure on line 32 in src/rules/__tests__/prefer-importing-jest-globals.test.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x, eslint v8, and ts-eslint/plugin v7

The properties of a test case should be placed in a consistent order: [code, options, parserOptions]

Check failure on line 32 in src/rules/__tests__/prefer-importing-jest-globals.test.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x, eslint v7, and ts-eslint/plugin v6

The properties of a test case should be placed in a consistent order: [code, options, parserOptions]

Check failure on line 32 in src/rules/__tests__/prefer-importing-jest-globals.test.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x, eslint v8, and ts-eslint/plugin v7

The properties of a test case should be placed in a consistent order: [code, options, parserOptions]

Check failure on line 32 in src/rules/__tests__/prefer-importing-jest-globals.test.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x, eslint v8, and ts-eslint/plugin v6

The properties of a test case should be placed in a consistent order: [code, options, parserOptions]

Check failure on line 32 in src/rules/__tests__/prefer-importing-jest-globals.test.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x, eslint v8, and ts-eslint/plugin v6

The properties of a test case should be placed in a consistent order: [code, options, parserOptions]

Check failure on line 32 in src/rules/__tests__/prefer-importing-jest-globals.test.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v22.x, eslint v7, and ts-eslint/plugin v6

The properties of a test case should be placed in a consistent order: [code, options, parserOptions]

Check failure on line 32 in src/rules/__tests__/prefer-importing-jest-globals.test.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v22.x, eslint v8, and ts-eslint/plugin v6

The properties of a test case should be placed in a consistent order: [code, options, parserOptions]

Check failure on line 32 in src/rules/__tests__/prefer-importing-jest-globals.test.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v22.x, eslint v8, and ts-eslint/plugin v7

The properties of a test case should be placed in a consistent order: [code, options, parserOptions]
},
{
code: dedent`
const { it } = require('@jest/globals');
it('should pass', () => {
expect(true).toBeDefined();
});
`,
parserOptions: { sourceType: 'module' },
options: [{ types: ['test'] }],

Check failure on line 42 in src/rules/__tests__/prefer-importing-jest-globals.test.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x, eslint v7, and ts-eslint/plugin v6

The properties of a test case should be placed in a consistent order: [code, options, parserOptions]

Check failure on line 42 in src/rules/__tests__/prefer-importing-jest-globals.test.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v16.x, eslint v7, and ts-eslint/plugin v6

The properties of a test case should be placed in a consistent order: [code, options, parserOptions]

Check failure on line 42 in src/rules/__tests__/prefer-importing-jest-globals.test.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v16.x, eslint v8, and ts-eslint/plugin v6

The properties of a test case should be placed in a consistent order: [code, options, parserOptions]

Check failure on line 42 in src/rules/__tests__/prefer-importing-jest-globals.test.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x, eslint v8, and ts-eslint/plugin v6

The properties of a test case should be placed in a consistent order: [code, options, parserOptions]

Check failure on line 42 in src/rules/__tests__/prefer-importing-jest-globals.test.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x, eslint v7, and ts-eslint/plugin v6

The properties of a test case should be placed in a consistent order: [code, options, parserOptions]

Check failure on line 42 in src/rules/__tests__/prefer-importing-jest-globals.test.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x, eslint v8, and ts-eslint/plugin v7

The properties of a test case should be placed in a consistent order: [code, options, parserOptions]

Check failure on line 42 in src/rules/__tests__/prefer-importing-jest-globals.test.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x, eslint v8, and ts-eslint/plugin v7

The properties of a test case should be placed in a consistent order: [code, options, parserOptions]

Check failure on line 42 in src/rules/__tests__/prefer-importing-jest-globals.test.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x, eslint v7, and ts-eslint/plugin v6

The properties of a test case should be placed in a consistent order: [code, options, parserOptions]

Check failure on line 42 in src/rules/__tests__/prefer-importing-jest-globals.test.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x, eslint v8, and ts-eslint/plugin v7

The properties of a test case should be placed in a consistent order: [code, options, parserOptions]

Check failure on line 42 in src/rules/__tests__/prefer-importing-jest-globals.test.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x, eslint v8, and ts-eslint/plugin v6

The properties of a test case should be placed in a consistent order: [code, options, parserOptions]

Check failure on line 42 in src/rules/__tests__/prefer-importing-jest-globals.test.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x, eslint v8, and ts-eslint/plugin v6

The properties of a test case should be placed in a consistent order: [code, options, parserOptions]

Check failure on line 42 in src/rules/__tests__/prefer-importing-jest-globals.test.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v22.x, eslint v7, and ts-eslint/plugin v6

The properties of a test case should be placed in a consistent order: [code, options, parserOptions]

Check failure on line 42 in src/rules/__tests__/prefer-importing-jest-globals.test.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v22.x, eslint v8, and ts-eslint/plugin v6

The properties of a test case should be placed in a consistent order: [code, options, parserOptions]

Check failure on line 42 in src/rules/__tests__/prefer-importing-jest-globals.test.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v22.x, eslint v8, and ts-eslint/plugin v7

The properties of a test case should be placed in a consistent order: [code, options, parserOptions]
},
{
code: dedent`
// with require
Expand Down Expand Up @@ -85,6 +104,33 @@ ruleTester.run('prefer-importing-jest-globals', rule, {
},
],
},
{
code: dedent`
jest.useFakeTimers();
describe("suite", () => {
test("foo");
expect(true).toBeDefined();
})
`,
options: [{ types: ['jest'] }],
output: dedent`

Check failure on line 116 in src/rules/__tests__/prefer-importing-jest-globals.test.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x, eslint v7, and ts-eslint/plugin v6

The properties of a test case should be placed in a consistent order: [code, output, options, parserOptions, errors]

Check failure on line 116 in src/rules/__tests__/prefer-importing-jest-globals.test.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v16.x, eslint v7, and ts-eslint/plugin v6

The properties of a test case should be placed in a consistent order: [code, output, options, parserOptions, errors]

Check failure on line 116 in src/rules/__tests__/prefer-importing-jest-globals.test.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v16.x, eslint v8, and ts-eslint/plugin v6

The properties of a test case should be placed in a consistent order: [code, output, options, parserOptions, errors]

Check failure on line 116 in src/rules/__tests__/prefer-importing-jest-globals.test.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x, eslint v8, and ts-eslint/plugin v6

The properties of a test case should be placed in a consistent order: [code, output, options, parserOptions, errors]

Check failure on line 116 in src/rules/__tests__/prefer-importing-jest-globals.test.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x, eslint v7, and ts-eslint/plugin v6

The properties of a test case should be placed in a consistent order: [code, output, options, parserOptions, errors]

Check failure on line 116 in src/rules/__tests__/prefer-importing-jest-globals.test.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x, eslint v8, and ts-eslint/plugin v7

The properties of a test case should be placed in a consistent order: [code, output, options, parserOptions, errors]

Check failure on line 116 in src/rules/__tests__/prefer-importing-jest-globals.test.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x, eslint v8, and ts-eslint/plugin v7

The properties of a test case should be placed in a consistent order: [code, output, options, parserOptions, errors]

Check failure on line 116 in src/rules/__tests__/prefer-importing-jest-globals.test.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x, eslint v7, and ts-eslint/plugin v6

The properties of a test case should be placed in a consistent order: [code, output, options, parserOptions, errors]

Check failure on line 116 in src/rules/__tests__/prefer-importing-jest-globals.test.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x, eslint v8, and ts-eslint/plugin v7

The properties of a test case should be placed in a consistent order: [code, output, options, parserOptions, errors]

Check failure on line 116 in src/rules/__tests__/prefer-importing-jest-globals.test.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x, eslint v8, and ts-eslint/plugin v6

The properties of a test case should be placed in a consistent order: [code, output, options, parserOptions, errors]

Check failure on line 116 in src/rules/__tests__/prefer-importing-jest-globals.test.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x, eslint v8, and ts-eslint/plugin v6

The properties of a test case should be placed in a consistent order: [code, output, options, parserOptions, errors]

Check failure on line 116 in src/rules/__tests__/prefer-importing-jest-globals.test.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v22.x, eslint v7, and ts-eslint/plugin v6

The properties of a test case should be placed in a consistent order: [code, output, options, parserOptions, errors]

Check failure on line 116 in src/rules/__tests__/prefer-importing-jest-globals.test.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v22.x, eslint v8, and ts-eslint/plugin v6

The properties of a test case should be placed in a consistent order: [code, output, options, parserOptions, errors]

Check failure on line 116 in src/rules/__tests__/prefer-importing-jest-globals.test.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v22.x, eslint v8, and ts-eslint/plugin v7

The properties of a test case should be placed in a consistent order: [code, output, options, parserOptions, errors]
import { jest } from '@jest/globals';
jest.useFakeTimers();
describe("suite", () => {
test("foo");
expect(true).toBeDefined();
})
`,
parserOptions: { sourceType: 'module' },
errors: [
{
endColumn: 5,
column: 1,
line: 1,
messageId: 'preferImportingJestGlobal',
},
],
},
{
code: dedent`
import React from 'react';
Expand Down
27 changes: 24 additions & 3 deletions src/rules/prefer-importing-jest-globals.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { AST_NODE_TYPES, type TSESTree } from '@typescript-eslint/utils';
import {
createRule,
exhaustiveStringTuple,
getAccessorValue,
getSourceCode,
isIdentifier,
isStringNode,
isSupportedAccessor,
parseJestFnCall,
JestFnType
} from './utils';

const createFixerImports = (
Expand All @@ -20,6 +22,8 @@ const createFixerImports = (
: `const { ${allImportsFormatted} } = require('@jest/globals');`;
};

const allJestFnTypes = exhaustiveStringTuple<JestFnType>()('hook', 'describe', 'test', 'expect', 'jest', 'unknown');

export default createRule({
name: __filename,
meta: {
Expand All @@ -31,10 +35,27 @@ export default createRule({
},
fixable: 'code',
type: 'problem',
schema: [],
schema: [
{
type: 'object',
properties: {
types: {
type: 'array',
items: {
type: 'string',
enum: allJestFnTypes,
},
},
},
additionalProperties: false,
}
],
},
defaultOptions: [],
defaultOptions: [{
types: allJestFnTypes as JestFnType[],
}],
create(context) {
const { types = allJestFnTypes } = context.options[0] || {};
const importedFunctionsWithSource: Record<string, string> = {};
const functionsToImport = new Set<string>();
let reportingNode: TSESTree.Node;
Expand All @@ -55,7 +76,7 @@ export default createRule({
return;
}

if (jestFnCall.head.type !== 'import') {
if (jestFnCall.head.type !== 'import' && types.includes(jestFnCall.type)) {
functionsToImport.add(jestFnCall.name);
reportingNode ||= jestFnCall.head.node;
}
Expand Down
13 changes: 13 additions & 0 deletions src/rules/utils/misc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,3 +266,16 @@ export const getDeclaredVariables = (
context.getDeclaredVariables(node)
);
};

type AtLeastOne<T> = [T, ...T[]];
export const exhaustiveTuple =
<T>() =>
<L extends AtLeastOne<T>>(

Check failure on line 273 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x, eslint v7, and ts-eslint/plugin v6

Delete `··`

Check failure on line 273 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v16.x, eslint v7, and ts-eslint/plugin v6

Delete `··`

Check failure on line 273 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v16.x, eslint v8, and ts-eslint/plugin v6

Delete `··`

Check failure on line 273 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x, eslint v8, and ts-eslint/plugin v6

Delete `··`

Check failure on line 273 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x, eslint v7, and ts-eslint/plugin v6

Delete `··`

Check failure on line 273 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x, eslint v8, and ts-eslint/plugin v7

Delete `··`

Check failure on line 273 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x, eslint v8, and ts-eslint/plugin v7

Delete `··`

Check failure on line 273 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x, eslint v7, and ts-eslint/plugin v6

Delete `··`

Check failure on line 273 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x, eslint v8, and ts-eslint/plugin v7

Delete `··`

Check failure on line 273 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x, eslint v8, and ts-eslint/plugin v6

Delete `··`

Check failure on line 273 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x, eslint v8, and ts-eslint/plugin v6

Delete `··`

Check failure on line 273 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v22.x, eslint v7, and ts-eslint/plugin v6

Delete `··`

Check failure on line 273 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v22.x, eslint v8, and ts-eslint/plugin v6

Delete `··`

Check failure on line 273 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v22.x, eslint v8, and ts-eslint/plugin v7

Delete `··`
...x: L extends any

Check failure on line 274 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x, eslint v7, and ts-eslint/plugin v6

Delete `··`

Check failure on line 274 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v16.x, eslint v7, and ts-eslint/plugin v6

Delete `··`

Check failure on line 274 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v16.x, eslint v8, and ts-eslint/plugin v6

Delete `··`

Check failure on line 274 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x, eslint v8, and ts-eslint/plugin v6

Delete `··`

Check failure on line 274 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x, eslint v7, and ts-eslint/plugin v6

Delete `··`

Check failure on line 274 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x, eslint v8, and ts-eslint/plugin v7

Delete `··`

Check failure on line 274 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x, eslint v8, and ts-eslint/plugin v7

Delete `··`

Check failure on line 274 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x, eslint v7, and ts-eslint/plugin v6

Delete `··`

Check failure on line 274 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x, eslint v8, and ts-eslint/plugin v7

Delete `··`

Check failure on line 274 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x, eslint v8, and ts-eslint/plugin v6

Delete `··`

Check failure on line 274 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x, eslint v8, and ts-eslint/plugin v6

Delete `··`

Check failure on line 274 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v22.x, eslint v7, and ts-eslint/plugin v6

Delete `··`

Check failure on line 274 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v22.x, eslint v8, and ts-eslint/plugin v6

Delete `··`

Check failure on line 274 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v22.x, eslint v8, and ts-eslint/plugin v7

Delete `··`
? Exclude<T, L[number]> extends never

Check failure on line 275 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x, eslint v7, and ts-eslint/plugin v6

Replace `········` with `······`

Check failure on line 275 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v16.x, eslint v7, and ts-eslint/plugin v6

Replace `········` with `······`

Check failure on line 275 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v16.x, eslint v8, and ts-eslint/plugin v6

Replace `········` with `······`

Check failure on line 275 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x, eslint v8, and ts-eslint/plugin v6

Replace `········` with `······`

Check failure on line 275 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x, eslint v7, and ts-eslint/plugin v6

Replace `········` with `······`

Check failure on line 275 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x, eslint v8, and ts-eslint/plugin v7

Replace `········` with `······`

Check failure on line 275 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x, eslint v8, and ts-eslint/plugin v7

Replace `········` with `······`

Check failure on line 275 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x, eslint v7, and ts-eslint/plugin v6

Replace `········` with `······`

Check failure on line 275 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x, eslint v8, and ts-eslint/plugin v7

Replace `········` with `······`

Check failure on line 275 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x, eslint v8, and ts-eslint/plugin v6

Replace `········` with `······`

Check failure on line 275 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x, eslint v8, and ts-eslint/plugin v6

Replace `········` with `······`

Check failure on line 275 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v22.x, eslint v7, and ts-eslint/plugin v6

Replace `········` with `······`

Check failure on line 275 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v22.x, eslint v8, and ts-eslint/plugin v6

Replace `········` with `······`

Check failure on line 275 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v22.x, eslint v8, and ts-eslint/plugin v7

Replace `········` with `······`
? L

Check failure on line 276 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x, eslint v7, and ts-eslint/plugin v6

Delete `··`

Check failure on line 276 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v16.x, eslint v7, and ts-eslint/plugin v6

Delete `··`

Check failure on line 276 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v16.x, eslint v8, and ts-eslint/plugin v6

Delete `··`

Check failure on line 276 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x, eslint v8, and ts-eslint/plugin v6

Delete `··`

Check failure on line 276 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x, eslint v7, and ts-eslint/plugin v6

Delete `··`

Check failure on line 276 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x, eslint v8, and ts-eslint/plugin v7

Delete `··`

Check failure on line 276 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x, eslint v8, and ts-eslint/plugin v7

Delete `··`

Check failure on line 276 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x, eslint v7, and ts-eslint/plugin v6

Delete `··`

Check failure on line 276 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x, eslint v8, and ts-eslint/plugin v7

Delete `··`

Check failure on line 276 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x, eslint v8, and ts-eslint/plugin v6

Delete `··`

Check failure on line 276 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x, eslint v8, and ts-eslint/plugin v6

Delete `··`

Check failure on line 276 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v22.x, eslint v7, and ts-eslint/plugin v6

Delete `··`

Check failure on line 276 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v22.x, eslint v8, and ts-eslint/plugin v6

Delete `··`

Check failure on line 276 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v22.x, eslint v8, and ts-eslint/plugin v7

Delete `··`
: Array<Exclude<T, L[number]>>

Check failure on line 277 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x, eslint v7, and ts-eslint/plugin v6

Replace `··········` with `········`

Check failure on line 277 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v16.x, eslint v7, and ts-eslint/plugin v6

Replace `··········` with `········`

Check failure on line 277 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v16.x, eslint v8, and ts-eslint/plugin v6

Replace `··········` with `········`

Check failure on line 277 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x, eslint v8, and ts-eslint/plugin v6

Replace `··········` with `········`

Check failure on line 277 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x, eslint v7, and ts-eslint/plugin v6

Replace `··········` with `········`

Check failure on line 277 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x, eslint v8, and ts-eslint/plugin v7

Replace `··········` with `········`

Check failure on line 277 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x, eslint v8, and ts-eslint/plugin v7

Replace `··········` with `········`

Check failure on line 277 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x, eslint v7, and ts-eslint/plugin v6

Replace `··········` with `········`

Check failure on line 277 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x, eslint v8, and ts-eslint/plugin v7

Replace `··········` with `········`

Check failure on line 277 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x, eslint v8, and ts-eslint/plugin v6

Replace `··········` with `········`

Check failure on line 277 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x, eslint v8, and ts-eslint/plugin v6

Replace `··········` with `········`

Check failure on line 277 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v22.x, eslint v7, and ts-eslint/plugin v6

Replace `··········` with `········`

Check failure on line 277 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v22.x, eslint v8, and ts-eslint/plugin v6

Replace `··········` with `········`

Check failure on line 277 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v22.x, eslint v8, and ts-eslint/plugin v7

Replace `··········` with `········`
: never

Check failure on line 278 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x, eslint v7, and ts-eslint/plugin v6

Delete `··`

Check failure on line 278 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v16.x, eslint v7, and ts-eslint/plugin v6

Delete `··`

Check failure on line 278 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v16.x, eslint v8, and ts-eslint/plugin v6

Delete `··`

Check failure on line 278 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x, eslint v8, and ts-eslint/plugin v6

Delete `··`

Check failure on line 278 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x, eslint v7, and ts-eslint/plugin v6

Delete `··`

Check failure on line 278 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x, eslint v8, and ts-eslint/plugin v7

Delete `··`

Check failure on line 278 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x, eslint v8, and ts-eslint/plugin v7

Delete `··`

Check failure on line 278 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x, eslint v7, and ts-eslint/plugin v6

Delete `··`

Check failure on line 278 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x, eslint v8, and ts-eslint/plugin v7

Delete `··`

Check failure on line 278 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x, eslint v8, and ts-eslint/plugin v6

Delete `··`

Check failure on line 278 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x, eslint v8, and ts-eslint/plugin v6

Delete `··`

Check failure on line 278 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v22.x, eslint v7, and ts-eslint/plugin v6

Delete `··`

Check failure on line 278 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v22.x, eslint v8, and ts-eslint/plugin v6

Delete `··`

Check failure on line 278 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v22.x, eslint v8, and ts-eslint/plugin v7

Delete `··`
) =>

Check failure on line 279 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x, eslint v7, and ts-eslint/plugin v6

Replace `····` with `··`

Check failure on line 279 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v16.x, eslint v7, and ts-eslint/plugin v6

Replace `····` with `··`

Check failure on line 279 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v16.x, eslint v8, and ts-eslint/plugin v6

Replace `····` with `··`

Check failure on line 279 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x, eslint v8, and ts-eslint/plugin v6

Replace `····` with `··`

Check failure on line 279 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x, eslint v7, and ts-eslint/plugin v6

Replace `····` with `··`

Check failure on line 279 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v18.x, eslint v8, and ts-eslint/plugin v7

Replace `····` with `··`

Check failure on line 279 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x, eslint v8, and ts-eslint/plugin v7

Replace `····` with `··`

Check failure on line 279 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x, eslint v7, and ts-eslint/plugin v6

Replace `····` with `··`

Check failure on line 279 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x, eslint v8, and ts-eslint/plugin v7

Replace `····` with `··`

Check failure on line 279 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v20.x, eslint v8, and ts-eslint/plugin v6

Replace `····` with `··`

Check failure on line 279 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v21.x, eslint v8, and ts-eslint/plugin v6

Replace `····` with `··`

Check failure on line 279 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v22.x, eslint v7, and ts-eslint/plugin v6

Replace `····` with `··`

Check failure on line 279 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v22.x, eslint v8, and ts-eslint/plugin v6

Replace `····` with `··`

Check failure on line 279 in src/rules/utils/misc.ts

View workflow job for this annotation

GitHub Actions / Test on Node.js v22.x, eslint v8, and ts-eslint/plugin v7

Replace `····` with `··`
x;
export const exhaustiveStringTuple = <T extends string>() => exhaustiveTuple<T>();

0 comments on commit 5b7aa20

Please sign in to comment.