Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Commit

Permalink
Start project
Browse files Browse the repository at this point in the history
  • Loading branch information
phuctm97 committed May 25, 2023
0 parents commit 0b5afc8
Show file tree
Hide file tree
Showing 50 changed files with 10,314 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# apps
.next
next-env.d.ts
out

# scripts
packages/t[sw]config
scripts
.*.js
*.config.js

# dependencies
node_modules
139 changes: 139 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
const packageJson = require("./package.json");

const jsExtensions = [".js", ".mjs", ".cjs", ".jsx"];

const tsExtensions = [
...jsExtensions.map((ext) => ext.replace("js", "ts")),
".d.ts",
];

const esExtensions = [...tsExtensions, ...jsExtensions];

const reactExtensions = esExtensions.filter((ext) => ext.endsWith("sx"));

/** @type {import('eslint').Linter.Config} */
const config = {
root: true,
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/recommended",
"plugin:import/typescript",
"next/core-web-vitals",
"prettier",
],
plugins: [
"@typescript-eslint",
"import",
"simple-import-sort",
"react",
"react-hooks",
"jsx-a11y",
"@next/next",
].reverse(),
rules: {
"eol-last": "error",
"no-multiple-empty-lines": ["error", { max: 1, maxBOF: 0, maxEOF: 1 }],
"no-unused-vars": "off",
"no-use-before-define": "off",
"no-constant-condition": "off",
"lines-around-directive": ["error", { before: "never", after: "always" }],
quotes: "off",
"dot-notation": "error",
"arrow-body-style": "error",
"prefer-arrow-callback": "error",
"require-await": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{ ignoreRestSiblings: true },
],
"@typescript-eslint/no-use-before-define": "error",
"@typescript-eslint/no-unnecessary-condition": [
"error",
{ allowConstantLoopConditions: true },
],
"@typescript-eslint/ban-ts-comment": [
"error",
{
"ts-expect-error": "allow-with-description",
"ts-nocheck": "allow-with-description",
},
],
"@typescript-eslint/quotes": "error",
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/consistent-type-definitions": "error",
"@typescript-eslint/array-type": [
"error",
{ default: "array-simple", readonly: "array-simple" },
],
"@typescript-eslint/prefer-function-type": "error",
"@typescript-eslint/explicit-function-return-type": [
"error",
{ allowExpressions: true },
],
"@typescript-eslint/require-await": "error",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/no-misused-promises": "error",
"@typescript-eslint/no-floating-promises": "error",
"import/first": "error",
"import/newline-after-import": "error",
"import/namespace": ["error", { allowComputed: true }],
"import/no-cycle": "error",
"import/no-internal-modules": [
"error",
{ allow: ["next/*", "next/font/*", "react-dom/*", "jotai/*", "~/*"] },
],
"simple-import-sort/imports": [
"error",
{
groups: [
["client", "server"].map((name) => `^\\u0000${name}-only$`),
["^\\u0000[^\\.]"],
["^\\u0000~\\/"],
["^\\u0000\\.\\."],
["^\\u0000\\.[^\\.]"],
["\\u0000$"],
["^~\\/.*\\u0000$"],
["^\\.\\..*\\u0000$"],
["^\\.[^\\.].*\\u0000$"],
["^[^\\.]"],
["^~\\/"],
["^\\.\\."],
["^\\.[^\\.]"],
],
},
],
"simple-import-sort/exports": "error",
"react/jsx-filename-extension": [
"error",
{ allow: "as-needed", extensions: reactExtensions },
],
"react/function-component-definition": [
"error",
{
namedComponents: "arrow-function",
unnamedComponents: "arrow-function",
},
],
},
settings: {
"import/extensions": esExtensions,
"import/parsers": { "@typescript-eslint/parser": tsExtensions },
"import/resolver": {
typescript: {
project: packageJson.workspaces.map(
(workspace) => `./${workspace}/tsconfig.json`
),
},
},
next: { rootDir: "apps/www" },
},
parserOptions: {
tsconfigRootDir: __dirname,
project: packageJson.workspaces.map(
(workspace) => `./${workspace}/tsconfig.json`
),
},
};

module.exports = config;
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# apps
.next
next-env.d.ts
out

# dependencies
node_modules

# debug
npm-debug.log*

# env
.env*.local

# misc
.DS_Store
*.pem
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
17 changes: 17 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# apps
.next
next-env.d.ts
out

# dependencies
node_modules

# debug
npm-debug.log*

# env
.env*

# misc
.DS_Store
*.pem
6 changes: 6 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/** @type {import('prettier').Options} */
const options = {
plugins: [require("prettier-plugin-tailwindcss")],
};

module.exports = options;
8 changes: 8 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"recommendations": [
"bradlc.vscode-tailwindcss",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"streetsidesoftware.code-spell-checker"
]
}
22 changes: 22 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"typescript.tsdk": "node_modules/typescript/lib",
"javascript.suggestionActions.enabled": false,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": { "source.fixAll": true },
"editor.formatOnSave": true,
"files.trimTrailingWhitespace": true,
"files.trimFinalNewlines": true,
"files.insertFinalNewline": true,
"files.associations": {
"*.css": "tailwindcss",
".env.*": "properties"
},
"files.exclude": {
"node_modules": true,
"package-lock.json": true,
"**/.next": true,
"**/next-env.d.ts": true,
"**/out": true,
".husky/_": true
}
}
Loading

0 comments on commit 0b5afc8

Please sign in to comment.