Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .pkgs/configs/eslint.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ export declare const GLOB_TESTS: string[];
export declare const GLOB_CONFIGS: string[];
export declare const GLOB_SCRIPTS: string[];
export declare const GLOB_IGNORES: readonly ["**/node_modules", "**/dist", "**/package-lock.json", "**/yarn.lock", "**/pnpm-lock.yaml", "**/bun.lockb", "**/output", "**/coverage", "**/temp", "**/.temp", "**/tmp", "**/.tmp", "**/.history", "**/.vitepress/cache", "**/.nuxt", "**/.next", "**/.vercel", "**/.changeset", "**/.idea", "**/.cache", "**/.output", "**/.vite-inspect", "**/.yarn", "**/storybook-static", "**/.eslint-config-inspector", "**/playwright-report", "**/.astro", "**/.vinxi", "**/app.config.timestamp_*.js", "**/.tanstack", "**/.nitro", "**/CHANGELOG*.md", "**/*.min.*", "**/LICENSE*", "**/__snapshots__", "**/auto-import?(s).d.ts", "**/components.d.ts", "**/vite.config.ts.*.mjs", "**/*.gen.*", "!.storybook"];
export declare function buildIgnoreConfig(gitignore: string, ...rest: string[]): readonly [never, import("eslint/config").Config];
export declare function buildParserOptions(tsconfigRootDir?: string): {
readonly projectService: true;
readonly tsconfigRootDir: string;
};
export declare const strictTypeChecked: Linter.Config[];
export declare const disableTypeChecked: Linter.Config[];
/**
Expand Down
18 changes: 17 additions & 1 deletion .pkgs/configs/eslint.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { includeIgnoreFile } from "@eslint/compat";
import js from "@eslint/js";
import stylistic from "@stylistic/eslint-plugin";
import pluginDeMorgan from "eslint-plugin-de-morgan";
Expand All @@ -6,7 +7,7 @@ import { jsdoc } from "eslint-plugin-jsdoc";
import pluginPerfectionist from "eslint-plugin-perfectionist";
import pluginRegexp from "eslint-plugin-regexp";
import pluginUnicorn from "eslint-plugin-unicorn";
import { defineConfig } from "eslint/config";
import { defineConfig, globalIgnores } from "eslint/config";
import tseslint from "typescript-eslint";
export const GLOB_JS = ["**/*.{js,jsx,cjs,mjs}"];
export const GLOB_TS = ["**/*.{ts,tsx,cts,mts}"];
Expand Down Expand Up @@ -88,6 +89,21 @@ const p11tGroups = {
},
groups: ["id", "type", "meta", "alias", "rules", "unknown"],
};
export function buildIgnoreConfig(gitignore, ...rest) {
return [
includeIgnoreFile(gitignore, "Imported .gitignore patterns"),
globalIgnores([
...GLOB_IGNORES,
...rest,
]),
];
}
export function buildParserOptions(tsconfigRootDir = ".") {
return {
projectService: true,
tsconfigRootDir,
};
}
export const strictTypeChecked = defineConfig({
ignores: GLOB_JS,
}, {
Expand Down
20 changes: 19 additions & 1 deletion .pkgs/configs/eslint.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { includeIgnoreFile } from "@eslint/compat";
import js from "@eslint/js";
import stylistic from "@stylistic/eslint-plugin";
import type { Linter } from "eslint";
Expand All @@ -7,7 +8,7 @@ import { jsdoc } from "eslint-plugin-jsdoc";
import pluginPerfectionist from "eslint-plugin-perfectionist";
import pluginRegexp from "eslint-plugin-regexp";
import pluginUnicorn from "eslint-plugin-unicorn";
import { defineConfig } from "eslint/config";
import { defineConfig, globalIgnores } from "eslint/config";
import tseslint from "typescript-eslint";

export const GLOB_JS = ["**/*.{js,jsx,cjs,mjs}"];
Expand Down Expand Up @@ -98,6 +99,23 @@ const p11tGroups = {
groups: ["id", "type", "meta", "alias", "rules", "unknown"],
};

export function buildIgnoreConfig(gitignore: string, ...rest: string[]) {
return [
includeIgnoreFile(gitignore, "Imported .gitignore patterns") as never,
globalIgnores([
...GLOB_IGNORES,
...rest,
]),
] as const;
}

export function buildParserOptions(tsconfigRootDir: string = ".") {
return {
projectService: true,
tsconfigRootDir,
} as const;
}

export const strictTypeChecked: Linter.Config[] = defineConfig(
{
ignores: GLOB_JS,
Expand Down
9 changes: 6 additions & 3 deletions .pkgs/configs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,19 @@
"@eslint/js": "^9.39.1",
"@stylistic/eslint-plugin": "^5.5.0",
"eslint-plugin-de-morgan": "^2.0.0",
"eslint-plugin-function": "^0.0.34",
"eslint-plugin-function-rule": "^0.0.16",
"eslint-plugin-function": "^0.0.35",
"eslint-plugin-function-rule": "^0.0.17",
"eslint-plugin-jsdoc": "^61.2.1",
"eslint-plugin-perfectionist": "^4.15.1",
"eslint-plugin-regexp": "^2.10.0",
"eslint-plugin-unicorn": "^62.0.0",
"typescript-eslint": "^8.46.4"
"typescript-eslint": "^8.47.0"
},
"peerDependencies": {
"eslint": "^9.39.1",
"typedoc": "0.28.14",
"typedoc-plugin-markdown": "^4.9.0",
"typedoc-plugin-mdn-links": "^5.0.10",
"typescript": "^5.9.3"
}
}
4 changes: 2 additions & 2 deletions .pkgs/function-rules/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
"lint:ts": "tsc --noEmit"
},
"dependencies": {
"eslint-plugin-function-rule": "^0.0.16"
"eslint-plugin-function-rule": "^0.0.17"
},
"devDependencies": {
"eslint": "^9.39.1",
"tsdown": "^0.16.4"
"tsdown": "^0.16.5"
},
"peerDependencies": {
"eslint": "^9.39.1",
Expand Down
16 changes: 8 additions & 8 deletions apps/website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
"@eslint-react/eff": "workspace:*",
"bsky-react-post": "^0.1.7",
"clsx": "^2.1.1",
"effect": "^3.19.3",
"fumadocs-core": "16.0.11",
"effect": "^3.19.4",
"fumadocs-core": "16.0.13",
"fumadocs-docgen": "3.0.4",
"fumadocs-mdx": "13.0.8",
"fumadocs-mdx": "14.0.1",
"fumadocs-twoslash": "3.1.10",
"fumadocs-typescript": "4.0.13",
"fumadocs-ui": "16.0.11",
"lucide-react": "^0.553.0",
"fumadocs-ui": "16.0.13",
"lucide-react": "^0.554.0",
"next": "^16.0.3",
"next-view-transitions": "^0.3.4",
"react": "^19.2.0",
Expand All @@ -38,12 +38,12 @@
"@tailwindcss/postcss": "^4.1.17",
"@theguild/remark-mermaid": "^0.3.0",
"@tsconfig/next": "^2.0.4",
"@tsconfig/node22": "^22.0.3",
"@tsconfig/node22": "^22.0.5",
"@tsconfig/strictest": "^2.0.8",
"@types/hast": "^3.0.4",
"@types/mdx": "^2.0.13",
"@types/node": "^24.10.1",
"@types/react": "^19.2.5",
"@types/react": "^19.2.6",
"@types/react-dom": "^19.2.3",
"dedent": "^1.7.0",
"eslint": "^9.39.1",
Expand All @@ -55,6 +55,6 @@
"tailwindcss": "^4.1.17",
"tailwindcss-animated": "^2.0.0",
"typescript": "^5.9.3",
"typescript-eslint": "^8.46.4"
"typescript-eslint": "^8.47.0"
}
}
49 changes: 16 additions & 33 deletions eslint.config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { fileURLToPath } from "node:url";

import { includeIgnoreFile } from "@eslint/compat";
import {
GLOB_CONFIGS,
GLOB_IGNORES,
GLOB_SCRIPTS,
GLOB_TESTS,
GLOB_TS,
buildIgnoreConfig,
buildParserOptions,
disableProblematicEslintJsRules,
disableTypeChecked,
strictTypeChecked,
Expand All @@ -15,22 +15,22 @@ import { nullishComparison, templateExpression } from "@local/function-rules";
import { recommended as fastImportRecommended } from "eslint-plugin-fast-import";
import { functionRule } from "eslint-plugin-function-rule";
import pluginVitest from "eslint-plugin-vitest";
import { defineConfig, globalIgnores } from "eslint/config";
import { defineConfig } from "eslint/config";
import tseslint from "typescript-eslint";

const dirname = fileURLToPath(new URL(".", import.meta.url));
const gitignore = fileURLToPath(new URL(".gitignore", import.meta.url));
const ignoreConfig = buildIgnoreConfig(
fileURLToPath(new URL(".gitignore", import.meta.url)),
"apps",
"docs",
"test",
"examples",
"**/*.d.ts",
);

const parserOptions = buildParserOptions(fileURLToPath(new URL(".", import.meta.url)));

export default defineConfig(
includeIgnoreFile(gitignore, "Imported .gitignore patterns") as never,
globalIgnores([
...GLOB_IGNORES,
"apps",
"docs",
"test",
"examples",
"**/*.d.ts",
]),
...ignoreConfig,
{
extends: [
tseslint.configs.strictTypeChecked,
Expand All @@ -41,25 +41,11 @@ export default defineConfig(
files: GLOB_TS,
languageOptions: {
parser: tseslint.parser,
parserOptions: {
projectService: true,
tsconfigRootDir: dirname,
},
parserOptions,
},
plugins: {
"function-rule-1": functionRule(templateExpression()),
"function-rule-2": functionRule(nullishComparison()),

custom: functionRule((context) => ({
CallExpression(node) {
if (context.sourceCode.getText(node.callee) === "Date.now") {
context.report({
node,
message: "Don't use 'Date.now()'.",
});
}
},
})),
},
rules: {
"fast-import/no-unused-exports": "off",
Expand Down Expand Up @@ -91,10 +77,7 @@ export default defineConfig(
globals: {
...pluginVitest.environments.env.globals,
},
parserOptions: {
projectService: true,
tsconfigRootDir: dirname,
},
parserOptions,
},
plugins: {
vitest: pluginVitest,
Expand Down
6 changes: 3 additions & 3 deletions examples/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@
"@eslint/js": "^9.39.1",
"@next/eslint-plugin-next": "^16.0.3",
"@tsconfig/next": "^2.0.4",
"@tsconfig/node22": "^22.0.3",
"@tsconfig/node22": "^22.0.5",
"@tsconfig/strictest": "^2.0.8",
"@types/node": "^24.10.1",
"@types/react": "^19.2.5",
"@types/react": "^19.2.6",
"@types/react-dom": "^19.2.3",
"eslint": "^9.39.1",
"eslint-plugin-react-hooks": "^7.0.1",
"eslint-plugin-react-refresh": "^0.4.24",
"typescript": "^5.9.3",
"typescript-eslint": "^8.46.4"
"typescript-eslint": "^8.47.0"
},
"engines": {
"node": ">=20.19.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/react-dom-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@eslint-react/eslint-plugin": "workspace:*",
"@eslint/config-inspector": "^1.3.0",
"@eslint/js": "^9.39.1",
"@types/react": "^19.2.5",
"@types/react": "^19.2.6",
"@types/react-dom": "^19.2.3",
"@vitejs/plugin-react": "^5.1.1",
"eslint": "^9.39.1",
Expand Down
6 changes: 3 additions & 3 deletions examples/react-dom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@
"@eslint-react/eslint-plugin": "workspace:*",
"@eslint/config-inspector": "^1.3.0",
"@eslint/js": "^9.39.1",
"@tsconfig/node22": "^22.0.3",
"@tsconfig/node22": "^22.0.5",
"@tsconfig/strictest": "^2.0.8",
"@tsconfig/vite-react": "^7.0.2",
"@types/react": "^19.2.5",
"@types/react": "^19.2.6",
"@types/react-dom": "^19.2.3",
"@vitejs/plugin-react": "^5.1.1",
"eslint": "^9.39.1",
"eslint-plugin-react-hooks": "^7.0.1",
"eslint-plugin-react-refresh": "^0.4.24",
"typescript": "^5.9.3",
"typescript-eslint": "^8.46.4",
"typescript-eslint": "^8.47.0",
"vite": "^7.2.2"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion examples/with-babel-eslint-parser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@eslint/js": "^9.39.1",
"@types/babel__core": "~7.20.5",
"@types/babel__preset-env": "~7.10.0",
"@types/react": "^19.2.5",
"@types/react": "^19.2.6",
"@types/react-dom": "^19.2.3",
"@vitejs/plugin-react": "^5.1.1",
"eslint": "^9.39.1",
Expand Down
6 changes: 3 additions & 3 deletions examples/with-ts-blank-eslint-parser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
"@eslint-react/shared": "workspace:*",
"@eslint/config-inspector": "^1.3.0",
"@eslint/js": "^9.39.1",
"@tsconfig/node22": "^22.0.3",
"@tsconfig/node22": "^22.0.5",
"@tsconfig/strictest": "^2.0.8",
"@tsconfig/vite-react": "^7.0.2",
"@types/react": "^19.2.5",
"@types/react": "^19.2.6",
"@types/react-dom": "^19.2.3",
"@vitejs/plugin-react": "^5.1.1",
"eslint": "^9.39.1",
Expand All @@ -31,7 +31,7 @@
"globals": "^16.5.0",
"ts-blank-eslint-parser": "^0.4.4",
"typescript": "^5.9.3",
"typescript-eslint": "^8.46.4",
"typescript-eslint": "^8.47.0",
"vite": "^7.2.2"
},
"engines": {
Expand Down
Loading
Loading