Skip to content

Instantly share code, notes, and snippets.

@joeyjiron06
Last active December 9, 2022 15:51
Show Gist options
  • Save joeyjiron06/13ba9efa9aed8cae3cc999836cdc7339 to your computer and use it in GitHub Desktop.
Save joeyjiron06/13ba9efa9aed8cae3cc999836cdc7339 to your computer and use it in GitHub Desktop.
Generate a new vite react project with all depencies needed for local dev
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"airbnb",
"airbnb/hooks"
],
"rules": {
"no-console": "off"
},
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [],
"ignorePatterns": [
"node_modules"
],
"overrides": [
{
"files": [
"**/*.{ts,tsx}"
], // Your TypeScript files extension
"parser": "@typescript-eslint/parser",
"excludedFiles":[
"node_modules/**",
"assets/**"
],
"parserOptions": {
"project": ["./tsconfig.json"] // Specify it only for TypeScript files
},
// As mentioned in the comments, you should extend TypeScript plugins here,
// instead of extending them outside the `overrides`.
// If you don't want to extend any rules, you don't need an `extends` attribute.
"extends": [
"airbnb-typescript"
// "plugin:@typescript-eslint/recommended",
// "plugin:@typescript-eslint/recommended-requiring-type-checking"
],
"plugins": [
"@typescript-eslint"
],
"rules": {
"@typescript-eslint/no-unsafe-assignment": "off"
}
},
{
"files":[
"**/*.json"
],
"excludedFiles": [
"package-lock.json"
],
"plugins": [
"eslint-plugin-json-format"
]
},
{
"files": [
"storybook/**/*.{ts,tsx}",
"./src/**/*.test.{ts,tsx}",
"./types/**/*.{ts,tsx}"
],
"rules": {
"import/no-extraneous-dependencies": "off"
}
},
{
"files": [
"**/*.test.{ts,tsx}"
],
"rules": {
"no-unsafe-call": "off",
"@typescript-eslint/require-await": "off",
"@typescript-eslint/no-use-before-define": "off"
}
}
]
}

Create a new vite project using the following tools

pnpm create vite PROJECT_NAME_HERE --template react-ts
pnpm install --dev eslint eslint-config-airbnb lint-staged husky tamagui
pnpx install-peerdeps --pnpm --dev eslint-config-airbnb
pnpx install-peerdeps --pnpm --dev eslint-config-airbnb
pnpx husky add .husky/pre-commit "pnpm run lint-staged"

tamagui config - https://tamagui.dev/docs/intro/installation

{
"lint-staged": {
"*.{js,ts,jsx,tsx,json}": "eslint --cache --fix"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment