Skip to content

Commit

Permalink
chore: applied linting (#323)
Browse files Browse the repository at this point in the history
  • Loading branch information
veritem committed Dec 13, 2023
1 parent efaf109 commit d564b53
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export default [
| [no-focused-tests](docs/rules/no-focused-tests.md) | Disallow focused tests | | 🌐 | 🔧 | |
| [no-hooks](docs/rules/no-hooks.md) | Disallow setup and teardown hooks | | 🌐 | | |
| [no-identical-title](docs/rules/no-identical-title.md) | Disallow identical titles || | 🔧 | |
| [no-import-node-test](docs/rules/no-import-node-test.md) | Disallow importing `node:test` || 🌐 | 🔧 | |
| [no-import-node-test](docs/rules/no-import-node-test.md) | Disallow importing `node:test` || | 🔧 | |
| [no-interpolation-in-snapshots](docs/rules/no-interpolation-in-snapshots.md) | Disallow string interpolation in snapshots | | 🌐 | 🔧 | |
| [no-large-snapshots](docs/rules/no-large-snapshots.md) | Disallow large snapshots | | 🌐 | | |
| [no-mocks-import](docs/rules/no-mocks-import.md) | Disallow importing from __mocks__ directory | | 🌐 | | |
Expand Down Expand Up @@ -167,7 +167,7 @@ export default [
| [prefer-to-have-length](docs/rules/prefer-to-have-length.md) | Suggest using toHaveLength() | | 🌐 | 🔧 | |
| [prefer-todo](docs/rules/prefer-todo.md) | Suggest using `test.todo` | | 🌐 | 🔧 | |
| [require-hook](docs/rules/require-hook.md) | Require setup and teardown to be within a hook | | 🌐 | | |
| [require-local-test-context-for-concurrent-snapshots](docs/rules/require-local-test-context-for-concurrent-snapshots.md) | Require local Test Context for concurrent snapshot tests || 🌐 | | |
| [require-local-test-context-for-concurrent-snapshots](docs/rules/require-local-test-context-for-concurrent-snapshots.md) | Require local Test Context for concurrent snapshot tests || | | |
| [require-to-throw-message](docs/rules/require-to-throw-message.md) | Require toThrow() to be called with an error message | | 🌐 | | |
| [require-top-level-describe](docs/rules/require-top-level-describe.md) | Enforce that all tests are in a top-level describe | | 🌐 | | |
| [valid-describe-callback](docs/rules/valid-describe-callback.md) | Enforce valid describe callback || | | |
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-import-node-test.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Disallow importing `node:test` (`vitest/no-import-node-test`)

💼⚠️ This rule is enabled in the ✅ `recommended` config. This rule _warns_ in the 🌐 `all` config.
💼 This rule is enabled in the ✅ `recommended` config.

🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Require local Test Context for concurrent snapshot tests (`vitest/require-local-test-context-for-concurrent-snapshots`)

💼⚠️ This rule is enabled in the ✅ `recommended` config. This rule _warns_ in the 🌐 `all` config.
💼 This rule is enabled in the ✅ `recommended` config.

<!-- end auto-generated rule header -->

Expand Down
8 changes: 4 additions & 4 deletions src/rules/no-done-callback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,18 @@ export default createEslintRule<Options, MessageIds>({

const isInsideConcurrentTestOrDescribe = context.getAncestors().some((ancestor) => {
if (ancestor.type !== AST_NODE_TYPES.CallExpression) return false

const isNotInsideDescribeOrTest = !isTypeOfVitestFnCall(ancestor, context, ['describe', 'test'])
if (isNotInsideDescribeOrTest) return false

const isTestRunningConcurrently =
ancestor.callee.type === AST_NODE_TYPES.MemberExpression &&
isSupportedAccessor(ancestor.callee.property, 'concurrent')

return isTestRunningConcurrently
})

if (isInsideConcurrentTestOrDescribe) return;
if (isInsideConcurrentTestOrDescribe) return

const callback = findCallbackArg(node, isVitestEach, context)
const callbackArgIndex = Number(isVitestEach)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,6 @@ ruleTester.run(RULE_NAME, rule, {
{
code: 'it.concurrent("should fail", () => { expect(foo()).toThrowErrorMatchingInlineSnapshot("bar") })',
errors: [{ messageId: 'requireLocalTestContext' }]
},
}
]
})

0 comments on commit d564b53

Please sign in to comment.