{"id":31970666,"url":"https://github.com/winjs-dev/eslint-config-win","last_synced_at":"2025-10-14T19:18:08.634Z","repository":{"id":40672129,"uuid":"271286716","full_name":"winjs-dev/eslint-config-win","owner":"winjs-dev","description":"ESLint 配置","archived":false,"fork":false,"pushed_at":"2023-08-18T10:46:07.000Z","size":2802,"stargazers_count":2,"open_issues_count":24,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-06T16:36:32.735Z","etag":null,"topics":["eslint","eslint-config","javascript","vue"],"latest_commit_sha":null,"homepage":"https://cloud-templates.github.io/eslint-config-win/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/winjs-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-10T13:37:17.000Z","updated_at":"2024-08-16T02:55:36.000Z","dependencies_parsed_at":"2024-06-21T16:52:39.317Z","dependency_job_id":"44e1759e-6a14-4c85-abcf-1a9832c423e3","html_url":"https://github.com/winjs-dev/eslint-config-win","commit_stats":null,"previous_names":["cloud-templates/eslint-config-win"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/winjs-dev/eslint-config-win","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winjs-dev%2Feslint-config-win","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winjs-dev%2Feslint-config-win/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winjs-dev%2Feslint-config-win/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winjs-dev%2Feslint-config-win/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/winjs-dev","download_url":"https://codeload.github.com/winjs-dev/eslint-config-win/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winjs-dev%2Feslint-config-win/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279007042,"owners_count":26084230,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["eslint","eslint-config","javascript","vue"],"created_at":"2025-10-14T19:18:07.534Z","updated_at":"2025-10-14T19:18:08.627Z","avatar_url":"https://github.com/winjs-dev.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# eslint-config-win\n\n此规则适用于 JavaScript/Vue 项目的 ESLint 配置规范。\n\n**目前已支持 Vue 3.0，需要指定 extends 配置vue3**\n\n## 安装\n\n\n```bash\nyarn add @winner-fed/eslint-config-win -D\n```\n\n##  依赖版本\n```bash\neslint ^7.32.0\nbabel-eslint ^10.1.0\nvue-eslint-parser ^7.11.0\neslint-plugin-vue ^7.20.0\n```\n*Tips*：如果项目中没有安装此依赖包或者版本不一致，请安装或者升级。 \n\n## 用法\n- 在你的项目的根目录下创建一个 `.eslintrc.js` 文件，并将以下内容复制进去：\n\n```js\nmodule.exports = {\n    extends: [\n        '@winner-fed/win',\n    ],\n    env: {\n        // 你的环境变量（包含多个预定义的全局变量）\n        //\n        // browser: true,\n        // node: true,\n        // mocha: true,\n        // jest: true,\n        // jquery: true\n    },\n    globals: {\n        // 你的全局变量（设置为 false 表示它不允许被重新赋值）\n        //\n        // myGlobal: false\n    },\n    rules: {\n        // 自定义你的规则\n    }\n};\n```\n\n- 项目目录下的 `package.json` 添加检测指令，举个例子\n```diff\n{\n ...\n \"scripts\": {\n+    \"lint:es\": \"eslint \\\"src/**/*.{vue,js,jsx}\\\" --fix\",\n }\n ...\n}\n```\n\n### Vue\n\n```bash\nnpm install --save-dev eslint babel-eslint vue-eslint-parser eslint-plugin-vue @winner-fed/eslint-config-win\n```\n\n在你的项目的根目录下创建一个 `.eslintrc.js` 文件，并将以下内容复制进去：\n\n```js\nmodule.exports = {\n    extends: [\n        '@winner-fed/win',\n        // 这里是针对 vue2 的配置\n        '@winner-fed/win/vue', \n        // 如果是 vue3 的项目工程，则推荐下面配置\n        // '@winner-fed/win/vue3',\n    ],\n    env: {\n        // 你的环境变量（包含多个预定义的全局变量）\n        //\n        // browser: true,\n        // node: true,\n        // mocha: true,\n        // jest: true,\n        // jquery: true\n    },\n    globals: {\n        // 你的全局变量（设置为 false 表示它不允许被重新赋值）\n        //\n        // myGlobal: false\n    },\n    rules: {\n        // 自定义你的规则\n    }\n};\n```\n\n## Vue3 新增规则\n| rule                                                         | 规则描述                                             |\n| ------------------------------------------------------------ | ---------------------------------------------------- |\n| [vue/custom-event-name-casing ](https://eslint.vuejs.org/rules/custom-event-name-casing.html) | 自定义事件名必须用 kebab-case 风格                   |\n| [vue/no-arrow-functions-in-watch](https://eslint.vuejs.org/rules/no-arrow-functions-in-watch.html) | watch 中禁止使用箭头函数                             |\n| [vue/no-deprecated-data-object-declaration ](https://eslint.vuejs.org/rules/no-deprecated-data-object-declaration.html) | 禁止在 data 中使用已废弃的对象定义                   |\n| [vue/no-deprecated-destroyed-lifecycle](https://eslint.vuejs.org/rules/no-deprecated-destroyed-lifecycle.html) | 禁止使用已废弃的 destroyed 和 beforeDestroy 生命周期 |\n| [vue/no-deprecated-dollar-listeners-api](https://eslint.vuejs.org/rules/no-deprecated-dollar-listeners-api.html) | 禁止使用已废弃的 $listeners                          |\n| [vue/no-deprecated-dollar-scopedslots-api ](https://eslint.vuejs.org/rules/no-deprecated-dollar-scopedslots-api.html) | 禁止使用已废弃的 $scopedSlots                        |\n| [vue/no-deprecated-events-api ](https://eslint.vuejs.org/rules/no-deprecated-events-api.html) | 禁止使用已废弃的 events 接口                         |\n| [vue/no-deprecated-filter ](https://eslint.vuejs.org/rules/no-deprecated-filter.html) | 禁止使用已废弃的 filters 语法                        |\n| [vue/no-deprecated-functional-template](https://eslint.vuejs.org/rules/no-deprecated-functional-template.html) | 禁止使用已废弃的 functional 模版                     |\n| [vue/no-deprecated-html-element-is](https://eslint.vuejs.org/rules/no-deprecated-html-element-is.html) | 禁止使用已废弃的 is 属性                             |\n| [vue/no-deprecated-inline-template](https://eslint.vuejs.org/rules/no-deprecated-inline-template.html) | 禁止使用已废弃的 inline-template 属性                |\n| [vue/no-deprecated-props-default-this ](https://eslint.vuejs.org/rules/no-deprecated-props-default-this.html) | 禁止使用已废弃的 this                                |\n| [vue/no-deprecated-v-bind-sync](https://eslint.vuejs.org/rules/no-deprecated-v-bind-sync.html) | 禁止在 v-bind 指令中使用已废弃的 .sync 修饰符        |\n| [vue/no-deprecated-v-on-native-modifier](https://eslint.vuejs.org/rules/no-deprecated-v-on-native-modifier.html) | 禁止使用已废弃的 .native 修饰符                      |\n| [vue/no-deprecated-v-on-number-modifiers ](https://eslint.vuejs.org/rules/no-deprecated-v-on-number-modifiers.html) | 禁止使用已废弃的数字修饰符                           |\n| [vue/no-deprecated-vue-config-keycodes](https://eslint.vuejs.org/rules/no-deprecated-vue-config-keycodes.html) | 禁止使用已废弃的 Vue.config.keyCodes                 |\n| [vue/no-dupe-v-else-if ](https://eslint.vuejs.org/rules/no-dupe-v-else-if.html) | 禁止在 v-if 和 v-else-if 中出现重复的测试表达式      |\n| [vue/no-duplicate-attr-inheritance](https://eslint.vuejs.org/rules/no-duplicate-attr-inheritance.html) | 使用 v-bind=\"$attrs\" 时 inheritAttrs 必须是 false    |\n| [vue/no-empty-component-block](https://eslint.vuejs.org/rules/no-empty-component-block.html) | 禁止 `\u003ctemplate\u003e \u003cscript\u003e \u003cstyle\u003e` 为空                |\n| [vue/no-invalid-model-keys](https://eslint.vuejs.org/rules/no-invalid-model-keys.html) | 禁止 model 中出现错误的属性                          |\n| [vue/no-lifecycle-after-await](https://eslint.vuejs.org/rules/no-lifecycle-after-await.html) | 禁止异步注册生命周期                                 |\n| [vue/no-lone-template ](https://eslint.vuejs.org/rules/no-lone-template.html) | 禁止出现没必要的 `\u003ctemplate\u003e`                          |\n| [vue/no-multiple-objects-in-class](https://eslint.vuejs.org/rules/no-multiple-objects-in-class.html) | 禁止 class 中出现复数的对象                          |\n| [vue/no-multiple-slot-args](https://eslint.vuejs.org/rules/no-multiple-slot-args.html) | 禁止给 scoped slots 传递多个参数                     |\n| [vue/no-multiple-template-root ](https://eslint.vuejs.org/rules/no-multiple-template-root.html) | 禁止模版中有多个根节点                               |\n| [vue/no-mutating-props ](https://eslint.vuejs.org/rules/no-mutating-props.html) | 禁止修改组件的 props                                 |\n| [vue/no-ref-as-operand ](https://eslint.vuejs.org/rules/no-ref-as-operand.html) | 禁止直接使用由 ref 生成的变量，必须使用它的 value    |\n| [vue/no-setup-props-destructure](https://eslint.vuejs.org/rules/no-setup-props-destructure.html) | 禁止对 setup 中的 props 解构                         |\n| [vue/no-sparse-arrays ](https://eslint.vuejs.org/rules/no-sparse-arrays.html) | 禁止在数组中出现连续的逗号                           |\n| [vue/no-useless-concat ](https://eslint.vuejs.org/rules/no-useless-concat.html) | 禁止没必要的字符拼接                                 |\n| [vue/no-useless-mustaches ](https://eslint.vuejs.org/rules/no-useless-mustaches.html) | 禁止出现无用的 mustache 字符串                       |\n| [vue/no-useless-v-bind ](https://eslint.vuejs.org/rules/no-useless-v-bind.html) | 禁止出现无用的 v-bind                                |\n| [vue/no-watch-after-await ](https://eslint.vuejs.org/rules/no-watch-after-await.html) | 禁止在 await 之后调用 watch                          |\n| [vue/one-component-per-file ](https://eslint.vuejs.org/rules/one-component-per-file.html) | 一个文件必须仅包含一个组件                           |\n| [vue/order-in-components ](https://eslint.vuejs.org/rules/order-in-components.html) | 组件的属性必须为一定的顺序                           |\n| [vue/require-explicit-emits](https://eslint.vuejs.org/rules/require-explicit-emits.html) | emits 属性必须包含 $emit() 中的值                    |\n| [vue/require-slots-as-functions ](https://eslint.vuejs.org/rules/require-slots-as-functions.html) | this.$slots.default 必须被当作方法使用               |\n| [vue/require-toggle-inside-transition](https://eslint.vuejs.org/rules/require-toggle-inside-transition.html) | transition 内部必须有条件指令                        |\n| [vue/return-in-emits-validator](https://eslint.vuejs.org/rules/this-in-template.html) | emits 中的方法必须有返回值                           |\n| [vue/v-on-event-hyphenation](https://eslint.vuejs.org/rules/v-on-event-hyphenation.html) | 禁止在 v-on 的事件名使用横杠                         | \n| [vue/valid-v-is ](https://eslint.vuejs.org/rules/valid-v-is.html) | v-is 指令必须合法                                    | \n\n## 参考\n\n- [ESlint Code Guide](http://eslint.org/docs/user-guide/configuring)\n- [ESlint Shareable Config](http://eslint.org/docs/developer-guide/shareable-configs)\n- [eslint-config-alloy](https://github.com/AlloyTeam/eslint-config-alloy)\n\n## 开发维护\n- 以测试开发驱动，config/rules/*.json 文件都是根据 test/ 文件夹对应的生成的\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwinjs-dev%2Feslint-config-win","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwinjs-dev%2Feslint-config-win","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwinjs-dev%2Feslint-config-win/lists"}