UNPKG

@jimmy.codes/eslint-config

Version:

A simple, modern ESLint config that covers most use cases.

77 lines (74 loc) 2.72 kB
import { GLOB_E2E, GLOB_TESTS } from "./globs-CRO5v7xy.js"; import { interopDefault } from "./interop-default-D4l3hsYQ.js"; //#region src/rules/vitest.ts const vitestRules = async () => { return { ...(await interopDefault(import("@vitest/eslint-plugin"))).configs.recommended.rules, "vitest/consistent-test-it": ["error", { fn: "test", withinDescribe: "it" }], "vitest/consistent-vitest-vi": "error", "vitest/hoisted-apis-on-top": "error", "vitest/no-alias-methods": "error", "vitest/no-commented-out-tests": "error", "vitest/no-conditional-in-test": "error", "vitest/no-disabled-tests": "warn", "vitest/no-duplicate-hooks": "error", "vitest/no-focused-tests": "error", "vitest/no-hooks": "off", "vitest/no-identical-title": "error", "vitest/no-interpolation-in-snapshots": "error", "vitest/no-large-snapshots": "off", "vitest/no-mocks-import": "error", "vitest/no-restricted-matchers": "off", "vitest/no-restricted-vi-methods": "off", "vitest/no-standalone-expect": "error", "vitest/no-test-prefixes": "error", "vitest/no-test-return-statement": "error", "vitest/padding-around-all": "error", "vitest/prefer-called-once": "error", "vitest/prefer-called-times": "off", "vitest/prefer-called-with": "error", "vitest/prefer-comparison-matcher": "error", "vitest/prefer-each": "error", "vitest/prefer-equality-matcher": "error", "vitest/prefer-expect-assertions": "off", "vitest/prefer-expect-resolves": "error", "vitest/prefer-expect-type-of": "error", "vitest/prefer-hooks-in-order": "error", "vitest/prefer-hooks-on-top": "error", "vitest/prefer-lowercase-title": "off", "vitest/prefer-mock-promise-shorthand": "error", "vitest/prefer-snapshot-hint": "error", "vitest/prefer-spy-on": "off", "vitest/prefer-strict-boolean-matchers": "error", "vitest/prefer-strict-equal": "error", "vitest/prefer-to-be": "error", "vitest/prefer-to-contain": "error", "vitest/prefer-to-have-length": "error", "vitest/prefer-todo": "warn", "vitest/prefer-vi-mocked": "error", "vitest/require-hook": "error", "vitest/require-to-throw-message": "error", "vitest/require-top-level-describe": "off", "vitest/valid-expect": "error", "vitest/valid-expect-in-promise": "error", "vitest/valid-title": ["error", { mustMatch: { it: "^should" } }], "vitest/warn-todo": "warn" }; }; //#endregion //#region src/configs/vitest.ts async function vitestConfig() { const vitestPlugin = await interopDefault(import("@vitest/eslint-plugin")); return [{ files: GLOB_TESTS, ignores: GLOB_E2E, ...vitestPlugin.configs.recommended, name: "jimmy.codes/vitest", rules: await vitestRules() }]; } //#endregion export { vitestConfig as default };