@mlaursen/eslint-config 12.0.7 → 12.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -642,4 +642,4 @@ const configs = {
642
642
  };
643
643
 
644
644
  export { BASE_NAME, DEV_OFF_PROD_ERROR, DEV_WARNING_PROD_ERROR, JSX_FILES, TEST_FILES, TS_FILES, VITE_MAIN_FILES, configs, gitignore };
645
- //# sourceMappingURL=index.mjs.map
645
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/constants.ts","../src/base.ts","../src/jsxA11y.ts","../src/react.ts","../src/scripts.ts","../src/testing.ts","../src/typescript.ts","../src/unicorn.ts","../src/recommended.ts","../src/mui.ts","../src/testing-library.ts","../src/recommendedFrontend.ts","../src/gitignore.ts","../src/index.ts"],"sourcesContent":["export const DEV_WARNING_PROD_ERROR =\n process.env[\"NODE_ENV\"] === \"production\" ? \"error\" : \"warn\";\n\n/**\n * This is a \"temporary\" workaround until autofixable rules can be disabled with\n * a config option because of the \"autofix + format(+ save)?\" behavior. It\n * should be something closer to `DEV_WARN_PROD_ERROR_AND_FIX`\n */\nexport const DEV_OFF_PROD_ERROR =\n process.env[\"NODE_ENV\"] === \"production\" ? \"error\" : \"off\";\n\nexport const BASE_NAME = \"@mlaursen/eslint-config\";\n\nexport const TS_FILES = [\"**/*.{ts,tsx,mts,mtsx}\"];\n\nexport const TEST_FILES = [\n \"**/__tests__/**\",\n \"**/*.{spec,test}.{ts,tsx,js,jsx}\",\n];\n\nexport const JSX_FILES = [\"**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}\"];\n\nexport const VITE_MAIN_FILES = [\"**/main.tsx\"];\n","import eslint from \"@eslint/js\";\nimport { type Linter } from \"eslint\";\nimport { BASE_NAME, DEV_WARNING_PROD_ERROR } from \"./constants.js\";\n\n/**\n * @example\n * ```js\n * import { configs } from \"@mlaursen/eslint-config\";\n * import { defineConfig } from \"eslint/config\";\n *\n * export default defineConfig(configs.base);\n * ```\n */\nexport const base: Linter.Config[] = [\n eslint.configs.recommended,\n {\n name: `${BASE_NAME}/base`,\n rules: {\n // I use typescript instead\n \"no-undef\": \"off\",\n\n // You normally do not want `console.{whatever}` in prod but is fine for\n // development in debugging\n \"no-console\": DEV_WARNING_PROD_ERROR,\n\n \"no-var\": \"error\",\n \"no-use-before-define\": \"warn\",\n\n // I want to enforce all statements to require curly braces even if it\n // could be omitted for consistency\n curly: \"error\",\n\n // Since this is auto-fixable, I like `{ someproperty }` instead of\n // `{ someproperty: someproperty }`\n \"object-shorthand\": [\"error\", \"always\"],\n\n // This is about the same as `object-shorthand`. Only rename if it has to\n // be renamed\n \"no-useless-rename\": [\"error\"],\n\n \"no-eval\": \"error\",\n \"no-alert\": \"error\",\n \"no-lonely-if\": \"error\",\n \"no-else-return\": \"error\",\n eqeqeq: \"error\",\n\n // 100% stylistic, but do not allow `a = b = c = \"whatever\"` / `let a = whatever, b = whatever, c = whatever;`\n // these should be different statements\n \"no-multi-assign\": \"error\",\n \"no-sequences\": \"error\",\n\n // use template strings instead\n \"no-multi-str\": \"error\",\n\n // better to use new variables most of the time\n \"no-param-reassign\": \"error\",\n\n // i'd never hit these, but who trusts other people and AI?\n \"no-return-assign\": \"error\",\n \"no-script-url\": \"error\",\n },\n },\n];\n","import { type Linter } from \"eslint\";\nimport jsxA11yPlugin from \"eslint-plugin-jsx-a11y\";\nimport { BASE_NAME, JSX_FILES, TEST_FILES } from \"./constants.js\";\n\n/**\n * @example\n * ```ts\n * import { configs } from \"@mlaursen/eslint-config\";\n * import { defineConfig } from \"eslint/config\";\n *\n * export default defineConfig(configs.jsxA11y);\n * ```\n */\nexport const jsxA11y: Linter.Config[] = [\n {\n name: `${BASE_NAME}/jsx-a11y`,\n files: JSX_FILES,\n ...jsxA11yPlugin.flatConfigs.recommended,\n rules: {\n ...jsxA11yPlugin.flatConfigs.recommended.rules,\n // I **only** use autoFocus within dialogs which provide the correct\n // context for screen readers.\n \"jsx-a11y/no-autofocus\": \"off\",\n },\n },\n {\n name: `${BASE_NAME}/jsx-a11y/testing`,\n files: TEST_FILES,\n rules: {\n \"jsx-a11y/anchor-has-content\": \"off\",\n \"jsx-a11y/click-events-have-key-events\": \"off\",\n \"jsx-a11y/no-static-element-interactions\": \"off\",\n },\n },\n];\n","import { type Linter } from \"eslint\";\nimport reactPlugin from \"eslint-plugin-react\";\nimport reactHooksPlugin from \"eslint-plugin-react-hooks\";\nimport reactRefreshPlugin from \"eslint-plugin-react-refresh\";\nimport { BASE_NAME, JSX_FILES } from \"./constants.js\";\n\nexport type ReactRefreshConfig = keyof typeof reactRefreshPlugin.configs;\n\nexport interface ReactOptions {\n /**\n * Set to one of the `eslint-plugin-react-refresh` config names to enable.\n *\n * @example Vite\n * ```js\n * configs.react({\n * reactRefresh: \"vite\",\n * })\n * ```\n *\n * @example Next.js\n * ```js\n * configs.react({\n * reactRefresh: \"next\",\n * })\n * ```\n *\n * @example Recommended\n * ```js\n * configs.react({\n * reactRefresh: \"recommended\",\n * })\n * ```\n */\n reactRefresh?: ReactRefreshConfig;\n\n /**\n * Set to `true` to enable the react compiler eslint rules.\n *\n * @defaultValue `false`\n */\n reactCompiler?: boolean;\n}\n\n/**\n * @example\n * ```ts\n * import { configs } from \"@mlaursen/eslint-config\";\n * import { defineConfig } from \"eslint/config\";\n *\n * export default defineConfig(configs.react());\n *\n * // or with react compiler rules enabled\n * export default defineConfig(configs.react(true));\n * ```\n *\n * Enables:\n * - `eslint-plugin-react` with:\n * - flat.recommended\n * - flat['jsx-runtime']\n * - `eslint-plugin-react-hooks` with:\n * - recommended rules\n * - compiler rules (if `true` is provided)\n */\nexport const react = (options: ReactOptions = {}): Linter.Config[] => {\n const { reactRefresh, reactCompiler } = options;\n\n return [\n {\n ...reactPlugin.configs.flat[\"recommended\"],\n name: `${BASE_NAME}/react`,\n files: JSX_FILES,\n settings: {\n react: {\n version: \"detect\",\n },\n },\n rules: {\n ...reactPlugin.configs.flat[\"recommended\"]?.rules,\n ...reactPlugin.configs.flat[\"jsx-runtime\"]?.rules,\n },\n },\n {\n ...reactHooksPlugin.configs.flat.recommended,\n name: `${BASE_NAME}/react-hooks`,\n rules: {\n ...(reactCompiler && reactHooksPlugin.configs.flat.recommended.rules),\n \"react-hooks/rules-of-hooks\": \"error\",\n \"react-hooks/exhaustive-deps\": [\n \"error\",\n {\n additionalHooks: \"(useIsomorphicLayoutEffect)\",\n },\n ],\n },\n },\n ...(reactRefresh\n ? [\n {\n ...reactRefreshPlugin.configs[reactRefresh],\n name: `${BASE_NAME}/react-refresh`,\n ignores: [\"**/test-utils*\", \"**/test-utils/**\"],\n },\n ]\n : []),\n ];\n};\n","import { type Linter } from \"eslint\";\nimport { BASE_NAME } from \"./constants.js\";\n\n/**\n * @example\n * ```ts\n * import { configs } from \"@mlaursen/eslint-config\";\n * import { defineConfig } from \"eslint/config\";\n *\n * export default defineConfig(configs.scripts);\n * ```\n */\nexport const scripts: Linter.Config[] = [\n {\n name: `${BASE_NAME}/scripts`,\n files: [\"scripts/**\"],\n rules: {\n \"no-console\": \"off\",\n },\n },\n];\n","import vitestPlugin from \"@vitest/eslint-plugin\";\nimport { type Linter } from \"eslint\";\nimport jestPlugin from \"eslint-plugin-jest\";\nimport jestDomPlugin from \"eslint-plugin-jest-dom\";\nimport { BASE_NAME, DEV_OFF_PROD_ERROR, TEST_FILES } from \"./constants.js\";\n\nexport type TestFramework = \"jest\" | \"vitest\";\n\nexport interface TestOptions {\n /**\n * @defaultValue `\"vitest\"`\n */\n testFramework?: TestFramework;\n}\n\n/**\n * @example\n * ```ts\n * import { configs } from \"@mlaursen/eslint-config\";\n * import { defineConfig } from \"eslint/config\";\n *\n * export default defineConfig(configs.vitest);\n * ```\n */\nexport const vitest: Linter.Config[] = [\n {\n name: `${BASE_NAME}/vitest`,\n files: TEST_FILES,\n plugins: {\n vitest: vitestPlugin,\n },\n rules: {\n ...vitestPlugin.configs.recommended.rules,\n \"vitest/no-alias-methods\": \"error\",\n \"vitest/no-focused-tests\": DEV_OFF_PROD_ERROR,\n \"vitest/no-disabled-tests\": DEV_OFF_PROD_ERROR,\n \"vitest/no-duplicate-hooks\": \"error\",\n \"vitest/no-standalone-expect\": \"error\",\n \"vitest/prefer-expect-resolves\": \"error\",\n \"vitest/prefer-spy-on\": \"error\",\n \"vitest/prefer-vi-mocked\": \"error\",\n },\n },\n];\n\n/**\n * @example\n * ```ts\n * import { configs } from \"@mlaursen/eslint-config\";\n * import { defineConfig } from \"eslint/config\";\n *\n * export default defineConfig(configs.jest);\n * ```\n */\nexport const jest: Linter.Config[] = [\n {\n name: `${BASE_NAME}/jest`,\n files: TEST_FILES,\n ...jestPlugin.configs[\"flat/recommended\"],\n },\n];\n\n/**\n * @example\n * ```ts\n * import { configs } from \"@mlaursen/eslint-config\";\n * import { defineConfig } from \"eslint/config\";\n *\n * export default defineConfig([\n * ...configs.jest,\n * ...configs.jestDom,\n * ]);\n * ```\n */\nexport const jestDom: Linter.Config[] = [\n {\n name: `${BASE_NAME}/jest-dom`,\n files: TEST_FILES,\n ...jestDomPlugin.configs[\"flat/recommended\"],\n },\n];\n\n/**\n * @example\n * ```ts\n * import { configs } from \"@mlaursen/eslint-config\";\n * import { defineConfig } from \"eslint/config\";\n *\n * export default defineConfig(configs.testing({ testFramework: \"jest\" }));\n *\n * // or\n * export default defineConfig(configs.testing({ testFramework: \"vitest\" }));\n * ```\n */\nexport const testing = (options: TestOptions = {}): Linter.Config[] => {\n const { testFramework = \"vitest\" } = options;\n\n let config: Linter.Config[];\n switch (testFramework) {\n case \"jest\":\n config = jest;\n break;\n case \"vitest\":\n config = vitest;\n break;\n }\n\n return [...config, ...jestDom];\n};\n","import { type Linter } from \"eslint\";\nimport tseslint from \"typescript-eslint\";\nimport { base } from \"./base.js\";\nimport {\n BASE_NAME,\n TEST_FILES,\n TS_FILES,\n VITE_MAIN_FILES,\n} from \"./constants.js\";\n\nexport interface TypescriptOptions {\n /**\n * This is required when working in monorepos or when the\n * {@link strictTypeChecked} rules are enabled.\n *\n * @example\n * ```js\n * configs.recommended({\n * tsconfigRootDir: import.meta.dirname,\n * })\n * ```\n */\n tsconfigRootDir?: string;\n\n /**\n * The {@link tsconfigRootDir} must be set if this is `true`.\n *\n * @example\n * ```js\n * configs.recommended({\n * tsconfigRootDir: import.meta.dirname,\n * strictTypeChecked: process.env.STRICT_TYPING === \"true\",\n * })\n *\n * @defaultValue `false`\n */\n strictTypeChecked?: boolean;\n}\n\n/**\n * @example\n * ```ts\n * import { configs, gitignore } from \"@mlaursen/eslint-config\";\n * import { defineConfig } from \"eslint/config\";\n *\n * export default defineConfig([\n * gitignore(import.meta.url),\n * ...configs.typescript(),\n * ]);\n * ```\n */\nexport const typescript = (\n options: TypescriptOptions = {},\n): Linter.Config[] => {\n const { tsconfigRootDir, strictTypeChecked } = options;\n\n const configs: Linter.Config[] = [\n ...base,\n ...tseslint.configs.strict,\n {\n name: `${BASE_NAME}/typescript`,\n files: TS_FILES,\n rules: {\n // I normally do not want unified signatures since it helps improve type\n // inference with function overloading\n \"@typescript-eslint/unified-signatures\": \"off\",\n\n // I prefer specifying when something is used only as a type\n \"@typescript-eslint/consistent-type-imports\": [\n \"error\",\n { fixStyle: \"inline-type-imports\" },\n ],\n\n // I prefer shorthand syntax\n \"@typescript-eslint/array-type\": [\"error\", { default: \"array\" }],\n\n // I prefer using `interface` over `type = {}`\n \"@typescript-eslint/consistent-type-definitions\": [\n \"error\",\n \"interface\",\n ],\n\n // Allow expressions to work with react hooks. Annoying to have to\n // typedef each arrow function in a `useEffect` or `useCallback` when\n // it can be derived.\n \"@typescript-eslint/explicit-function-return-type\": [\n \"error\",\n {\n allowExpressions: true,\n // allow FC definitions for React\n allowTypedFunctionExpressions: true,\n },\n ],\n\n \"@typescript-eslint/no-unused-vars\": [\n \"error\",\n {\n argsIgnorePattern: \"^_\",\n varsIgnorePattern: \"^_\",\n },\n ],\n\n \"no-use-before-define\": \"off\",\n \"@typescript-eslint/no-use-before-define\": [\n \"warn\",\n { ignoreTypeReferences: true },\n ],\n },\n },\n {\n name: `${BASE_NAME}/typescript/tests`,\n files: TEST_FILES,\n rules: {\n // allow tests to be less strict\n \"@typescript-eslint/ban-ts-comment\": \"off\",\n \"@typescript-eslint/explicit-function-return-type\": \"off\",\n \"@typescript-eslint/no-empty-function\": \"off\",\n \"@typescript-eslint/no-explicit-any\": \"off\",\n \"@typescript-eslint/no-object-literal-type-assertion\": \"off\",\n \"@typescript-eslint/no-var-requires\": \"off\",\n },\n },\n {\n name: `${BASE_NAME}/typescript/vite`,\n files: VITE_MAIN_FILES,\n rules: {\n // allow `createRoot(document.getElementById(\"root\")).render(...)` for\n // `vite` without disabling eslint\n \"@typescript-eslint/no-non-null-assertion\": \"off\",\n },\n },\n ];\n\n if (tsconfigRootDir) {\n configs.push({\n name: `${BASE_NAME}/typescript-type-checking-language-options`,\n languageOptions: {\n parserOptions: {\n projectService: strictTypeChecked,\n tsconfigRootDir,\n },\n },\n });\n }\n\n if (strictTypeChecked) {\n configs.push(\n ...tseslint.configs.strictTypeCheckedOnly,\n {\n name: `${BASE_NAME}/typescript-type-checking`,\n files: TS_FILES,\n rules: {\n // I do not enable the `noUncheckedIndexedAccess` tsconfig option, so I\n // still need to verify that stuff exists. There are other cases where I\n // know it exists, so I can ignore those as well\n \"@typescript-eslint/no-unnecessary-condition\": \"off\",\n\n // I never use `this`\n \"@typescript-eslint/unbound-method\": \"off\",\n\n \"@typescript-eslint/restrict-template-expressions\": [\n \"error\",\n {\n allowNumber: true,\n },\n ],\n\n // I want to allow `onClick={async (event) => { ... }}`\n \"@typescript-eslint/no-misused-promises\": [\n \"error\",\n {\n checksVoidReturn: false,\n },\n ],\n },\n },\n {\n name: `${BASE_NAME}/typescript-type-checking/tests`,\n files: TEST_FILES,\n rules: {\n // like base typescript, can be less strict in tests\n \"@typescript-eslint/no-unsafe-return\": \"off\",\n \"@typescript-eslint/no-unsafe-assignment\": \"off\",\n \"@typescript-eslint/restrict-template-expressions\": \"off\",\n },\n },\n );\n }\n\n return configs;\n};\n","import { type Linter } from \"eslint\";\nimport { BASE_NAME, TEST_FILES, VITE_MAIN_FILES } from \"./constants.js\";\nimport eslintPluiginUnicorn from \"eslint-plugin-unicorn\";\n\nexport const unicorn: Linter.Config[] = [\n {\n ...eslintPluiginUnicorn.configs.recommended,\n name: `${BASE_NAME}/unicorn`,\n rules: {\n ...eslintPluiginUnicorn.configs.recommended.rules,\n\n // this flags `dist` and `dest` which is annoying\n \"unicorn/prevent-abbreviations\": \"off\",\n\n // I do not like using the default exports from `node:path`, `node:fs`,\n // etc\n \"unicorn/import-style\": \"off\",\n\n // I want PascalCase for React components/classes, camelCase for others.\n // Don't care enough to enforce through a rule and don't think it's\n // possible.\n \"unicorn/filename-case\": \"off\",\n\n // prettier instead\n \"unicorn/empty-brace-spaces\": \"off\",\n\n // I like `null`\n \"unicorn/no-null\": \"off\",\n\n // the description is incorrect since it attempts converting multi-line\n // statements to ternary which is awful:\n //\n // > This rule enforces the use of ternary expressions over 'simple'\n // > if-else statements, where 'simple' means the consequent and alternate\n // > are each one line and have the same basic type and form.\n \"unicorn/prefer-ternary\": \"off\",\n\n // I don't care about adding braces to switch cases. I'd prefer\n // `[\"error\", \"avoid\"]` more though since it only adds them when needed.\n \"unicorn/switch-case-braces\": \"off\",\n },\n },\n {\n name: `${BASE_NAME}/unicorn/vite`,\n files: VITE_MAIN_FILES,\n rules: {\n // allow `createRoot(document.getElementById(\"root\")).render(...)` for\n // `vite` without disabling eslint\n \"unicorn/prefer-query-selector\": \"off\",\n },\n },\n {\n name: `${BASE_NAME}/unicorn/testing`,\n files: TEST_FILES,\n rules: {\n // allow functions to be scoped to tests\n \"unicorn/consistent-function-scoping\": \"off\",\n },\n },\n];\n","import { type Linter } from \"eslint\";\nimport { scripts } from \"./scripts.js\";\nimport { testing, type TestOptions } from \"./testing.js\";\nimport { typescript, type TypescriptOptions } from \"./typescript.js\";\nimport { unicorn } from \"./unicorn.js\";\n\nexport interface RecommendedOptions extends TypescriptOptions, TestOptions {}\n\n/**\n * @example\n * ```ts\n * import { configs, gitignore } from \"@mlaursen/eslint-config\";\n * import { defineConfig } from \"eslint/config\";\n *\n * export default defineConfig([\n * gitignore(import.meta.url),\n * ...configs.recommended(),\n * ]);\n * ```\n */\nexport const recommended = (\n options: RecommendedOptions = {},\n): readonly Linter.Config[] => {\n return [...typescript(options), ...scripts, ...testing(options), ...unicorn];\n};\n","import { type Linter } from \"eslint\";\nimport { BASE_NAME, JSX_FILES } from \"./constants.js\";\n\nexport const mui: Linter.Config[] = [\n {\n name: `${BASE_NAME}/material-ui`,\n files: JSX_FILES,\n rules: {\n \"no-restricted-imports\": [\n \"error\",\n {\n // https://mui.com/material-ui/guides/minimizing-bundle-size/#enforce-best-practices-with-eslint\n patterns: [{ regex: \"^@mui/(?!(x-|utils))[^/]+$\" }],\n },\n ],\n },\n },\n];\n","import { type Linter } from \"eslint\";\nimport testingLibraryPlugin from \"eslint-plugin-testing-library\";\nimport { BASE_NAME, TEST_FILES } from \"./constants.js\";\n\n/**\n * @example\n * ```ts\n * import { configs } from \"@mlaursen/eslint-config\";\n * import { defineConfig } from \"eslint/config\";\n *\n * export default defineConfig([\n * ...configs.react,\n * ...configs.jest,\n * ...configs.jestDom,\n * ...configs.testingLibraryReact\n * ]);\n * ```\n *\n * NOTE: Only choose this or the {@link testingLibraryDom}. Do not use\n * both.\n */\nexport const testingLibraryReact: Linter.Config[] = [\n {\n name: `${BASE_NAME}/testing-library/react`,\n files: TEST_FILES,\n ...testingLibraryPlugin.configs[\"flat/react\"],\n rules: {\n ...testingLibraryPlugin.configs[\"flat/react\"].rules,\n // it can be useful to reassign screen.* queries without reusing to\n // verify it still exists\n \"no-useless-assignment\": \"off\",\n },\n },\n];\n\n/**\n * @example\n * ```ts\n * import { configs, defineConfig } from \"@mlaursen/eslint-config\";\n *\n * export default defineConfig([\n * ...configs.jest,\n * ...configs.jestDom,\n * ...configs.testingLibraryDom\n * ]);\n * ```\n *\n * NOTE: Only choose this or the {@link testingLibraryReact}. Do not use\n * both.\n */\nexport const testingLibraryDom: Linter.Config[] = [\n {\n name: `${BASE_NAME}/testing-library/dom`,\n files: TEST_FILES,\n ...testingLibraryPlugin.configs[\"flat/dom\"],\n rules: {\n ...testingLibraryPlugin.configs[\"flat/dom\"].rules,\n // it can be useful to reassign screen.* queries without reusing to\n // verify it still exists\n \"no-useless-assignment\": \"off\",\n },\n },\n];\n","import { type Linter } from \"eslint\";\nimport { jsxA11y } from \"./jsxA11y.js\";\nimport { mui } from \"./mui.js\";\nimport { react, type ReactOptions } from \"./react.js\";\nimport { recommended, type RecommendedOptions } from \"./recommended.js\";\nimport { testingLibraryReact } from \"./testing-library.js\";\n\nexport interface RecommendedFrontendOptions\n extends RecommendedOptions, ReactOptions {}\n\n/**\n * @example\n * ```ts\n * import { configs, gitignore } from \"@mlaursen/eslint-config\";\n * import { defineConfig } from \"eslint/config\";\n *\n * export default defineConfig([\n * gitignore(import.meta.url),\n * ...configs.recommendedFrontend(),\n * ]);\n * ```\n */\nexport const recommendedFrontend = (\n options: RecommendedFrontendOptions = {},\n): readonly Linter.Config[] => {\n return [\n ...recommended(options),\n ...mui,\n ...react(options),\n ...jsxA11y,\n ...testingLibraryReact,\n ];\n};\n","import { includeIgnoreFile } from \"@eslint/compat\";\nimport { type Linter } from \"eslint\";\nimport { fileURLToPath } from \"node:url\";\n\n/**\n * @example\n * ```ts\n * import { configs, gitignore } from \"@mlaursen/eslint-config\";\n * import { defineConfig } from \"eslint/config\";\n *\n * export default defineConfig([gitignore(import.meta.url), ...configs.typescript]);\n * ```\n *\n * @example .gitignore in a different folder\n * ```ts\n * import { configs, gitignore } from \"@mlaursen/eslint-config\";\n * import { defineConfig } from \"eslint/config\";\n * import { join } from \"node:path\";\n *\n * export default defineConfig([\n * gitignore(join(import.meta.url, \"..\", \"..\")),\n * ...configs.typescript,\n * ]);\n * ```\n */\nexport function gitignore(importMetaUrl: string): Linter.Config {\n return includeIgnoreFile(fileURLToPath(new URL(\".gitignore\", importMetaUrl)));\n}\n","import { base } from \"./base.js\";\n\nimport { jsxA11y } from \"./jsxA11y.js\";\nimport { react } from \"./react.js\";\nimport { recommended } from \"./recommended.js\";\nimport { recommendedFrontend } from \"./recommendedFrontend.js\";\nimport { scripts } from \"./scripts.js\";\nimport { testingLibraryDom, testingLibraryReact } from \"./testing-library.js\";\nimport { jest, jestDom, testing, vitest } from \"./testing.js\";\nimport { typescript } from \"./typescript.js\";\nimport { unicorn } from \"./unicorn.js\";\n\nexport * from \"./constants.js\";\n\ninterface EslintConfigs {\n recommended: typeof recommended;\n recommendedFrontend: typeof recommendedFrontend;\n\n base: typeof base;\n jest: typeof jest;\n jestDom: typeof jestDom;\n jsxA11y: typeof jsxA11y;\n react: typeof react;\n scripts: typeof scripts;\n testing: typeof testing;\n testingLibraryDom: typeof testingLibraryDom;\n testingLibraryReact: typeof testingLibraryReact;\n typescript: typeof typescript;\n unicorn: typeof unicorn;\n vitest: typeof vitest;\n}\n\nexport const configs: Readonly<EslintConfigs> = {\n recommended,\n recommendedFrontend,\n\n base,\n jest,\n jestDom,\n react,\n typescript,\n testingLibraryDom,\n testingLibraryReact,\n scripts,\n jsxA11y,\n testing,\n vitest,\n unicorn,\n};\n\nexport { gitignore } from \"./gitignore.js\";\n"],"names":["DEV_WARNING_PROD_ERROR","process","env","DEV_OFF_PROD_ERROR","BASE_NAME","TS_FILES","TEST_FILES","JSX_FILES","VITE_MAIN_FILES","base","eslint","configs","recommended","name","rules","curly","eqeqeq","jsxA11y","files","jsxA11yPlugin","flatConfigs","react","options","reactRefresh","reactCompiler","reactPlugin","flat","settings","version","reactHooksPlugin","additionalHooks","reactRefreshPlugin","ignores","scripts","vitest","plugins","vitestPlugin","jest","jestPlugin","jestDom","jestDomPlugin","testing","testFramework","config","typescript","tsconfigRootDir","strictTypeChecked","tseslint","strict","fixStyle","default","allowExpressions","allowTypedFunctionExpressions","argsIgnorePattern","varsIgnorePattern","ignoreTypeReferences","push","languageOptions","parserOptions","projectService","strictTypeCheckedOnly","allowNumber","checksVoidReturn","unicorn","eslintPluiginUnicorn","mui","patterns","regex","testingLibraryReact","testingLibraryPlugin","testingLibraryDom","recommendedFrontend","gitignore","importMetaUrl","includeIgnoreFile","fileURLToPath","URL"],"mappings":";;;;;;;;;;;;;;AAAO,MAAMA,yBACXC,OAAAA,CAAQC,GAAG,CAAC,UAAA,CAAW,KAAK,YAAA,GAAe,OAAA,GAAU;AAEvD;;;;IAKO,MAAMC,kBAAAA,GACXF,OAAAA,CAAQC,GAAG,CAAC,UAAA,CAAW,KAAK,YAAA,GAAe,OAAA,GAAU;AAEhD,MAAME,YAAY;MAEZC,QAAAA,GAAW;AAAC,IAAA;;MAEZC,UAAAA,GAAa;AACxB,IAAA,iBAAA;AACA,IAAA;;MAGWC,SAAAA,GAAY;AAAC,IAAA;;MAEbC,eAAAA,GAAkB;AAAC,IAAA;;;AClBhC;;;;;;;;IASO,MAAMC,IAAAA,GAAwB;IACnCC,MAAAA,CAAOC,OAAO,CAACC,WAAW;AAC1B,IAAA;QACEC,IAAAA,EAAM,CAAA,EAAGT,SAAAA,CAAU,KAAK,CAAC;QACzBU,KAAAA,EAAO;;YAEL,UAAA,EAAY,KAAA;;;YAIZ,YAAA,EAAcd,sBAAAA;YAEd,QAAA,EAAU,OAAA;YACV,sBAAA,EAAwB,MAAA;;;YAIxBe,KAAAA,EAAO,OAAA;;;YAIP,kBAAA,EAAoB;AAAC,gBAAA,OAAA;AAAS,gBAAA;AAAS,aAAA;;;YAIvC,mBAAA,EAAqB;AAAC,gBAAA;AAAQ,aAAA;YAE9B,SAAA,EAAW,OAAA;YACX,UAAA,EAAY,OAAA;YACZ,cAAA,EAAgB,OAAA;YAChB,gBAAA,EAAkB,OAAA;YAClBC,MAAAA,EAAQ,OAAA;;;YAIR,iBAAA,EAAmB,OAAA;YACnB,cAAA,EAAgB,OAAA;;YAGhB,cAAA,EAAgB,O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;AACA0B,IAAAA,iBAAAA;AACAF,IAAAA,mBAAAA;AACAnC,IAAAA,OAAAA;AACAhB,IAAAA,OAAAA;AACAwB,IAAAA,OAAAA;AACAP,IAAAA,MAAAA;AACA6B,IAAAA;AACF;;;;"}
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@mlaursen/eslint-config",
3
- "version": "12.0.7",
3
+ "version": "12.0.8",
4
4
  "description": "An eslint config used by mlaursen for most projects.",
5
5
  "type": "module",
6
6
  "exports": {
7
- ".": "./dist/index.mjs",
7
+ ".": "./dist/index.js",
8
8
  "./package.json": "./package.json"
9
9
  },
10
10
  "author": "Mikkel Laursen <mlaursen03@gmail.com>",
@@ -22,14 +22,14 @@
22
22
  ],
23
23
  "license": "MIT",
24
24
  "dependencies": {
25
- "@eslint/compat": "^2.0.4",
26
- "@eslint/core": "^1.2.0",
25
+ "@eslint/compat": "^2.0.5",
26
+ "@eslint/core": "^1.2.1",
27
27
  "@eslint/js": "^9.39.4",
28
28
  "@types/eslint-plugin-jsx-a11y": "^6.10.1",
29
- "@typescript-eslint/utils": "^8.58.0",
30
- "@vitest/eslint-plugin": "^1.6.14",
29
+ "@typescript-eslint/utils": "^8.58.2",
30
+ "@vitest/eslint-plugin": "^1.6.16",
31
31
  "eslint": "^9.39.4",
32
- "eslint-plugin-jest": "^29.15.1",
32
+ "eslint-plugin-jest": "^29.15.2",
33
33
  "eslint-plugin-jest-dom": "^5.5.0",
34
34
  "eslint-plugin-jsx-a11y": "^6.10.2",
35
35
  "eslint-plugin-react": "^7.37.5",
@@ -37,13 +37,13 @@
37
37
  "eslint-plugin-react-refresh": "^0.5.2",
38
38
  "eslint-plugin-testing-library": "^7.16.2",
39
39
  "eslint-plugin-unicorn": "^64.0.0",
40
- "typescript-eslint": "^8.58.0"
40
+ "typescript-eslint": "^8.58.2"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@rollup/plugin-node-resolve": "^16.0.3",
44
44
  "@types/node": "^24.12.2",
45
45
  "concurrently": "^9.2.1",
46
- "prettier": "^3.8.1",
46
+ "prettier": "^3.8.3",
47
47
  "rollup": "^4.60.1",
48
48
  "rollup-plugin-dts": "^6.4.1",
49
49
  "rollup-plugin-swc3": "^0.12.1",
@@ -19,7 +19,7 @@ export interface RecommendedOptions extends TypescriptOptions, TestOptions {}
19
19
  * ```
20
20
  */
21
21
  export const recommended = (
22
- options: RecommendedOptions = {}
22
+ options: RecommendedOptions = {},
23
23
  ): readonly Linter.Config[] => {
24
24
  return [...typescript(options), ...scripts, ...testing(options), ...unicorn];
25
25
  };
@@ -21,7 +21,7 @@ export interface RecommendedFrontendOptions
21
21
  * ```
22
22
  */
23
23
  export const recommendedFrontend = (
24
- options: RecommendedFrontendOptions = {}
24
+ options: RecommendedFrontendOptions = {},
25
25
  ): readonly Linter.Config[] => {
26
26
  return [
27
27
  ...recommended(options),
package/src/typescript.ts CHANGED
@@ -50,7 +50,7 @@ export interface TypescriptOptions {
50
50
  * ```
51
51
  */
52
52
  export const typescript = (
53
- options: TypescriptOptions = {}
53
+ options: TypescriptOptions = {},
54
54
  ): Linter.Config[] => {
55
55
  const { tsconfigRootDir, strictTypeChecked } = options;
56
56
 
@@ -183,7 +183,7 @@ export const typescript = (
183
183
  "@typescript-eslint/no-unsafe-assignment": "off",
184
184
  "@typescript-eslint/restrict-template-expressions": "off",
185
185
  },
186
- }
186
+ },
187
187
  );
188
188
  }
189
189
 
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","sources":["../src/constants.ts","../src/base.ts","../src/jsxA11y.ts","../src/react.ts","../src/scripts.ts","../src/testing.ts","../src/typescript.ts","../src/unicorn.ts","../src/recommended.ts","../src/mui.ts","../src/testing-library.ts","../src/recommendedFrontend.ts","../src/gitignore.ts","../src/index.ts"],"sourcesContent":["export const DEV_WARNING_PROD_ERROR =\n process.env[\"NODE_ENV\"] === \"production\" ? \"error\" : \"warn\";\n\n/**\n * This is a \"temporary\" workaround until autofixable rules can be disabled with\n * a config option because of the \"autofix + format(+ save)?\" behavior. It\n * should be something closer to `DEV_WARN_PROD_ERROR_AND_FIX`\n */\nexport const DEV_OFF_PROD_ERROR =\n process.env[\"NODE_ENV\"] === \"production\" ? \"error\" : \"off\";\n\nexport const BASE_NAME = \"@mlaursen/eslint-config\";\n\nexport const TS_FILES = [\"**/*.{ts,tsx,mts,mtsx}\"];\n\nexport const TEST_FILES = [\n \"**/__tests__/**\",\n \"**/*.{spec,test}.{ts,tsx,js,jsx}\",\n];\n\nexport const JSX_FILES = [\"**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}\"];\n\nexport const VITE_MAIN_FILES = [\"**/main.tsx\"];\n","import eslint from \"@eslint/js\";\nimport { type Linter } from \"eslint\";\nimport { BASE_NAME, DEV_WARNING_PROD_ERROR } from \"./constants.js\";\n\n/**\n * @example\n * ```js\n * import { configs } from \"@mlaursen/eslint-config\";\n * import { defineConfig } from \"eslint/config\";\n *\n * export default defineConfig(configs.base);\n * ```\n */\nexport const base: Linter.Config[] = [\n eslint.configs.recommended,\n {\n name: `${BASE_NAME}/base`,\n rules: {\n // I use typescript instead\n \"no-undef\": \"off\",\n\n // You normally do not want `console.{whatever}` in prod but is fine for\n // development in debugging\n \"no-console\": DEV_WARNING_PROD_ERROR,\n\n \"no-var\": \"error\",\n \"no-use-before-define\": \"warn\",\n\n // I want to enforce all statements to require curly braces even if it\n // could be omitted for consistency\n curly: \"error\",\n\n // Since this is auto-fixable, I like `{ someproperty }` instead of\n // `{ someproperty: someproperty }`\n \"object-shorthand\": [\"error\", \"always\"],\n\n // This is about the same as `object-shorthand`. Only rename if it has to\n // be renamed\n \"no-useless-rename\": [\"error\"],\n\n \"no-eval\": \"error\",\n \"no-alert\": \"error\",\n \"no-lonely-if\": \"error\",\n \"no-else-return\": \"error\",\n eqeqeq: \"error\",\n\n // 100% stylistic, but do not allow `a = b = c = \"whatever\"` / `let a = whatever, b = whatever, c = whatever;`\n // these should be different statements\n \"no-multi-assign\": \"error\",\n \"no-sequences\": \"error\",\n\n // use template strings instead\n \"no-multi-str\": \"error\",\n\n // better to use new variables most of the time\n \"no-param-reassign\": \"error\",\n\n // i'd never hit these, but who trusts other people and AI?\n \"no-return-assign\": \"error\",\n \"no-script-url\": \"error\",\n },\n },\n];\n","import { type Linter } from \"eslint\";\nimport jsxA11yPlugin from \"eslint-plugin-jsx-a11y\";\nimport { BASE_NAME, JSX_FILES, TEST_FILES } from \"./constants.js\";\n\n/**\n * @example\n * ```ts\n * import { configs } from \"@mlaursen/eslint-config\";\n * import { defineConfig } from \"eslint/config\";\n *\n * export default defineConfig(configs.jsxA11y);\n * ```\n */\nexport const jsxA11y: Linter.Config[] = [\n {\n name: `${BASE_NAME}/jsx-a11y`,\n files: JSX_FILES,\n ...jsxA11yPlugin.flatConfigs.recommended,\n rules: {\n ...jsxA11yPlugin.flatConfigs.recommended.rules,\n // I **only** use autoFocus within dialogs which provide the correct\n // context for screen readers.\n \"jsx-a11y/no-autofocus\": \"off\",\n },\n },\n {\n name: `${BASE_NAME}/jsx-a11y/testing`,\n files: TEST_FILES,\n rules: {\n \"jsx-a11y/anchor-has-content\": \"off\",\n \"jsx-a11y/click-events-have-key-events\": \"off\",\n \"jsx-a11y/no-static-element-interactions\": \"off\",\n },\n },\n];\n","import { type Linter } from \"eslint\";\nimport reactPlugin from \"eslint-plugin-react\";\nimport reactHooksPlugin from \"eslint-plugin-react-hooks\";\nimport reactRefreshPlugin from \"eslint-plugin-react-refresh\";\nimport { BASE_NAME, JSX_FILES } from \"./constants.js\";\n\nexport type ReactRefreshConfig = keyof typeof reactRefreshPlugin.configs;\n\nexport interface ReactOptions {\n /**\n * Set to one of the `eslint-plugin-react-refresh` config names to enable.\n *\n * @example Vite\n * ```js\n * configs.react({\n * reactRefresh: \"vite\",\n * })\n * ```\n *\n * @example Next.js\n * ```js\n * configs.react({\n * reactRefresh: \"next\",\n * })\n * ```\n *\n * @example Recommended\n * ```js\n * configs.react({\n * reactRefresh: \"recommended\",\n * })\n * ```\n */\n reactRefresh?: ReactRefreshConfig;\n\n /**\n * Set to `true` to enable the react compiler eslint rules.\n *\n * @defaultValue `false`\n */\n reactCompiler?: boolean;\n}\n\n/**\n * @example\n * ```ts\n * import { configs } from \"@mlaursen/eslint-config\";\n * import { defineConfig } from \"eslint/config\";\n *\n * export default defineConfig(configs.react());\n *\n * // or with react compiler rules enabled\n * export default defineConfig(configs.react(true));\n * ```\n *\n * Enables:\n * - `eslint-plugin-react` with:\n * - flat.recommended\n * - flat['jsx-runtime']\n * - `eslint-plugin-react-hooks` with:\n * - recommended rules\n * - compiler rules (if `true` is provided)\n */\nexport const react = (options: ReactOptions = {}): Linter.Config[] => {\n const { reactRefresh, reactCompiler } = options;\n\n return [\n {\n ...reactPlugin.configs.flat[\"recommended\"],\n name: `${BASE_NAME}/react`,\n files: JSX_FILES,\n settings: {\n react: {\n version: \"detect\",\n },\n },\n rules: {\n ...reactPlugin.configs.flat[\"recommended\"]?.rules,\n ...reactPlugin.configs.flat[\"jsx-runtime\"]?.rules,\n },\n },\n {\n ...reactHooksPlugin.configs.flat.recommended,\n name: `${BASE_NAME}/react-hooks`,\n rules: {\n ...(reactCompiler && reactHooksPlugin.configs.flat.recommended.rules),\n \"react-hooks/rules-of-hooks\": \"error\",\n \"react-hooks/exhaustive-deps\": [\n \"error\",\n {\n additionalHooks: \"(useIsomorphicLayoutEffect)\",\n },\n ],\n },\n },\n ...(reactRefresh\n ? [\n {\n ...reactRefreshPlugin.configs[reactRefresh],\n name: `${BASE_NAME}/react-refresh`,\n ignores: [\"**/test-utils*\", \"**/test-utils/**\"],\n },\n ]\n : []),\n ];\n};\n","import { type Linter } from \"eslint\";\nimport { BASE_NAME } from \"./constants.js\";\n\n/**\n * @example\n * ```ts\n * import { configs } from \"@mlaursen/eslint-config\";\n * import { defineConfig } from \"eslint/config\";\n *\n * export default defineConfig(configs.scripts);\n * ```\n */\nexport const scripts: Linter.Config[] = [\n {\n name: `${BASE_NAME}/scripts`,\n files: [\"scripts/**\"],\n rules: {\n \"no-console\": \"off\",\n },\n },\n];\n","import vitestPlugin from \"@vitest/eslint-plugin\";\nimport { type Linter } from \"eslint\";\nimport jestPlugin from \"eslint-plugin-jest\";\nimport jestDomPlugin from \"eslint-plugin-jest-dom\";\nimport { BASE_NAME, DEV_OFF_PROD_ERROR, TEST_FILES } from \"./constants.js\";\n\nexport type TestFramework = \"jest\" | \"vitest\";\n\nexport interface TestOptions {\n /**\n * @defaultValue `\"vitest\"`\n */\n testFramework?: TestFramework;\n}\n\n/**\n * @example\n * ```ts\n * import { configs } from \"@mlaursen/eslint-config\";\n * import { defineConfig } from \"eslint/config\";\n *\n * export default defineConfig(configs.vitest);\n * ```\n */\nexport const vitest: Linter.Config[] = [\n {\n name: `${BASE_NAME}/vitest`,\n files: TEST_FILES,\n plugins: {\n vitest: vitestPlugin,\n },\n rules: {\n ...vitestPlugin.configs.recommended.rules,\n \"vitest/no-alias-methods\": \"error\",\n \"vitest/no-focused-tests\": DEV_OFF_PROD_ERROR,\n \"vitest/no-disabled-tests\": DEV_OFF_PROD_ERROR,\n \"vitest/no-duplicate-hooks\": \"error\",\n \"vitest/no-standalone-expect\": \"error\",\n \"vitest/prefer-expect-resolves\": \"error\",\n \"vitest/prefer-spy-on\": \"error\",\n \"vitest/prefer-vi-mocked\": \"error\",\n },\n },\n];\n\n/**\n * @example\n * ```ts\n * import { configs } from \"@mlaursen/eslint-config\";\n * import { defineConfig } from \"eslint/config\";\n *\n * export default defineConfig(configs.jest);\n * ```\n */\nexport const jest: Linter.Config[] = [\n {\n name: `${BASE_NAME}/jest`,\n files: TEST_FILES,\n ...jestPlugin.configs[\"flat/recommended\"],\n },\n];\n\n/**\n * @example\n * ```ts\n * import { configs } from \"@mlaursen/eslint-config\";\n * import { defineConfig } from \"eslint/config\";\n *\n * export default defineConfig([\n * ...configs.jest,\n * ...configs.jestDom,\n * ]);\n * ```\n */\nexport const jestDom: Linter.Config[] = [\n {\n name: `${BASE_NAME}/jest-dom`,\n files: TEST_FILES,\n ...jestDomPlugin.configs[\"flat/recommended\"],\n },\n];\n\n/**\n * @example\n * ```ts\n * import { configs } from \"@mlaursen/eslint-config\";\n * import { defineConfig } from \"eslint/config\";\n *\n * export default defineConfig(configs.testing({ testFramework: \"jest\" }));\n *\n * // or\n * export default defineConfig(configs.testing({ testFramework: \"vitest\" }));\n * ```\n */\nexport const testing = (options: TestOptions = {}): Linter.Config[] => {\n const { testFramework = \"vitest\" } = options;\n\n let config: Linter.Config[];\n switch (testFramework) {\n case \"jest\":\n config = jest;\n break;\n case \"vitest\":\n config = vitest;\n break;\n }\n\n return [...config, ...jestDom];\n};\n","import { type Linter } from \"eslint\";\nimport tseslint from \"typescript-eslint\";\nimport { base } from \"./base.js\";\nimport {\n BASE_NAME,\n TEST_FILES,\n TS_FILES,\n VITE_MAIN_FILES,\n} from \"./constants.js\";\n\nexport interface TypescriptOptions {\n /**\n * This is required when working in monorepos or when the\n * {@link strictTypeChecked} rules are enabled.\n *\n * @example\n * ```js\n * configs.recommended({\n * tsconfigRootDir: import.meta.dirname,\n * })\n * ```\n */\n tsconfigRootDir?: string;\n\n /**\n * The {@link tsconfigRootDir} must be set if this is `true`.\n *\n * @example\n * ```js\n * configs.recommended({\n * tsconfigRootDir: import.meta.dirname,\n * strictTypeChecked: process.env.STRICT_TYPING === \"true\",\n * })\n *\n * @defaultValue `false`\n */\n strictTypeChecked?: boolean;\n}\n\n/**\n * @example\n * ```ts\n * import { configs, gitignore } from \"@mlaursen/eslint-config\";\n * import { defineConfig } from \"eslint/config\";\n *\n * export default defineConfig([\n * gitignore(import.meta.url),\n * ...configs.typescript(),\n * ]);\n * ```\n */\nexport const typescript = (\n options: TypescriptOptions = {}\n): Linter.Config[] => {\n const { tsconfigRootDir, strictTypeChecked } = options;\n\n const configs: Linter.Config[] = [\n ...base,\n ...tseslint.configs.strict,\n {\n name: `${BASE_NAME}/typescript`,\n files: TS_FILES,\n rules: {\n // I normally do not want unified signatures since it helps improve type\n // inference with function overloading\n \"@typescript-eslint/unified-signatures\": \"off\",\n\n // I prefer specifying when something is used only as a type\n \"@typescript-eslint/consistent-type-imports\": [\n \"error\",\n { fixStyle: \"inline-type-imports\" },\n ],\n\n // I prefer shorthand syntax\n \"@typescript-eslint/array-type\": [\"error\", { default: \"array\" }],\n\n // I prefer using `interface` over `type = {}`\n \"@typescript-eslint/consistent-type-definitions\": [\n \"error\",\n \"interface\",\n ],\n\n // Allow expressions to work with react hooks. Annoying to have to\n // typedef each arrow function in a `useEffect` or `useCallback` when\n // it can be derived.\n \"@typescript-eslint/explicit-function-return-type\": [\n \"error\",\n {\n allowExpressions: true,\n // allow FC definitions for React\n allowTypedFunctionExpressions: true,\n },\n ],\n\n \"@typescript-eslint/no-unused-vars\": [\n \"error\",\n {\n argsIgnorePattern: \"^_\",\n varsIgnorePattern: \"^_\",\n },\n ],\n\n \"no-use-before-define\": \"off\",\n \"@typescript-eslint/no-use-before-define\": [\n \"warn\",\n { ignoreTypeReferences: true },\n ],\n },\n },\n {\n name: `${BASE_NAME}/typescript/tests`,\n files: TEST_FILES,\n rules: {\n // allow tests to be less strict\n \"@typescript-eslint/ban-ts-comment\": \"off\",\n \"@typescript-eslint/explicit-function-return-type\": \"off\",\n \"@typescript-eslint/no-empty-function\": \"off\",\n \"@typescript-eslint/no-explicit-any\": \"off\",\n \"@typescript-eslint/no-object-literal-type-assertion\": \"off\",\n \"@typescript-eslint/no-var-requires\": \"off\",\n },\n },\n {\n name: `${BASE_NAME}/typescript/vite`,\n files: VITE_MAIN_FILES,\n rules: {\n // allow `createRoot(document.getElementById(\"root\")).render(...)` for\n // `vite` without disabling eslint\n \"@typescript-eslint/no-non-null-assertion\": \"off\",\n },\n },\n ];\n\n if (tsconfigRootDir) {\n configs.push({\n name: `${BASE_NAME}/typescript-type-checking-language-options`,\n languageOptions: {\n parserOptions: {\n projectService: strictTypeChecked,\n tsconfigRootDir,\n },\n },\n });\n }\n\n if (strictTypeChecked) {\n configs.push(\n ...tseslint.configs.strictTypeCheckedOnly,\n {\n name: `${BASE_NAME}/typescript-type-checking`,\n files: TS_FILES,\n rules: {\n // I do not enable the `noUncheckedIndexedAccess` tsconfig option, so I\n // still need to verify that stuff exists. There are other cases where I\n // know it exists, so I can ignore those as well\n \"@typescript-eslint/no-unnecessary-condition\": \"off\",\n\n // I never use `this`\n \"@typescript-eslint/unbound-method\": \"off\",\n\n \"@typescript-eslint/restrict-template-expressions\": [\n \"error\",\n {\n allowNumber: true,\n },\n ],\n\n // I want to allow `onClick={async (event) => { ... }}`\n \"@typescript-eslint/no-misused-promises\": [\n \"error\",\n {\n checksVoidReturn: false,\n },\n ],\n },\n },\n {\n name: `${BASE_NAME}/typescript-type-checking/tests`,\n files: TEST_FILES,\n rules: {\n // like base typescript, can be less strict in tests\n \"@typescript-eslint/no-unsafe-return\": \"off\",\n \"@typescript-eslint/no-unsafe-assignment\": \"off\",\n \"@typescript-eslint/restrict-template-expressions\": \"off\",\n },\n }\n );\n }\n\n return configs;\n};\n","import { type Linter } from \"eslint\";\nimport { BASE_NAME, TEST_FILES, VITE_MAIN_FILES } from \"./constants.js\";\nimport eslintPluiginUnicorn from \"eslint-plugin-unicorn\";\n\nexport const unicorn: Linter.Config[] = [\n {\n ...eslintPluiginUnicorn.configs.recommended,\n name: `${BASE_NAME}/unicorn`,\n rules: {\n ...eslintPluiginUnicorn.configs.recommended.rules,\n\n // this flags `dist` and `dest` which is annoying\n \"unicorn/prevent-abbreviations\": \"off\",\n\n // I do not like using the default exports from `node:path`, `node:fs`,\n // etc\n \"unicorn/import-style\": \"off\",\n\n // I want PascalCase for React components/classes, camelCase for others.\n // Don't care enough to enforce through a rule and don't think it's\n // possible.\n \"unicorn/filename-case\": \"off\",\n\n // prettier instead\n \"unicorn/empty-brace-spaces\": \"off\",\n\n // I like `null`\n \"unicorn/no-null\": \"off\",\n\n // the description is incorrect since it attempts converting multi-line\n // statements to ternary which is awful:\n //\n // > This rule enforces the use of ternary expressions over 'simple'\n // > if-else statements, where 'simple' means the consequent and alternate\n // > are each one line and have the same basic type and form.\n \"unicorn/prefer-ternary\": \"off\",\n\n // I don't care about adding braces to switch cases. I'd prefer\n // `[\"error\", \"avoid\"]` more though since it only adds them when needed.\n \"unicorn/switch-case-braces\": \"off\",\n },\n },\n {\n name: `${BASE_NAME}/unicorn/vite`,\n files: VITE_MAIN_FILES,\n rules: {\n // allow `createRoot(document.getElementById(\"root\")).render(...)` for\n // `vite` without disabling eslint\n \"unicorn/prefer-query-selector\": \"off\",\n },\n },\n {\n name: `${BASE_NAME}/unicorn/testing`,\n files: TEST_FILES,\n rules: {\n // allow functions to be scoped to tests\n \"unicorn/consistent-function-scoping\": \"off\",\n },\n },\n];\n","import { type Linter } from \"eslint\";\nimport { scripts } from \"./scripts.js\";\nimport { testing, type TestOptions } from \"./testing.js\";\nimport { typescript, type TypescriptOptions } from \"./typescript.js\";\nimport { unicorn } from \"./unicorn.js\";\n\nexport interface RecommendedOptions extends TypescriptOptions, TestOptions {}\n\n/**\n * @example\n * ```ts\n * import { configs, gitignore } from \"@mlaursen/eslint-config\";\n * import { defineConfig } from \"eslint/config\";\n *\n * export default defineConfig([\n * gitignore(import.meta.url),\n * ...configs.recommended(),\n * ]);\n * ```\n */\nexport const recommended = (\n options: RecommendedOptions = {}\n): readonly Linter.Config[] => {\n return [...typescript(options), ...scripts, ...testing(options), ...unicorn];\n};\n","import { type Linter } from \"eslint\";\nimport { BASE_NAME, JSX_FILES } from \"./constants.js\";\n\nexport const mui: Linter.Config[] = [\n {\n name: `${BASE_NAME}/material-ui`,\n files: JSX_FILES,\n rules: {\n \"no-restricted-imports\": [\n \"error\",\n {\n // https://mui.com/material-ui/guides/minimizing-bundle-size/#enforce-best-practices-with-eslint\n patterns: [{ regex: \"^@mui/(?!(x-|utils))[^/]+$\" }],\n },\n ],\n },\n },\n];\n","import { type Linter } from \"eslint\";\nimport testingLibraryPlugin from \"eslint-plugin-testing-library\";\nimport { BASE_NAME, TEST_FILES } from \"./constants.js\";\n\n/**\n * @example\n * ```ts\n * import { configs } from \"@mlaursen/eslint-config\";\n * import { defineConfig } from \"eslint/config\";\n *\n * export default defineConfig([\n * ...configs.react,\n * ...configs.jest,\n * ...configs.jestDom,\n * ...configs.testingLibraryReact\n * ]);\n * ```\n *\n * NOTE: Only choose this or the {@link testingLibraryDom}. Do not use\n * both.\n */\nexport const testingLibraryReact: Linter.Config[] = [\n {\n name: `${BASE_NAME}/testing-library/react`,\n files: TEST_FILES,\n ...testingLibraryPlugin.configs[\"flat/react\"],\n rules: {\n ...testingLibraryPlugin.configs[\"flat/react\"].rules,\n // it can be useful to reassign screen.* queries without reusing to\n // verify it still exists\n \"no-useless-assignment\": \"off\",\n },\n },\n];\n\n/**\n * @example\n * ```ts\n * import { configs, defineConfig } from \"@mlaursen/eslint-config\";\n *\n * export default defineConfig([\n * ...configs.jest,\n * ...configs.jestDom,\n * ...configs.testingLibraryDom\n * ]);\n * ```\n *\n * NOTE: Only choose this or the {@link testingLibraryReact}. Do not use\n * both.\n */\nexport const testingLibraryDom: Linter.Config[] = [\n {\n name: `${BASE_NAME}/testing-library/dom`,\n files: TEST_FILES,\n ...testingLibraryPlugin.configs[\"flat/dom\"],\n rules: {\n ...testingLibraryPlugin.configs[\"flat/dom\"].rules,\n // it can be useful to reassign screen.* queries without reusing to\n // verify it still exists\n \"no-useless-assignment\": \"off\",\n },\n },\n];\n","import { type Linter } from \"eslint\";\nimport { jsxA11y } from \"./jsxA11y.js\";\nimport { mui } from \"./mui.js\";\nimport { react, type ReactOptions } from \"./react.js\";\nimport { recommended, type RecommendedOptions } from \"./recommended.js\";\nimport { testingLibraryReact } from \"./testing-library.js\";\n\nexport interface RecommendedFrontendOptions\n extends RecommendedOptions, ReactOptions {}\n\n/**\n * @example\n * ```ts\n * import { configs, gitignore } from \"@mlaursen/eslint-config\";\n * import { defineConfig } from \"eslint/config\";\n *\n * export default defineConfig([\n * gitignore(import.meta.url),\n * ...configs.recommendedFrontend(),\n * ]);\n * ```\n */\nexport const recommendedFrontend = (\n options: RecommendedFrontendOptions = {}\n): readonly Linter.Config[] => {\n return [\n ...recommended(options),\n ...mui,\n ...react(options),\n ...jsxA11y,\n ...testingLibraryReact,\n ];\n};\n","import { includeIgnoreFile } from \"@eslint/compat\";\nimport { type Linter } from \"eslint\";\nimport { fileURLToPath } from \"node:url\";\n\n/**\n * @example\n * ```ts\n * import { configs, gitignore } from \"@mlaursen/eslint-config\";\n * import { defineConfig } from \"eslint/config\";\n *\n * export default defineConfig([gitignore(import.meta.url), ...configs.typescript]);\n * ```\n *\n * @example .gitignore in a different folder\n * ```ts\n * import { configs, gitignore } from \"@mlaursen/eslint-config\";\n * import { defineConfig } from \"eslint/config\";\n * import { join } from \"node:path\";\n *\n * export default defineConfig([\n * gitignore(join(import.meta.url, \"..\", \"..\")),\n * ...configs.typescript,\n * ]);\n * ```\n */\nexport function gitignore(importMetaUrl: string): Linter.Config {\n return includeIgnoreFile(fileURLToPath(new URL(\".gitignore\", importMetaUrl)));\n}\n","import { base } from \"./base.js\";\n\nimport { jsxA11y } from \"./jsxA11y.js\";\nimport { react } from \"./react.js\";\nimport { recommended } from \"./recommended.js\";\nimport { recommendedFrontend } from \"./recommendedFrontend.js\";\nimport { scripts } from \"./scripts.js\";\nimport { testingLibraryDom, testingLibraryReact } from \"./testing-library.js\";\nimport { jest, jestDom, testing, vitest } from \"./testing.js\";\nimport { typescript } from \"./typescript.js\";\nimport { unicorn } from \"./unicorn.js\";\n\nexport * from \"./constants.js\";\n\ninterface EslintConfigs {\n recommended: typeof recommended;\n recommendedFrontend: typeof recommendedFrontend;\n\n base: typeof base;\n jest: typeof jest;\n jestDom: typeof jestDom;\n jsxA11y: typeof jsxA11y;\n react: typeof react;\n scripts: typeof scripts;\n testing: typeof testing;\n testingLibraryDom: typeof testingLibraryDom;\n testingLibraryReact: typeof testingLibraryReact;\n typescript: typeof typescript;\n unicorn: typeof unicorn;\n vitest: typeof vitest;\n}\n\nexport const configs: Readonly<EslintConfigs> = {\n recommended,\n recommendedFrontend,\n\n base,\n jest,\n jestDom,\n react,\n typescript,\n testingLibraryDom,\n testingLibraryReact,\n scripts,\n jsxA11y,\n testing,\n vitest,\n unicorn,\n};\n\nexport { gitignore } from \"./gitignore.js\";\n"],"names":["DEV_WARNING_PROD_ERROR","process","env","DEV_OFF_PROD_ERROR","BASE_NAME","TS_FILES","TEST_FILES","JSX_FILES","VITE_MAIN_FILES","base","eslint","configs","recommended","name","rules","curly","eqeqeq","jsxA11y","files","jsxA11yPlugin","flatConfigs","react","options","reactRefresh","reactCompiler","reactPlugin","flat","settings","version","reactHooksPlugin","additionalHooks","reactRefreshPlugin","ignores","scripts","vitest","plugins","vitestPlugin","jest","jestPlugin","jestDom","jestDomPlugin","testing","testFramework","config","typescript","tsconfigRootDir","strictTypeChecked","tseslint","strict","fixStyle","default","allowExpressions","allowTypedFunctionExpressions","argsIgnorePattern","varsIgnorePattern","ignoreTypeReferences","push","languageOptions","parserOptions","projectService","strictTypeCheckedOnly","allowNumber","checksVoidReturn","unicorn","eslintPluiginUnicorn","mui","patterns","regex","testingLibraryReact","testingLibraryPlugin","testingLibraryDom","recommendedFrontend","gitignore","importMetaUrl","includeIgnoreFile","fileURLToPath","URL"],"mappings":";;;;;;;;;;;;;;AAAO,MAAMA,yBACXC,OAAAA,CAAQC,GAAG,CAAC,UAAA,CAAW,KAAK,YAAA,GAAe,OAAA,GAAU;AAEvD;;;;IAKO,MAAMC,kBAAAA,GACXF,OAAAA,CAAQC,GAAG,CAAC,UAAA,CAAW,KAAK,YAAA,GAAe,OAAA,GAAU;AAEhD,MAAME,YAAY;MAEZC,QAAAA,GAAW;AAAC,IAAA;;MAEZC,UAAAA,GAAa;AACxB,IAAA,iBAAA;AACA,IAAA;;MAGWC,SAAAA,GAAY;AAAC,IAAA;;MAEbC,eAAAA,GAAkB;AAAC,IAAA;;;AClBhC;;;;;;;;IASO,MAAMC,IAAAA,GAAwB;IACnCC,MAAAA,CAAOC,OAA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