Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: setup eslint & prettier #3

Merged
merged 6 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
33 changes: 33 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/** @type {import('eslint').Linter.Config} */
module.exports = {
parser: "@typescript-eslint/parser",
parserOptions: {
project: "tsconfig.json",
tsconfigRootDir: __dirname,
sourceType: "module",
},
plugins: ["@typescript-eslint/eslint-plugin"],
extends: ["plugin:@typescript-eslint/recommended", "plugin:prettier/recommended"],
root: true,
env: {
node: true,
jest: true,
},
ignorePatterns: [".eslintrc.js"],
rules: {
"@typescript-eslint/explicit-function-return-type": "off",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We were debating with @0xkenj1 about having explicit return types. I generally like the idea of being explicit but should we enforce it on the template though or are we going to be lenient on our base?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to me both are okay but if we're going to be explicit then makes sense to have it on, maybe just a warning to not be so strict

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @jahabeebs thoughts?

"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-misused-promises": "error",
"@typescript-eslint/no-floating-promises": "error",
Comment on lines +20 to +21
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🇹🇩

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JAJAJAJAJA i had to search the flag

"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-unsafe-assignment": "warn",
"@typescript-eslint/no-unsafe-argument": "warn",
"@typescript-eslint/no-unsafe-member-access": "error",
"@typescript-eslint/no-unsafe-return": "error",
"@typescript-eslint/no-unused-vars": [
"error",
{ argsIgnorePattern: "_+", ignoreRestSiblings: true },
],
"@typescript-eslint/prefer-as-const": "warn",
},
};
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pnpm lint-staged && pnpm check-types
23 changes: 23 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"arrowParens": "always",
"printWidth": 100,
"singleQuote": false,
"semi": true,
"trailingComma": "all",
"tabWidth": 4,
"plugins": ["@ianvs/prettier-plugin-sort-imports"],
"importOrder": [
"<TYPES>",
"<THIRD_PARTY_MODULES>",
"",
"<TYPES>^@zkchainhub",
"^@zkchainhub/(.*)$",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zkchainhub ? 🤣

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch 🙈

"",
"<TYPES>^[.|..|~]",
"^~/",
"^[../]",
"^[./]"
],
"importOrderParserPlugins": ["typescript", "decorators-legacy"],
"importOrderTypeScriptVersion": "5.4.5"
}
82 changes: 48 additions & 34 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,50 @@
{
"name": "ts-turborepo-boilerplate",
"version": "0.0.1",
"description": "",
"author": "Wonderland",
"private": true,
"license": "MIT",
"type": "module",
"engines": {
"node": "20"
},
"scripts": {
"build": "turbo run build",
"start": "turbo run start",
"dev": "turbo run dev",
"lint": "turbo run lint",
"lint:fix": "turbo run lint:fix",
"format": "turbo run format",
"format:fix": "turbo run format:fix",
"check-types": "turbo run check-types",
"test": "turbo run test",
"test:cov": "turbo run test:cov",
"test:integration": "turbo run test:integration",
"prepare": "husky",
"preinstall": "npx only-allow pnpm"
},
"packageManager": "[email protected]+sha256.46f1bbc8f8020aa9869568c387198f1a813f21fb44c82f400e7d1dbde6c70b40",
"devDependencies": {
"@commitlint/config-conventional": "19.4.1",
"@types/node": "22.5.4",
"commitlint": "19.4.1",
"husky": "9.1.5",
"turbo": "2.1.1",
"typescript": "5.5.4"
}
"name": "ts-turborepo-boilerplate",
"version": "0.0.1",
"private": true,
"description": "",
"license": "MIT",
"author": "Wonderland",
"type": "module",
"scripts": {
"build": "turbo run build",
"check-types": "turbo run check-types",
"dev": "turbo run dev",
"format": "turbo run format",
"format:fix": "turbo run format:fix",
"preinstall": "npx only-allow pnpm",
"lint": "turbo run lint",
"lint:fix": "turbo run lint:fix",
"prepare": "husky",
"start": "turbo run start",
"test": "turbo run test",
"test:cov": "turbo run test:cov",
"test:integration": "turbo run test:integration"
},
"lint-staged": {
"*": "prettier --write --ignore-unknown",
"*.js,*.ts,*.json": "eslint --fix",
"package.json": "sort-package-json"
},
"devDependencies": {
"@commitlint/config-conventional": "19.4.1",
"@ianvs/prettier-plugin-sort-imports": "4.3.1",
"@types/node": "22.5.4",
"@typescript-eslint/eslint-plugin": "7.18.0",
"@typescript-eslint/parser": "7.18.0",
"commitlint": "19.4.1",
"eslint": "8.56.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-prettier": "5.2.1",
"husky": "9.1.5",
"lint-staged": "15.2.10",
"prettier": "3.3.3",
"sort-package-json": "2.10.1",
"turbo": "2.1.1",
"typescript": "5.5.4"
},
"packageManager": "[email protected]+sha256.46f1bbc8f8020aa9869568c387198f1a813f21fb44c82f400e7d1dbde6c70b40",
"engines": {
"node": "20"
}
}
Loading