zoukankan      html  css  js  c++  java
  • nuxt 项目设置缩进为4个空格

    1、.editorconfig 文件下的indent_size: 2更改为indent_size: 4
    2、.prettierrc 文件

    {
        "singleQuote": true, // 使用单引号 `.vscode/settings.json` 的`prettier.semi`
        "semi": false, // 结尾不加分号 `.vscode/settings.json` 的`prettier.semi`
        "printWidth": 120 // 此项为我自加以上两项为默认,表示每行最多显示的字符数,默认为80,本人觉得太短了,因此修改了一下,必须与`.vscode/settings.json` 的`prettier.printWidth`对应上
    /* 更多配置请戳 https://prettier.io/docs/en/options.html */
    }
    

    3、.eslintrc.js 文件配置

    module.exports = {
        root: true,
        env: {
            browser: true,
            node: true
        },
        parserOptions: {
            parser: 'babel-eslint'
        },
        extends: [
            '@nuxtjs',
            'plugin:nuxt/recommended',
            'plugin:prettier/recommended',
            'prettier',
            'prettier/vue'
        ],
        plugins: ['prettier'],
        // add your custom rules here
        rules: {
            'nuxt/no-cjs-in-config': 'off',
            indent: ['error', 4] // 4个空格缩进
            /* 更多配置请戳 http://eslint.cn/docs/rules/ */
        }
    }
    

    4、nuxt.config.js文件下build.extend(config, ctx) {}添加options.fix: true

        build: {
            /*
             ** You can extend webpack config here
             */
            extend(config, ctx) {
                // Run ESLint on save
                if (ctx.isDev && ctx.isClient) {
                    config.module.rules.push({
                        enforce: 'pre',
                        test: /.(js|vue)$/,
                        loader: 'eslint-loader',
                        exclude: /(node_modules)/,
                        options: {
                            fix: true
                        }
                    })
                }
            }
        }
    
  • 相关阅读:
    Hive 2.1.1安装配置
    vi / vim 删除以及其它命令
    『MySQL』时间戳转换
    update 中实现子查询
    hive lateral view 与 explode详解
    xpath定位方法详解
    Python int与string之间的转化
    ORM、SQLAchemy
    python bottle 简介
    python wsgi 简介
  • 原文地址:https://www.cnblogs.com/cag2050/p/11169148.html
Copyright © 2011-2022 走看看