diff options
| author | MohamedBassem <me@mbassem.com> | 2024-03-13 21:43:44 +0000 |
|---|---|---|
| committer | Mohamed Bassem <me@mbassem.com> | 2024-03-14 16:40:45 +0000 |
| commit | 04572a8e5081b1e4871e273cde9dbaaa44c52fe0 (patch) | |
| tree | 8e993acb732a50d1306d4d6953df96c165c57f57 /tooling/eslint | |
| parent | 2df08ed08c065e8b91bc8df0266bd4bcbb062be4 (diff) | |
| download | karakeep-04572a8e5081b1e4871e273cde9dbaaa44c52fe0.tar.zst | |
structure: Create apps dir and copy tooling dir from t3-turbo repo
Diffstat (limited to 'tooling/eslint')
| -rw-r--r-- | tooling/eslint/base.js | 43 | ||||
| -rw-r--r-- | tooling/eslint/nextjs.js | 10 | ||||
| -rw-r--r-- | tooling/eslint/package.json | 42 | ||||
| -rw-r--r-- | tooling/eslint/react.js | 24 | ||||
| -rw-r--r-- | tooling/eslint/tsconfig.json | 8 |
5 files changed, 127 insertions, 0 deletions
diff --git a/tooling/eslint/base.js b/tooling/eslint/base.js new file mode 100644 index 00000000..d1f6296c --- /dev/null +++ b/tooling/eslint/base.js @@ -0,0 +1,43 @@ +/** @type {import("eslint").Linter.Config} */ +const config = { + extends: [ + "turbo", + "eslint:recommended", + "plugin:@typescript-eslint/recommended-type-checked", + "plugin:@typescript-eslint/stylistic-type-checked", + ], + env: { + es2022: true, + node: true, + }, + parser: "@typescript-eslint/parser", + parserOptions: { project: true }, + plugins: ["@typescript-eslint", "import"], + rules: { + "turbo/no-undeclared-env-vars": "off", + "@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 } }, + ], + "import/consistent-type-specifier-style": ["error", "prefer-top-level"], + }, + ignorePatterns: [ + "**/*.config.js", + "**/*.config.cjs", + "**/.eslintrc.cjs", + ".next", + "dist", + "pnpm-lock.yaml", + ], + reportUnusedDisableDirectives: true, +}; + +module.exports = config; diff --git a/tooling/eslint/nextjs.js b/tooling/eslint/nextjs.js new file mode 100644 index 00000000..169993e3 --- /dev/null +++ b/tooling/eslint/nextjs.js @@ -0,0 +1,10 @@ +/** @type {import('eslint').Linter.Config} */ +const config = { + extends: ["plugin:@next/next/core-web-vitals"], + rules: { + "@next/next/no-html-link-for-pages": "off", + "@typescript-eslint/require-await": "off", + }, +}; + +module.exports = config; diff --git a/tooling/eslint/package.json b/tooling/eslint/package.json new file mode 100644 index 00000000..5329f6d2 --- /dev/null +++ b/tooling/eslint/package.json @@ -0,0 +1,42 @@ +{ + "name": "@hoarder/eslint-config", + "version": "0.2.0", + "private": true, + "license": "MIT", + "files": [ + "./base.js", + "./nextjs.js", + "./react.js" + ], + "scripts": { + "clean": "rm -rf .turbo node_modules", + "format": "prettier --check . --ignore-path ../../.gitignore", + "lint": "eslint .", + "typecheck": "tsc --noEmit" + }, + "dependencies": { + "@next/eslint-plugin-next": "^14.1.1", + "@typescript-eslint/eslint-plugin": "^7.2.0", + "@typescript-eslint/parser": "^7.2.0", + "eslint-config-turbo": "^1.12.4", + "eslint-plugin-import": "^2.29.1", + "eslint-plugin-jsx-a11y": "^6.8.0", + "eslint-plugin-react": "^7.33.2", + "eslint-plugin-react-hooks": "^4.6.0" + }, + "devDependencies": { + "@hoarder/prettier-config": "workspace:^0.1.0", + "@hoarder/tsconfig": "workspace:^0.1.0", + "@types/eslint": "^8.56.5", + "eslint": "^8.57.0", + "prettier": "^3.2.5", + "typescript": "^5.3.3" + }, + "eslintConfig": { + "root": true, + "extends": [ + "./base.js" + ] + }, + "prettier": "@hoarder/prettier-config" +}
\ No newline at end of file diff --git a/tooling/eslint/react.js b/tooling/eslint/react.js new file mode 100644 index 00000000..618e1816 --- /dev/null +++ b/tooling/eslint/react.js @@ -0,0 +1,24 @@ +/** @type {import('eslint').Linter.Config} */ +const config = { + extends: [ + "plugin:react/recommended", + "plugin:react-hooks/recommended", + "plugin:jsx-a11y/recommended", + ], + rules: { + "react/prop-types": "off", + }, + globals: { + React: "writable", + }, + settings: { + react: { + version: "detect", + }, + }, + env: { + browser: true, + }, +}; + +module.exports = config; diff --git a/tooling/eslint/tsconfig.json b/tooling/eslint/tsconfig.json new file mode 100644 index 00000000..dcbd7d30 --- /dev/null +++ b/tooling/eslint/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "@hoarder/tsconfig/base.json", + "compilerOptions": { + "tsBuildInfoFile": "node_modules/.cache/tsbuildinfo.json" + }, + "include": ["."], + "exclude": ["node_modules"] +} |
