LoginSignup
0
0

More than 1 year has passed since last update.

setup nuxt (TypeScript)

Last updated at Posted at 2021-08-23
$ npm init nuxt-app myproject

create-nuxt-app v3.7.1
✨  Generating Nuxt.js project in myproject
? Project name: myproject
? Programming language: TypeScript
? Package manager: Npm
? UI framework: Vuetify.js
? Nuxt.js modules: Axios - Promise based HTTP client, Progressive Web App (PWA), Content - Git-based headless CMS
? Linting tools: ESLint, Prettier, Lint staged files, StyleLint
? Testing framework: Jest
? Rendering mode: Universal (SSR / SSG)
? Deployment target: Server (Node.js hosting)
? Development tools: jsconfig.json (Recommended for VS Code if you're not using typescript)
? Continuous integration: None
? Version control system: Git
$ cat nuxt.config.js
...
  build: {
    babel: {
      babelrc: true,
    }
  }
...
$ cat package.json
...
  "scripts": {
...
    "generate": "nuxt generate",
    "lint:js": "eslint --ext \".js,.vue\" --ignore-path .gitignore .",
    "lint:js:fix": "eslint --ext \".js,.vue\" --ignore-path .gitignore . --fix",
    "lint:style": "stylelint \"**/*.{vue,css}\" --ignore-path .gitignore",
    "lint:style:fix": "stylelint \"**/*.{vue,css}\" --ignore-path .gitignore --fix",
    "prepare": "husky install",
    "lint": "npm run lint:js && npm run lint:style",
    "lint:fix": "npm run lint:js:fix && npm run lint:style:fix",
    "test": "jest"
  },
...
$ npm install --save-dev eslint-plugin-prettier
$ npm install --save-dev @vue/eslint-config-prettier
$ rm .prettierrc
$ cat .eslintrc.js
...
  extends: [
    '@nuxtjs/eslint-config-typescript',
    'plugin:nuxt/recommended',
    'plugin:vue/recommended',
    'prettier',
    'plugin:prettier/recommended',
  ],
  plugins: [],
  // add your custom rules here
  rules: {
    'no-console': 'error',
    'prettier/prettier': [
      'error',
      {
        singleQuote: true,
        semi: false,
      },
    ],
  },
...
$ npm run lint
$ npm run lint:fix
$ npm run test
$ npm run dev
$ npm run build
$ npm run start
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0