main
Ethan Niser 2023-09-22 14:37:31 -05:00
parent f813b4782b
commit a6d105701d
4 changed files with 66 additions and 5 deletions

@ -0,0 +1,55 @@
/** @type {import("eslint").Linter.Config} */
const config = {
root: true,
parser: "@typescript-eslint/parser",
plugins: ["isaacscript", "import"],
extends: [
"plugin:@typescript-eslint/recommended-type-checked",
"plugin:@typescript-eslint/stylistic-type-checked",
"plugin:prettier/recommended",
],
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
tsconfigRootDir: __dirname,
project: [
"./tsconfig.json",
"./cli/tsconfig.eslint.json", // separate eslint config for the CLI since we want to lint and typecheck differently due to template files
"./upgrade/tsconfig.json",
"./www/tsconfig.json",
],
},
overrides: [
// Template files don't have reliable type information
{
files: ["./cli/template/**/*.{ts,tsx}"],
extends: ["plugin:@typescript-eslint/disable-type-checked"],
},
],
rules: {
// These off/not-configured-the-way-we-want lint rules we like & opt into
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-unused-vars": [
"error",
{ argsIgnorePattern: "^_", destructuredArrayIgnorePattern: "^_" },
],
"@typescript-eslint/consistent-type-imports": [
"error",
{ prefer: "type-imports", fixStyle: "inline-type-imports" },
],
"import/consistent-type-specifier-style": ["error", "prefer-inline"],
// For educational purposes we format our comments/jsdoc nicely
"isaacscript/complete-sentences-jsdoc": "warn",
"isaacscript/format-jsdoc-comments": "warn",
// These lint rules don't make sense for us but are enabled in the preset configs
"@typescript-eslint/no-confusing-void-expression": "off",
"@typescript-eslint/restrict-template-expressions": "off",
// This rule doesn't seem to be working properly
"@typescript-eslint/prefer-nullish-coalescing": "off",
},
};
module.exports = config;

Binary file not shown.

@ -14,7 +14,8 @@
"typecheck": "bunx --bun tsc",
"format:check": "prettier --check .",
"format": "prettier --write . --list-different",
"reset-cache": "rm -rf /home/whatplan/.bun/install/cache && rm -rf node_modules && bun i"
"lint": "eslint . --report-unused-disable-directives",
"lint:fix": "eslint . --report-unused-disable-directives --fix"
},
"devDependencies": {
"@flydotio/dockerfile": "latest",
@ -26,6 +27,15 @@
"bun-types": "latest",
"concurrently": "^8.2.1",
"drizzle-kit": "^0.19.13",
"@typescript-eslint/eslint-plugin": "^6.7.0",
"@typescript-eslint/parser": "^6.7.0",
"eslint": "^8.49.0",
"eslint-config-prettier": "^9.0.0",
"eslint-config-turbo": "^1.10.14",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-isaacscript": "^3.5.5",
"eslint-plugin-prettier": "^5.0.0",
"@types/eslint": "^8.44.2",
"pino": "^8.15.1",
"prettier": "^3.0.3",
"prettier-plugin-tailwindcss": "^0.5.4",

@ -21,10 +21,6 @@ const loggerConfig =
}
: { level: config.env.LOG_LEVEL };
function optionallyUse(condition: boolean, middleware: any): any {
return condition ? middleware : (a: any) => a;
}
export const ctx = new Elysia({
name: "@app/ctx",
})