init commit
This commit is contained in:
1
tooling/eslint/.cache/.prettiercache
Normal file
1
tooling/eslint/.cache/.prettiercache
Normal file
@@ -0,0 +1 @@
|
||||
[["1","2","3","4","5"],{"key":"6","value":"7"},{"key":"8","value":"9"},{"key":"10","value":"11"},{"key":"12","value":"13"},{"key":"14","value":"15"},"/home/gib/Documents/Code/monorepo/convex-monorepo/tooling/eslint/react.ts",{"size":592,"mtime":1761443987000,"hash":"16","data":"17"},"/home/gib/Documents/Code/monorepo/convex-monorepo/tooling/eslint/package.json",{"size":983,"mtime":1761443987000,"hash":"18","data":"19"},"/home/gib/Documents/Code/monorepo/convex-monorepo/tooling/eslint/nextjs.ts",{"size":440,"mtime":1761443987000,"hash":"20","data":"21"},"/home/gib/Documents/Code/monorepo/convex-monorepo/tooling/eslint/tsconfig.json",{"size":95,"mtime":1761443987000,"hash":"22","data":"23"},"/home/gib/Documents/Code/monorepo/convex-monorepo/tooling/eslint/base.ts",{"size":2511,"mtime":1761443987000,"hash":"24","data":"25"},"8ec5717cfcceb8232317af4d7e80878a",{"hashOfOptions":"26"},"e74d317f6b36584bf8e92f59f015c6fc",{"hashOfOptions":"27"},"77964b9aa0e9c635676652a980fee326",{"hashOfOptions":"28"},"009b1a644d3063765603b665986b5aff",{"hashOfOptions":"29"},"5cc9d942a01c815c6aea8c349b2a24f7",{"hashOfOptions":"30"},"782333496","287757210","2505953125","2857023081","2220821232"]
|
||||
88
tooling/eslint/base.ts
Normal file
88
tooling/eslint/base.ts
Normal file
@@ -0,0 +1,88 @@
|
||||
import * as path from "node:path";
|
||||
import { includeIgnoreFile } from "@eslint/compat";
|
||||
import eslint from "@eslint/js";
|
||||
import importPlugin from "eslint-plugin-import";
|
||||
import turboPlugin from "eslint-plugin-turbo";
|
||||
import { defineConfig } from "eslint/config";
|
||||
import tseslint from "typescript-eslint";
|
||||
|
||||
/**
|
||||
* All packages that leverage t3-env should use this rule
|
||||
*/
|
||||
export const restrictEnvAccess = defineConfig(
|
||||
{ ignores: ["**/env.ts"] },
|
||||
{
|
||||
files: ["**/*.js", "**/*.ts", "**/*.tsx"],
|
||||
rules: {
|
||||
"no-restricted-properties": [
|
||||
"error",
|
||||
{
|
||||
object: "process",
|
||||
property: "env",
|
||||
message:
|
||||
"Use `import { env } from '~/env'` instead to ensure validated types.",
|
||||
},
|
||||
],
|
||||
"no-restricted-imports": [
|
||||
"error",
|
||||
{
|
||||
name: "process",
|
||||
importNames: ["env"],
|
||||
message:
|
||||
"Use `import { env } from '~/env'` instead to ensure validated types.",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
export const baseConfig = defineConfig(
|
||||
// Ignore files not tracked by VCS and any config files
|
||||
includeIgnoreFile(path.join(import.meta.dirname, "../../.gitignore")),
|
||||
{ ignores: ["**/*.config.*"] },
|
||||
{
|
||||
files: ["**/*.js", "**/*.ts", "**/*.tsx"],
|
||||
plugins: {
|
||||
import: importPlugin,
|
||||
turbo: turboPlugin,
|
||||
},
|
||||
extends: [
|
||||
eslint.configs.recommended,
|
||||
...tseslint.configs.recommended,
|
||||
...tseslint.configs.recommendedTypeChecked,
|
||||
...tseslint.configs.stylisticTypeChecked,
|
||||
],
|
||||
rules: {
|
||||
...turboPlugin.configs.recommended.rules,
|
||||
"@typescript-eslint/no-unused-vars": [
|
||||
"error",
|
||||
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
|
||||
],
|
||||
"@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,
|
||||
},
|
||||
],
|
||||
"@typescript-eslint/no-non-null-assertion": "error",
|
||||
"import/consistent-type-specifier-style": ["error", "prefer-top-level"],
|
||||
},
|
||||
},
|
||||
{
|
||||
linterOptions: { reportUnusedDisableDirectives: true },
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
projectService: true,
|
||||
tsconfigRootDir: import.meta.dirname,
|
||||
},
|
||||
},
|
||||
},
|
||||
);
|
||||
15
tooling/eslint/nextjs.ts
Normal file
15
tooling/eslint/nextjs.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import nextPlugin from "@next/eslint-plugin-next";
|
||||
import { defineConfig } from "eslint/config";
|
||||
|
||||
export const nextjsConfig = defineConfig({
|
||||
files: ["**/*.ts", "**/*.tsx"],
|
||||
plugins: {
|
||||
"@next/next": nextPlugin,
|
||||
},
|
||||
rules: {
|
||||
...nextPlugin.configs.recommended.rules,
|
||||
...nextPlugin.configs["core-web-vitals"].rules,
|
||||
// TypeError: context.getAncestors is not a function
|
||||
"@next/next/no-duplicate-head": "off",
|
||||
},
|
||||
});
|
||||
35
tooling/eslint/package.json
Normal file
35
tooling/eslint/package.json
Normal file
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"name": "@acme/eslint-config",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"exports": {
|
||||
"./base": "./base.ts",
|
||||
"./nextjs": "./nextjs.ts",
|
||||
"./react": "./react.ts"
|
||||
},
|
||||
"scripts": {
|
||||
"clean": "git clean -xdf .cache .turbo node_modules",
|
||||
"format": "prettier --check . --ignore-path ../../.gitignore",
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@eslint/compat": "^1.4.0",
|
||||
"@eslint/js": "catalog:",
|
||||
"@next/eslint-plugin-next": "^16.0.0",
|
||||
"eslint-plugin-import": "^2.32.0",
|
||||
"eslint-plugin-jsx-a11y": "^6.10.2",
|
||||
"eslint-plugin-react": "^7.37.5",
|
||||
"eslint-plugin-react-hooks": "^7.0.1",
|
||||
"eslint-plugin-turbo": "^2.5.8",
|
||||
"typescript-eslint": "^8.46.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@acme/prettier-config": "workspace:*",
|
||||
"@acme/tsconfig": "workspace:*",
|
||||
"@types/node": "catalog:",
|
||||
"eslint": "catalog:",
|
||||
"prettier": "catalog:",
|
||||
"typescript": "catalog:"
|
||||
},
|
||||
"prettier": "@acme/prettier-config"
|
||||
}
|
||||
19
tooling/eslint/react.ts
Normal file
19
tooling/eslint/react.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import reactPlugin from "eslint-plugin-react";
|
||||
import reactHooks from "eslint-plugin-react-hooks";
|
||||
import { defineConfig } from "eslint/config";
|
||||
|
||||
export const reactConfig = defineConfig(
|
||||
{
|
||||
files: ["**/*.ts", "**/*.tsx"],
|
||||
...reactPlugin.configs.flat.recommended,
|
||||
...reactPlugin.configs.flat["jsx-runtime"],
|
||||
languageOptions: {
|
||||
...reactPlugin.configs.flat.recommended?.languageOptions,
|
||||
...reactPlugin.configs.flat["jsx-runtime"]?.languageOptions,
|
||||
globals: {
|
||||
React: "writable",
|
||||
},
|
||||
},
|
||||
},
|
||||
reactHooks.configs.flat["recommended-latest"]!,
|
||||
);
|
||||
5
tooling/eslint/tsconfig.json
Normal file
5
tooling/eslint/tsconfig.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"extends": "@acme/tsconfig/base.json",
|
||||
"include": ["."],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
Reference in New Issue
Block a user