Nextjs Typescript 스타터 템플릿

목차



Tech Stack
Project Setup
Config Files

기술 스택


  • next.js
  • 타자기
  • 원사
  • 허스키
  • 더 예쁜
  • 에스린트

  • 프로젝트 설정



    yarn create next-app --typescript
    modify .gitignore
    yarn add --dev @typescript-eslint/eslint-plugin
    yarn add --dev prettier eslint-config-prettier
    touch .eslintrc.json .prettierrc.json .prettierignore
    npx husky-init && yarn
    modify package.json (scripts)
    modify .husky/pre-commit
    # yarn commands
    yarn lint
    yarn build
    yarn prettier-check
    yarn prettier-fix
    yarn dev
    

    구성 파일



    의견이 있는 구성은 적절하다고 생각되는 대로 수정하십시오.

    .eslintrc.json



    {
      "plugins": ["@typescript-eslint"],
      "extends": [
        "next/core-web-vitals",
        "plugin:@typescript-eslint/recommended",
        "prettier"
      ],
      "rules": {
        "@typescript-eslint/no-unused-vars": "error",
        "@typescript-eslint/no-explicit-any": "error"
      }
    }
    
    


    .prettierrc.json



    {
      "singleQuote": true,
      "semi": false,
      "tabWidth": 4
    }
    


    .prettierignore



    node_modules
    **/.next/**
    **/_next/**
    **/dist/**
    packages/next/bundles/webpack/packages/*.runtime.js
    packages/next/bundles/webpack/packages/lazy-compilation-*.js
    packages/next/compiled/**
    packages/react-refresh-utils/**/*.js
    packages/react-refresh-utils/**/*.d.ts
    packages/react-dev-overlay/lib/**
    **/__tmp__/**
    lerna.json
    .github/actions/next-stats-action/.work
    packages/next-swc/crates/**/*
    packages/next-codemod/transforms/__testfixtures__/**/*
    packages/next-codemod/transforms/__tests__/**/*
    packages/next-codemod/**/*.js
    packages/next-codemod/**/*.d.ts
    packages/next-env/**/*.d.ts
    test-timings.json
    test/**/out/**
    bench/nested-deps/pages/**/*
    bench/nested-deps/components/**/*
    


    .gitignore



    # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
    
    # dependencies
    /node_modules
    /.pnp
    .pnp.js
    
    # testing
    /coverage
    
    # next.js
    /.next/
    /out/
    
    # production
    /build
    
    # misc
    .DS_Store
    *.pem
    
    # debug
    npm-debug.log*
    yarn-debug.log*
    yarn-error.log*
    
    # local env files
    .env.local
    .env.development.local
    .env.test.local
    .env.production.local
    
    # vercel
    .vercel
    
    # vscode workspace setting
    .vscode
    


    package.json



    "scripts": {
        "dev": "next dev",
        "build": "next build",
        "start": "next start",
        "lint": "next lint",
        "prepare": "husky install",
        "prettier-check": "prettier --check .",
        "prettier-fix": "prettier --write ."
    }
    

    좋은 웹페이지 즐겨찾기