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
32 changes: 32 additions & 0 deletions packages/eslint-config-custom/base.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import js from "@eslint/js";
import eslintConfigPrettier from "eslint-config-prettier";
import turboPlugin from "eslint-plugin-turbo";
import tseslint from "typescript-eslint";
import onlyWarn from "eslint-plugin-only-warn";

/**
* A shared ESLint configuration for the repository.
*
* @type {import("eslint").Linter.Config[]}
* */
export const config = [
js.configs.recommended,
eslintConfigPrettier,
...tseslint.configs.recommended,
{
plugins: {
turbo: turboPlugin,
},
rules: {
"turbo/no-undeclared-env-vars": "warn",
},
},
{
plugins: {
onlyWarn,
},
},
{
ignores: ["dist/**"],
},
];
28 changes: 28 additions & 0 deletions packages/eslint-config-custom/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "@repo/eslint-config-custom",
"private": true,
"type": "module",
"version": "1.0.0",
"description": "Base configuration for Eslint",
"main": "index.cjs",
"keywords": [],
"author": "Tuan Anh <tuananhit.oct@gmail.com>",
"license": "MIT",
"exports": {
"./base": "./base.js",
"./react-internal": "./react-internal.js"
},
"devDependencies": {
"@eslint/js": "^9.24.0",
"@typescript-eslint/parser": "^8.30.1",
"eslint": "^9.24.0",
"eslint-config-prettier": "^10.1.2",
"eslint-plugin-only-warn": "^1.1.0",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-turbo": "^2.5.0",
"eslint-plugin-vitest": "^0.5.4",
"typescript": "^5.8.3",
"typescript-eslint": "^8.30.1"
}
}
34 changes: 34 additions & 0 deletions packages/eslint-config-custom/react-internal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import js from "@eslint/js";
import eslintConfigPrettier from "eslint-config-prettier";
import tseslint from "typescript-eslint";
import pluginReactHooks from "eslint-plugin-react-hooks";
import pluginReact from "eslint-plugin-react";
import { config as baseConfig } from "./base.js";

/**
* A custom ESLint configuration for libraries that use React.
*
* @type {import("eslint").Linter.Config[]} */
export const config = [
...baseConfig,
js.configs.recommended,
eslintConfigPrettier,
...tseslint.configs.recommended,
pluginReact.configs.flat.recommended,
{
languageOptions: {
...pluginReact.configs.flat.recommended.languageOptions,
},
},
{
plugins: {
"react-hooks": pluginReactHooks,
},
settings: { react: { version: "detect" } },
rules: {
...pluginReactHooks.configs.recommended.rules,
// React scope no longer necessary with new JSX transform.
"react/react-in-jsx-scope": "off",
},
},
];
4 changes: 4 additions & 0 deletions packages/tiny-react-hooks/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { config } from "@repo/eslint-config-custom/react-internal";

/** @type {import("eslint").Linter.Config} */
export default config;
5 changes: 3 additions & 2 deletions packages/tiny-react-hooks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"dev": "tsup --watch",
"build": "tsup",
"test": "vitest",
"coverage": "vitest run --coverage"
"coverage": "vitest run --coverage",
"lint": "eslint . && tsc --noEmit"
},
"exports": {
"./package.json": "./package.json",
Expand All @@ -25,7 +26,7 @@
}
},
"devDependencies": {
"@repo/typescript-config": "workspace:*",
"@repo/eslint-config-custom": "workspace:*",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.3.0",
"@types/react": "19.1.0",
Expand Down
Loading