UNPKG

@shayanthenerd/eslint-config

Version:

A modern, flexible ESLint configuration for enforcing best practices and maintaining a consistent coding style

47 lines (45 loc) 2.14 kB
import { globs } from "../utils/globs.js"; import { isEnabled } from "../utils/isEnabled.js"; import { getJavaScriptRules } from "../rules/javascript.js"; import { getVitestRules } from "../rules/vitest.js"; import { getPlaywrightRules } from "../rules/playwright.js"; import { getTypeScriptRules } from "../rules/typescript.js"; import typescriptESLint from "typescript-eslint"; import eslintPluginVitest from "@vitest/eslint-plugin"; import eslintPluginImportX from "eslint-plugin-import-x"; import eslintPluginPlaywright from "eslint-plugin-playwright"; //#region src/configs/oxlintOverrides.ts function getOXLintOverridesConfig(options) { const { vue, typescript, test: { vitest, playwright } } = options.configs; const vitestRules = getVitestRules(options); const javascriptRules = getJavaScriptRules(options); const typescriptRules = getTypeScriptRules(options); const playwrightRules = getPlaywrightRules(options); const oxlintOverridesConfig = { name: "shayanthenerd/oxlint/overrides", files: [ globs.src, vue ? globs.vue : "", vitest || playwright ? globs.test : "" ], plugins: { "vitest": eslintPluginVitest, "import-x": eslintPluginImportX, "playwright": eslintPluginPlaywright, "@typescript-eslint": typescriptESLint.plugin }, rules: { "max-depth": javascriptRules["max-depth"], "func-style": javascriptRules["func-style"], "max-nested-callbacks": javascriptRules["max-nested-callbacks"], "@typescript-eslint/explicit-module-boundary-types": typescriptRules["@typescript-eslint/explicit-module-boundary-types"], "@typescript-eslint/consistent-type-definitions": isEnabled(typescript) ? typescriptRules["@typescript-eslint/consistent-type-definitions"] : "off", "playwright/max-nested-describe": isEnabled(playwright) ? playwrightRules["playwright/max-nested-describe"] : "off", "vitest/consistent-test-it": isEnabled(vitest) ? vitestRules["vitest/consistent-test-it"] : "off", "vitest/max-nested-describe": isEnabled(vitest) ? vitestRules["vitest/max-nested-describe"] : "off" } }; return oxlintOverridesConfig; } //#endregion export { getOXLintOverridesConfig };