AT-based link agregator. Mirror of https://github.com/likeandscribe/frontpage

Refactor react and typescript lint configs out

tom.sherman.is 8b7b2219 ecc8b924

verified
+90 -84
+4 -4
packages/atproto-browser/eslint.config.mjs
··· 1 - import { defineConfig } from "@repo/eslint-config/next.js"; 2 - 3 - export default defineConfig(import.meta.dirname, [ 1 + import base from "@repo/eslint-config/next.js"; 2 + export default [ 3 + ...base, 4 4 { 5 5 rules: { 6 6 "no-restricted-imports": ["error", "next/link"], 7 7 }, 8 8 }, 9 - ]); 9 + ];
+12 -74
packages/eslint-config/next.js
··· 1 - import eslint from "@eslint/js"; 2 1 import tseslint from "typescript-eslint"; 3 - import reactCompiler from "eslint-plugin-react-compiler"; 2 + import typescript from "./typescript.js"; 3 + import react from "./react.js"; 4 4 // @ts-ignore no types 5 5 import next from "@next/eslint-plugin-next"; 6 - import jsxA11y from "eslint-plugin-jsx-a11y"; 7 - import reactHooks from "eslint-plugin-react-hooks"; 8 - import react from "eslint-plugin-react"; 9 - import { version as reactVersion } from "react"; 10 6 import turboRepo from "eslint-config-turbo/flat"; 11 7 12 - /** 13 - * @param {string} baseDirectory 14 - * @param {import("typescript-eslint").InfiniteDepthConfigWithExtends[]} configs 15 - */ 16 - export function defineConfig(baseDirectory, configs = []) { 17 - return tseslint.config( 18 - { 19 - ignores: ["**/.next/**", "**/.vercel/**"], 20 - }, 21 - next.flatConfig.recommended, 22 - next.flatConfig.coreWebVitals, 8 + export default tseslint.config( 9 + typescript, 10 + react, 11 + { 12 + ignores: ["**/.next/**", "**/.vercel/**"], 13 + }, 23 14 24 - ...turboRepo, 25 - 26 - eslint.configs.recommended, 27 - tseslint.configs.recommendedTypeChecked, 28 - reactCompiler.configs.recommended, 29 - reactHooks.configs["recommended-latest"], 30 - // @ts-expect-error 31 - react.configs.flat.recommended, 32 - jsxA11y.flatConfigs.recommended, 33 - { 34 - languageOptions: { 35 - parserOptions: { 36 - projectService: true, 37 - tsconfigRootDir: baseDirectory, 38 - }, 39 - }, 40 - 41 - settings: { 42 - react: { 43 - version: reactVersion, 44 - }, 45 - }, 15 + next.flatConfig.recommended, 16 + next.flatConfig.coreWebVitals, 46 17 47 - rules: { 48 - "react/react-in-jsx-scope": "off", 49 - "react/prop-types": "off", 50 - "react/no-array-index-key": "error", 51 - "@typescript-eslint/no-unsafe-assignment": "off", 52 - "@typescript-eslint/no-floating-promises": "error", 53 - "@typescript-eslint/no-misused-promises": "error", 54 - "@typescript-eslint/consistent-type-imports": [ 55 - "error", 56 - { 57 - fixStyle: "inline-type-imports", 58 - prefer: "type-imports", 59 - }, 60 - ], 61 - "@typescript-eslint/consistent-type-exports": [ 62 - "error", 63 - { fixMixedExportsWithInlineTypeSpecifier: true }, 64 - ], 65 - "@typescript-eslint/no-unused-vars": [ 66 - "error", 67 - { 68 - args: "all", 69 - argsIgnorePattern: "^_", 70 - caughtErrors: "all", 71 - caughtErrorsIgnorePattern: "^_", 72 - destructuredArrayIgnorePattern: "^_", 73 - varsIgnorePattern: "^_", 74 - ignoreRestSiblings: true, 75 - }, 76 - ], 77 - }, 78 - }, 79 - ...configs, 80 - ); 81 - } 18 + turboRepo, 19 + ); 82 20 83 21 // Bring @typescript-eslint/utils types into scope to solve a non-portable typescript issue caused by pnpm 84 22 /**
+27
packages/eslint-config/react.js
··· 1 + import tseslint from "typescript-eslint"; 2 + import jsxA11y from "eslint-plugin-jsx-a11y"; 3 + import reactHooks from "eslint-plugin-react-hooks"; 4 + import react from "eslint-plugin-react"; 5 + import { version as reactVersion } from "react"; 6 + import reactCompiler from "eslint-plugin-react-compiler"; 7 + 8 + export default tseslint.config( 9 + reactCompiler.configs.recommended, 10 + reactHooks.configs["recommended-latest"], 11 + // @ts-expect-error 12 + react.configs.flat.recommended, 13 + jsxA11y.flatConfigs.recommended, 14 + { 15 + settings: { 16 + react: { 17 + version: reactVersion, 18 + }, 19 + }, 20 + 21 + rules: { 22 + "react/react-in-jsx-scope": "off", 23 + "react/prop-types": "off", 24 + "react/no-array-index-key": "error", 25 + }, 26 + }, 27 + );
+1 -1
packages/eslint-config/tsconfig.json
··· 1 1 { 2 2 "extends": "@repo/typescript-config/base.json", 3 - "include": ["next.js"], 3 + "include": ["next.js", "typescript.js", "react.js"], 4 4 "compilerOptions": { 5 5 "checkJs": true, 6 6 "module": "NodeNext",
+42
packages/eslint-config/typescript.js
··· 1 + import eslint from "@eslint/js"; 2 + import tseslint from "typescript-eslint"; 3 + 4 + export default tseslint.config( 5 + eslint.configs.recommended, 6 + tseslint.configs.recommendedTypeChecked, 7 + { 8 + languageOptions: { 9 + parserOptions: { 10 + projectService: true, 11 + }, 12 + }, 13 + rules: { 14 + "@typescript-eslint/no-unsafe-assignment": "off", 15 + "@typescript-eslint/no-floating-promises": "error", 16 + "@typescript-eslint/no-misused-promises": "error", 17 + "@typescript-eslint/consistent-type-imports": [ 18 + "error", 19 + { 20 + fixStyle: "inline-type-imports", 21 + prefer: "type-imports", 22 + }, 23 + ], 24 + "@typescript-eslint/consistent-type-exports": [ 25 + "error", 26 + { fixMixedExportsWithInlineTypeSpecifier: true }, 27 + ], 28 + "@typescript-eslint/no-unused-vars": [ 29 + "error", 30 + { 31 + args: "all", 32 + argsIgnorePattern: "^_", 33 + caughtErrors: "all", 34 + caughtErrorsIgnorePattern: "^_", 35 + destructuredArrayIgnorePattern: "^_", 36 + varsIgnorePattern: "^_", 37 + ignoreRestSiblings: true, 38 + }, 39 + ], 40 + }, 41 + }, 42 + );
+2 -3
packages/frontpage/eslint.config.mjs
··· 1 - import { defineConfig } from "@repo/eslint-config/next.js"; 2 - 3 - export default defineConfig(import.meta.dirname); 1 + import base from "@repo/eslint-config/next.js"; 2 + export default base;
+2 -2
packages/unravel/eslint.config.mjs
··· 1 - import { defineConfig } from "@repo/eslint-config/next.js"; 1 + import base from "@repo/eslint-config/next.js"; 2 2 3 - export default defineConfig(import.meta.dirname); 3 + export default base;