Closed zhe-qi closed 2 months ago
建议使用 antfu eslint config 应用在 nestjs 项目当中, 并保存每个页面使用保存自动格式化,以达到项目规范
pnpm add -D eslint @antfu/eslint-config eslint-plugin-format
eslint.config.js import antfu from '@antfu/eslint-config'
eslint.config.js
import antfu from '@antfu/eslint-config'
export default antfu({ formatters: true, rules: { 'node/prefer-global/process': 'off', 'vue/eqeqeq': 'off', 'eqeqeq': 'off',
/** 兼容 ruoyi 前端 vue3 部分 */ 'vue/require-valid-default-prop': 'off', 'vue/no-side-effects-in-computed-properties': 'off', 'vue/no-unused-refs': 'off', 'regexp/no-unused-capturing-group': 'off', 'prefer-promise-reject-errors': 'off', 'array-callback-return': 'off', 'prefer-rest-params': 'off', /** 兼容 carole-admin 后端部分 */ 'unicorn/throw-new-error': 'off', 'ts/consistent-type-imports': 'off', 'no-unsafe-finally': 'off', 'regexp/no-misleading-capturing-group': 'off', 'regexp/optimal-quantifier-concatenation': 'off',
}, ignores: ['*/prisma-client/'], })
> .vscode/settings.json ```json { // Enable the ESlint flat config support // (remove this if your ESLint extension above v3.0.5) "eslint.experimental.useFlatConfig": true, // Disable the default formatter, use eslint instead "prettier.enable": false, "editor.formatOnSave": false, // Auto fix "editor.codeActionsOnSave": { "source.fixAll.eslint": "explicit", "source.organizeImports": "never" }, // Silent the stylistic rules in you IDE, but still auto fix them "eslint.rules.customizations": [ { "rule": "style/*", "severity": "off" }, { "rule": "format/*", "severity": "off" }, { "rule": "*-indent", "severity": "off" }, { "rule": "*-spacing", "severity": "off" }, { "rule": "*-spaces", "severity": "off" }, { "rule": "*-order", "severity": "off" }, { "rule": "*-dangle", "severity": "off" }, { "rule": "*-newline", "severity": "off" }, { "rule": "*quotes", "severity": "off" }, { "rule": "*semi", "severity": "off" } ], // Enable eslint for all supported languages "eslint.validate": [ "javascript", "javascriptreact", "typescript", "typescriptreact", "vue", "html", "markdown", "json", "jsonc", "yaml", "toml", "xml", "gql", "graphql", "astro", "css", "less", "scss", "pcss", "postcss" ] }
建议使用 antfu eslint config 应用在 nestjs 项目当中, 并保存每个页面使用保存自动格式化,以达到项目规范
export default antfu({ formatters: true, rules: { 'node/prefer-global/process': 'off', 'vue/eqeqeq': 'off', 'eqeqeq': 'off',
}, ignores: ['*/prisma-client/'], })