为了简化配置,ESLint 团队经过 18 个月的修订和讨论,决定着手构建一个全新的配置系统 flat config,现在可以在 ESLint v8.21.0 中通过 API 使用。 可以通过如下链接了解更多: ESLint's new config system, Part 1 ESLint's new config system, Part 2 ESLint's new config system, Part 3 2.新版Vue 3...
Since v1.0.0, this config is rewritten to the new ESLint Flat config, check the release note for more details. Since v3.0.0, ESLint v9.5.0+ is now required.UsageStarter WizardWe provided a CLI tool to help you set up your project, or migrate from the legacy config to the new fla...
* feat: migrate to ESLint flat config * fix: add TypeScript as dev dependency and pin patched vitepress * chore: lint * refactor: declare `typescript` dependency only in root package.jsonmain (unovue/radix-vue#907) DamianGlowala authored May 16, 2024 Verified 1 parent 2aff053 commit ...
// eslint.config.mjsimportpluginVuefrom'eslint-plugin-vue'import{defineConfig,createConfigasvueTsEslintConfig,}from'@vue/eslint-config-typescript'exportdefaultdefineConfig(pluginVue.configs['flat/essential'],vueTsEslintConfig(),) The above configuration enablesthe essential rules for Vue 3andthe ...
eslint在项目中的配置使用步骤 安装eslint npm init @eslint/config 安装完毕之后,会在项目根目录看到 eslint.config.js 配置文件,其内容是 import globals from "globals"; import pluginJs from "@eslint/js"; import pluginVue from "eslint-plugin-vue"; ...
在根目录的vue.config.js中,把lintOnSave设置为true。 vs code安装插件与设置 在vscode上安装eslint和vetur插件,并在file>>prefrence>>setting 或文件>>首选项>>设置中,找到setting.json,添加如下配置,让vscode每次保持的时候安装eslint规范来自动格式化:
prettier/prettier-eslint: Code prettier eslint --fix Formatted Code :sparkles: (github.com) # 下载依赖 pnpm install -D prettier # 创建prettierrc.json文件 # 创建.prettierignore文件 主要还是得使用FlatCompat来修正不支持flat配置的插件,具体方法看上面的eslint.config.js就行了。
...pluginVue.configs["flat/essential"], ...vueTsEslintConfig({// Optional: extend additional configurations from `typescript-eslint`.// Supports all the configurations in// https://typescript-eslint.io/users/configs#recommended-configurationsextends: [// By default, only the recommended rules...
在src同级目录下添加eslint规范文件eslint.config.js,文件规范内容如下: importeslintfrom'@eslint/js'importglobalsfrom'globals'importeslintPluginVuefrom'eslint-plugin-vue'exportdefault[{ignores:['node_modules','dist','public',],},eslint.configs.recommended,...eslintPluginVue.configs['flat/recommende...
importsomeConfigfrom"some-other-config-you-use";importprettierConfigfrom"@vue/eslint-config-prettier";exportdefault[someConfig, prettierConfig]; Make sure to put itlast, so it gets the chance to override other configs. This configuration is the most straightward way to use ESLint with Prettier...