feat: whyrating - initial project from turbostarter boilerplate

This commit is contained in:
Alejandro Gutiérrez
2026-02-04 01:54:52 +01:00
commit 5cdc07cd39
1618 changed files with 338230 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
{
"name": "@turbostarter/eslint-config",
"version": "0.1.0",
"private": true,
"type": "module",
"exports": {
"./base": "./src/base.js",
"./next": "./src/next.js",
"./react": "./src/react.js"
},
"scripts": {
"clean": "git clean -xdf .cache .turbo node_modules",
"format": "prettier --check . --ignore-path ../../.gitignore",
"typecheck": "tsc --noEmit"
},
"prettier": "@turbostarter/prettier-config",
"dependencies": {
"@eslint/compat": "^1.4.1",
"@next/eslint-plugin-next": "16.0.10",
"@tanstack/eslint-plugin-query": "5.91.2",
"eslint-plugin-i18next": "6.1.3",
"eslint-plugin-import": "^2.32.0",
"eslint-plugin-jsx-a11y": "^6.10.2",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-turbo": "^2.6.0",
"eslint-plugin-unused-imports": "4.3.0",
"typescript-eslint": "^8.46.2"
},
"devDependencies": {
"@turbostarter/prettier-config": "workspace:*",
"@turbostarter/tsconfig": "workspace:*",
"eslint": "catalog:",
"prettier": "catalog:",
"typescript": "catalog:"
}
}

130
tooling/eslint/src/base.js Normal file
View File

@@ -0,0 +1,130 @@
/// <reference types="../types.d.ts" />
import * as path from "node:path";
import { fileURLToPath } from "node:url";
import { includeIgnoreFile } from "@eslint/compat";
import eslint from "@eslint/js";
import importPlugin from "eslint-plugin-import";
import turboPlugin from "eslint-plugin-turbo";
import unusedImportsPlugin from "eslint-plugin-unused-imports";
import tseslint from "typescript-eslint";
import i18nextPlugin from "eslint-plugin-i18next";
import { defineConfig } from "eslint/config";
const restrictEnvAccess = defineConfig({
files: ["**/*.js", "**/*.ts", "**/*.tsx"],
ignores: ["**/env*.ts"],
rules: {
"no-restricted-properties": [
"error",
{
object: "process",
property: "env",
message:
"Use `import { env } from 'env.config'` instead to ensure validated types.",
},
],
"no-restricted-imports": [
"error",
{
name: "process",
importNames: ["env"],
message:
"Use `import { env } from 'env.config'` instead to ensure validated types.",
},
],
},
});
export default defineConfig(
// Ignore files not tracked by VCS and any config files
includeIgnoreFile(
path.resolve(
path.dirname(fileURLToPath(import.meta.url)),
"../../../.gitignore",
),
),
{ ignores: ["**/*.config.*"] },
{
files: ["**/*.js", "**/*.ts", "**/*.tsx"],
plugins: {
import: importPlugin,
"unused-imports": unusedImportsPlugin,
turbo: turboPlugin,
},
extends: [
eslint.configs.recommended,
i18nextPlugin.configs["flat/recommended"],
...tseslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
...tseslint.configs.stylisticTypeChecked,
],
rules: {
...turboPlugin.configs.recommended.rules,
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/consistent-type-imports": [
"warn",
{ prefer: "type-imports", fixStyle: "separate-type-imports" },
],
"@typescript-eslint/no-misused-promises": [
2,
{ checksVoidReturn: { attributes: false } },
],
"@typescript-eslint/no-unnecessary-condition": [
"error",
{
allowConstantLoopConditions: true,
},
],
"import/consistent-type-specifier-style": ["error", "prefer-top-level"],
"import/order": [
"error",
{
alphabetize: {
caseInsensitive: true,
order: "asc",
},
pathGroups: [
{
pattern: "@turbostarter/**",
group: "internal",
position: "before",
},
{
pattern: "~/**",
group: "internal",
position: "before",
},
],
groups: [
["builtin", "external"],
"internal",
"parent",
"sibling",
"index",
"object",
"type",
],
"newlines-between": "always",
warnOnUnassignedImports: true,
pathGroupsExcludedImportTypes: ["type"],
},
],
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": [
"warn",
{
vars: "all",
varsIgnorePattern: "^_",
args: "after-used",
argsIgnorePattern: "^_",
},
],
},
},
{
linterOptions: { reportUnusedDisableDirectives: true },
languageOptions: { parserOptions: { projectService: true } },
},
restrictEnvAccess,
);

View File

@@ -0,0 +1,16 @@
import nextPlugin from "@next/eslint-plugin-next";
/** @type {Awaited<import('typescript-eslint').Config>} */
export default [
{
files: ["**/*.ts", "**/*.tsx"],
plugins: {
"@next/next": nextPlugin,
},
rules: {
...nextPlugin.configs.recommended.rules,
...nextPlugin.configs["core-web-vitals"].rules,
"@next/next/no-duplicate-head": "off",
},
},
];

25
tooling/eslint/src/react.js vendored Normal file
View File

@@ -0,0 +1,25 @@
import reactPlugin from "eslint-plugin-react";
import hooksPlugin from "eslint-plugin-react-hooks";
import queryPlugin from "@tanstack/eslint-plugin-query";
/** @type {Awaited<import('typescript-eslint').Config>} */
export default [
{
files: ["**/*.ts", "**/*.tsx"],
plugins: {
react: reactPlugin,
"react-hooks": hooksPlugin,
"@tanstack/query": queryPlugin,
},
rules: {
...reactPlugin.configs["jsx-runtime"].rules,
...hooksPlugin.configs.recommended.rules,
...queryPlugin.configs.recommended.rules,
},
languageOptions: {
globals: {
React: "writable",
},
},
},
];

View File

@@ -0,0 +1,5 @@
{
"extends": "@turbostarter/tsconfig/base.json",
"include": ["."],
"exclude": ["node_modules"]
}

76
tooling/eslint/types.d.ts vendored Normal file
View File

@@ -0,0 +1,76 @@
/**
* Since the ecosystem hasn't fully migrated to ESLint's new FlatConfig system yet,
* we "need" to type some of the plugins manually :(
*/
declare module "@eslint/js" {
// Why the hell doesn't eslint themselves export their types?
import type { Linter } from "eslint";
export const configs: {
readonly recommended: { readonly rules: Readonly<Linter.RulesRecord> };
readonly all: { readonly rules: Readonly<Linter.RulesRecord> };
};
}
declare module "eslint-plugin-import" {
import type { Linter, Rule } from "eslint";
export const configs: {
recommended: { rules: Linter.RulesRecord };
};
export const rules: Record<string, Rule.RuleModule>;
}
declare module "eslint-plugin-react" {
import type { Linter, Rule } from "eslint";
export const configs: {
recommended: { rules: Linter.RulesRecord };
all: { rules: Linter.RulesRecord };
"jsx-runtime": { rules: Linter.RulesRecord };
};
export const rules: Record<string, Rule.RuleModule>;
}
declare module "eslint-plugin-react-hooks" {
import type { Linter, Rule } from "eslint";
export const configs: {
recommended: {
rules: {
"rules-of-hooks": Linter.RuleEntry;
"exhaustive-deps": Linter.RuleEntry;
};
};
};
export const rules: Record<string, Rule.RuleModule>;
}
declare module "@next/eslint-plugin-next" {
import type { Linter, Rule } from "eslint";
export const configs: {
recommended: { rules: Linter.RulesRecord };
"core-web-vitals": { rules: Linter.RulesRecord };
};
export const rules: Record<string, Rule.RuleModule>;
}
declare module "eslint-plugin-turbo" {
import type { Linter, Rule } from "eslint";
export const configs: {
recommended: { rules: Linter.RulesRecord };
};
export const rules: Record<string, Rule.RuleModule>;
}
declare module "eslint-plugin-i18next" {
import type { Linter, Rule } from "eslint";
export const configs: {
"flat/recommended": { rules: Linter.RulesRecord };
};
export const rules: Record<string, Rule.RuleModule>;
}