@houheaven/eslint-config-helper 1.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/README.md +112 -53
  2. package/format.js +40 -0
  3. package/html.js +32 -0
  4. package/index.js +18 -0
  5. package/lib/configs/eslint-es5.js +24 -0
  6. package/lib/configs/eslint.js +23 -0
  7. package/lib/configs/format-html.js +22 -0
  8. package/lib/configs/format-js.js +134 -0
  9. package/{eslint/prettier.js → lib/configs/format-prettier.js} +109 -45
  10. package/lib/configs/format-vue.js +278 -0
  11. package/lib/configs/html.js +20 -0
  12. package/lib/configs/import-bugfix.js +36 -0
  13. package/lib/configs/import.js +44 -0
  14. package/lib/configs/vue2.js +28 -0
  15. package/lib/configs/vue3.js +28 -0
  16. package/{eslint/rules → lib/rules/eslint}/best-practices.js +19 -19
  17. package/{eslint/rules → lib/rules/eslint}/es6.js +8 -9
  18. package/{eslint/rules → lib/rules/eslint}/node.js +0 -0
  19. package/{eslint/rules → lib/rules/eslint}/possible-errors.js +16 -11
  20. package/{eslint/rules → lib/rules/eslint}/strict-mode.js +0 -0
  21. package/{eslint/rules → lib/rules/eslint}/stylistic-issues.js +60 -59
  22. package/{eslint/rules → lib/rules/eslint}/variables.js +13 -11
  23. package/lib/rules/html/accessibility.js +44 -0
  24. package/lib/rules/html/best-practice.js +64 -0
  25. package/lib/rules/html/seo.js +24 -0
  26. package/lib/rules/html/style.js +32 -0
  27. package/lib/rules/import/helpful-warnings.js +68 -0
  28. package/lib/rules/import/module-systems.js +34 -0
  29. package/lib/rules/import/static-analysis.js +69 -0
  30. package/lib/rules/import/style-guide.js +97 -0
  31. package/lib/rules/vue/common-base.js +29 -0
  32. package/lib/rules/vue/common-eslint.js +220 -0
  33. package/lib/rules/vue/common-essential.js +267 -0
  34. package/lib/rules/vue/common-extra.js +282 -0
  35. package/lib/rules/vue/common-recommended.js +96 -0
  36. package/lib/rules/vue/common-strongly-recommended.js +138 -0
  37. package/lib/rules/vue/vue2-essential.js +41 -0
  38. package/lib/rules/vue/vue2-recommended.js +17 -0
  39. package/lib/rules/vue/vue2-strongly-recommended.js +16 -0
  40. package/lib/rules/vue/vue3-essential.js +129 -0
  41. package/lib/rules/vue/vue3-recommended.js +17 -0
  42. package/lib/rules/vue/vue3-strongly-recommended.js +24 -0
  43. package/lib/rules/vuejs-accessibility/index.js +92 -0
  44. package/package.json +37 -28
  45. package/vue2.js +30 -0
  46. package/vue3.js +28 -0
  47. package/eslint/eslint-fix.js +0 -29
  48. package/eslint/file-bof-eof.js +0 -22
  49. package/eslint/index.js +0 -18
  50. package/eslint/legacy.js +0 -34
  51. package/eslint/rules/imports.js +0 -279
  52. package/eslint/rules/vue.js +0 -23
@@ -0,0 +1,44 @@
1
+
2
+ // ==========================================================
3
+ // 可访问性(Accessibility)
4
+ // ==========================================================
5
+
6
+ module.exports = {
7
+ rules: {
8
+ // 要求 img 标签必须设置 alt 属性
9
+ // https://yeonjuan.github.io/html-eslint/docs/rules/require-img-alt
10
+ "@html-eslint/require-img-alt": "warn",
11
+
12
+ // 禁止 h1-h6 越级显示
13
+ // https://yeonjuan.github.io/html-eslint/docs/rules/no-skip-heading-levels
14
+ "@html-eslint/no-skip-heading-levels": "warn",
15
+
16
+ // 要求 frame、iframe 标签设置 title 属性
17
+ // https://yeonjuan.github.io/html-eslint/docs/rules/require-frame-title
18
+ "@html-eslint/require-frame-title": "warn",
19
+
20
+ // 禁止 <meta name="viewport"> 使用 user-scalable=no
21
+ // https://yeonjuan.github.io/html-eslint/docs/rules/no-non-scalable-viewport
22
+ "@html-eslint/no-non-scalable-viewport": "off",
23
+
24
+ // 禁止 tabindex 属性值为正数
25
+ // https://yeonjuan.github.io/html-eslint/docs/rules/no-positive-tabindex
26
+ "@html-eslint/no-positive-tabindex": "off",
27
+
28
+ // 要求 <head> 中必须设置 <meta name="viewport" ...>
29
+ // https://yeonjuan.github.io/html-eslint/docs/rules/require-meta-viewport
30
+ "@html-eslint/require-meta-viewport": "off",
31
+
32
+ // 禁止使用抽象的 role 属性
33
+ // https://yeonjuan.github.io/html-eslint/docs/rules/no-abstract-roles
34
+ "@html-eslint/no-abstract-roles": "warn",
35
+
36
+ // 禁止在 body 标签上使用 aria-hidden 属性
37
+ // https://yeonjuan.github.io/html-eslint/docs/rules/no-aria-hidden-body
38
+ "@html-eslint/no-aria-hidden-body": "warn",
39
+
40
+ // 禁止使用 accesskey 属性
41
+ // https://yeonjuan.github.io/html-eslint/docs/rules/no-accesskey-attrs
42
+ "@html-eslint/no-accesskey-attrs": "off",
43
+ },
44
+ };
@@ -0,0 +1,64 @@
1
+
2
+ // ==========================================================
3
+ // 最佳实践(Best Practice)
4
+ // ==========================================================
5
+
6
+ module.exports = {
7
+ rules: {
8
+ // 要求设置 <!DOCTYPE html> 文档申明
9
+ // https://yeonjuan.github.io/html-eslint/docs/rules/require-doctype
10
+ "@html-eslint/require-doctype": "warn",
11
+
12
+ // 禁止 id 属性重复
13
+ // https://yeonjuan.github.io/html-eslint/docs/rules/no-duplicate-id
14
+ "@html-eslint/no-duplicate-id": "error",
15
+
16
+ // 禁止使用行内样式
17
+ // https://yeonjuan.github.io/html-eslint/docs/rules/no-inline-styles
18
+ "@html-eslint/no-inline-styles": "warn",
19
+
20
+ // 强制 <li> 必须包裹在 <ul>、<ol>、<menu> 中
21
+ // https://yeonjuan.github.io/html-eslint/docs/rules/require-li-container
22
+ "@html-eslint/require-li-container": "warn",
23
+
24
+ // 禁止在 HTML5 中使用过时的标签
25
+ // https://yeonjuan.github.io/html-eslint/docs/rules/no-obsolete-tags
26
+ "@html-eslint/no-obsolete-tags": "warn",
27
+
28
+ // 要求标签闭合
29
+ // https://yeonjuan.github.io/html-eslint/docs/rules/require-closing-tags
30
+ "@html-eslint/require-closing-tags": ["warn", { selfClosing: "always" }],
31
+
32
+ // 强制在 <head> 中使用 <meta charset="..."> 文件编码
33
+ // https://yeonjuan.github.io/html-eslint/docs/rules/require-meta-charset
34
+ "@html-eslint/require-meta-charset": "warn",
35
+
36
+ // 禁止使用不安全的 target='_blank' 属性
37
+ // https://yeonjuan.github.io/html-eslint/docs/rules/no-target-blank
38
+ "@html-eslint/no-target-blank": "off",
39
+
40
+ // 禁止使用重复的属性
41
+ // https://yeonjuan.github.io/html-eslint/docs/rules/no-duplicate-attrs
42
+ "@html-eslint/no-duplicate-attrs": "error",
43
+
44
+ // 要求 button 标签设置一个有效的 type 属性
45
+ // https://yeonjuan.github.io/html-eslint/docs/rules/require-button-type
46
+ "@html-eslint/require-button-type": "off",
47
+
48
+ // 禁用特定的属性
49
+ // https://yeonjuan.github.io/html-eslint/docs/rules/no-restricted-attrs
50
+ "@html-eslint/no-restricted-attrs": [
51
+ "off",
52
+ {
53
+ tagPatterns: ["^div$", "^img$"],
54
+ attrPatterns: ["data-.*"],
55
+ message: "'data-x' is restricted.",
56
+ },
57
+ {
58
+ tagPatterns: ["^img$"],
59
+ attrPatterns: ["^alt$"],
60
+ message: "'alt' is restricted.",
61
+ },
62
+ ],
63
+ },
64
+ };
@@ -0,0 +1,24 @@
1
+
2
+ // ==========================================================
3
+ // 搜索引擎优化(SEO)
4
+ // ==========================================================
5
+
6
+ module.exports = {
7
+ rules: {
8
+ // 要求 <html> 标签必须有 lang 属性
9
+ // https://yeonjuan.github.io/html-eslint/docs/rules/require-lang
10
+ "@html-eslint/require-lang": "off",
11
+
12
+ // 要求 <head> 标签中必须有 <title> 标签
13
+ // https://yeonjuan.github.io/html-eslint/docs/rules/require-title
14
+ "@html-eslint/require-title": "error",
15
+
16
+ // 要求 <head> 标签中必须有 <meta name="description" ...>
17
+ // https://yeonjuan.github.io/html-eslint/docs/rules/require-meta-description
18
+ "@html-eslint/require-meta-description": "off",
19
+
20
+ // 禁止多个 <h1> 标签
21
+ // https://yeonjuan.github.io/html-eslint/docs/rules/no-multiple-h1
22
+ "@html-eslint/no-multiple-h1": "off",
23
+ },
24
+ };
@@ -0,0 +1,32 @@
1
+
2
+ // ==========================================================
3
+ // 样式(Style)
4
+ // ==========================================================
5
+
6
+ module.exports = {
7
+ rules: {
8
+ // 禁止标签属性周围出现多余的空格
9
+ // https://yeonjuan.github.io/html-eslint/docs/rules/no-extra-spacing-attrs
10
+ "@html-eslint/no-extra-spacing-attrs": "off",
11
+
12
+ // 要求标签之间使用换行
13
+ // https://yeonjuan.github.io/html-eslint/docs/rules/element-newline
14
+ "@html-eslint/element-newline": "off",
15
+
16
+ // 要求使用一致的缩进
17
+ // https://yeonjuan.github.io/html-eslint/docs/rules/indent
18
+ "@html-eslint/indent": ["off", 2],
19
+
20
+ // 强制使用一致的引号
21
+ // https://yeonjuan.github.io/html-eslint/docs/rules/quotes
22
+ "@html-eslint/quotes": ["warn", "double"],
23
+
24
+ // 强制 id 属性命名规范
25
+ // https://yeonjuan.github.io/html-eslint/docs/rules/id-naming-convention
26
+ "@html-eslint/id-naming-convention": ["warn", "kebab-case"],
27
+
28
+ // 禁止出现多个空行
29
+ // https://yeonjuan.github.io/html-eslint/docs/rules/no-multiple-empty-lines
30
+ "@html-eslint/no-multiple-empty-lines": ["warn", { max: 2 }],
31
+ },
32
+ };
@@ -0,0 +1,68 @@
1
+
2
+ // ==========================================================
3
+ // 有益警告(Helpful Warnings)
4
+ // ==========================================================
5
+
6
+ module.exports = {
7
+ rules: {
8
+ // 禁止无效的导出(重复导出名称或默认值)
9
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/export.md
10
+ "import/export": "error",
11
+
12
+ // do not allow a default import name to match a named export
13
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-as-default.md
14
+ "import/no-named-as-default": "error",
15
+
16
+ // warn on accessing default export property names that are also named exports
17
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-as-default-member.md
18
+ "import/no-named-as-default-member": "error",
19
+
20
+ // 禁止使用 jsdoc-marked-deprecated 导入
21
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-deprecated.md
22
+ "import/no-deprecated": "off",
23
+
24
+ // 禁止使用无关的包
25
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-extraneous-dependencies.md
26
+ // paths are treated both as absolute paths, and relative to process.cwd()
27
+ "import/no-extraneous-dependencies": ["error", {
28
+ devDependencies: [
29
+ "test/**", // tape, common npm pattern
30
+ "tests/**", // also common npm pattern
31
+ "spec/**", // mocha, rspec-like pattern
32
+ "**/__tests__/**", // jest pattern
33
+ "**/__mocks__/**", // jest pattern
34
+ "test.{js,jsx}", // repos with a single test file
35
+ "test-*.{js,jsx}", // repos with multiple top-level test files
36
+ "**/*{.,_}{test,spec}.{js,jsx}", // tests where the extension or filename suffix denotes that it is a test
37
+ "**/jest.config.js", // jest config
38
+ "**/jest.setup.js", // jest setup
39
+ "**/vue.config.js", // vue-cli config
40
+ "**/webpack.config.js", // webpack config
41
+ "**/webpack.config.*.js", // webpack config
42
+ "**/rollup.config.js", // rollup config
43
+ "**/rollup.config.*.js", // rollup config
44
+ "**/gulpfile.js", // gulp config
45
+ "**/gulpfile.*.js", // gulp config
46
+ "**/Gruntfile{,.js}", // grunt config
47
+ "**/protractor.conf.js", // protractor config
48
+ "**/protractor.conf.*.js", // protractor config
49
+ "**/karma.conf.js", // karma config
50
+ "**/.eslintrc.js", // eslint config
51
+ ],
52
+ optionalDependencies: false,
53
+ }],
54
+
55
+ // 禁止使用易变的导出(var、let)
56
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-mutable-exports.md
57
+ "import/no-mutable-exports": "error",
58
+
59
+ // Reports modules without any exports, or with unused exports
60
+ // https://github.com/benmosher/eslint-plugin-import/blob/f63dd261809de6883b13b6b5b960e6d7f42a7813/docs/rules/no-unused-modules.md
61
+ // TODO: enable once it supports CJS
62
+ "import/no-unused-modules": ["off", {
63
+ ignoreExports: [],
64
+ missingExports: true,
65
+ unusedExports: true,
66
+ }],
67
+ },
68
+ };
@@ -0,0 +1,34 @@
1
+
2
+ // ==========================================================
3
+ // 模块系统(Module Systems)
4
+ // ==========================================================
5
+
6
+ module.exports = {
7
+ rules: {
8
+ // Warn if a module could be mistakenly parsed as a script by a consumer
9
+ // leveraging Unambiguous JavaScript Grammar
10
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/unambiguous.md
11
+ // this should not be enabled until this proposal has at least been *presented* to TC39.
12
+ // At the moment, it"s not a thing.
13
+ "import/unambiguous": "off",
14
+
15
+ // 禁用 require()
16
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-commonjs.md
17
+ "import/no-commonjs": "off",
18
+
19
+ // 禁用 AMD require/define
20
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-amd.md
21
+ "import/no-amd": "error",
22
+
23
+ // 禁用 Node.js 内置模块
24
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-nodejs-modules.md
25
+ "import/no-nodejs-modules": "error",
26
+
27
+ // 除了主模块以外,在使用 CommonJS 导出的任何文件中都不能使用 import 声明
28
+ // https://github.com/benmosher/eslint-plugin-import/blob/1012eb951767279ce3b540a4ec4f29236104bb5b/docs/rules/no-import-module-exports.md
29
+ "import/no-import-module-exports": ["error", {
30
+ exceptions: [],
31
+ }],
32
+
33
+ },
34
+ };
@@ -0,0 +1,69 @@
1
+
2
+ // ==========================================================
3
+ // 静态分析(Static Analysis)
4
+ // ==========================================================
5
+
6
+ module.exports = {
7
+ rules: {
8
+ // 确保导入的文件/模块必须存在
9
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unresolved.md
10
+ "import/no-unresolved": ["error", {
11
+ commonjs: true,
12
+ caseSensitive: true,
13
+ }],
14
+
15
+ // 确保命名导入时,原模块中存在导出的值
16
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/named.md#when-not-to-use-it
17
+ "import/named": "error",
18
+
19
+ // 确保默认导入时,原模块中存在默认导出
20
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/default.md#when-not-to-use-it
21
+ "import/default": "error",
22
+
23
+ // 确保命名空间导入时,原模块中存在导出的值
24
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/namespace.md
25
+ "import/namespace": "error",
26
+
27
+ // 限制特定文件夹中的文件不能被导入
28
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-restricted-paths.md
29
+ "import/no-restricted-paths": "off",
30
+
31
+ // 禁止使用绝对路径导入模块
32
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-absolute-path.md
33
+ "import/no-absolute-path": "error",
34
+
35
+ // 禁止 require() 使用表达式调用
36
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-dynamic-require.md
37
+ "import/no-dynamic-require": "error",
38
+
39
+ // 防止导入其他模块的子模块
40
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-internal-modules.md
41
+ "import/no-internal-modules": ["off", {
42
+ allow: [],
43
+ }],
44
+
45
+ // 禁止在导入时使用 webpack loader 语法
46
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-webpack-loader-syntax.md
47
+ "import/no-webpack-loader-syntax": "error",
48
+
49
+ // 禁止模块导入自身
50
+ // https://github.com/benmosher/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/no-self-import.md
51
+ "import/no-self-import": "error",
52
+
53
+ // 禁止模块间的死循环相互导入
54
+ // https://github.com/benmosher/eslint-plugin-import/blob/d81f48a2506182738409805f5272eff4d77c9348/docs/rules/no-cycle.md
55
+ "import/no-cycle": ["error", { maxDepth: "∞" }],
56
+
57
+ // 导入时防止出现不必要的路径部分
58
+ // https://github.com/benmosher/eslint-plugin-import/blob/ebafcbf59ec9f653b2ac2a0156ca3bcba0a7cf57/docs/rules/no-useless-path-segments.md
59
+ "import/no-useless-path-segments": ["error", { commonjs: true, noUselessIndex: true }],
60
+
61
+ // 防止导入到相对父路径中的文件夹
62
+ // https://github.com/benmosher/eslint-plugin-import/blob/c34f14f67f077acd5a61b3da9c0b0de298d20059/docs/rules/no-relative-parent-imports.md
63
+ "import/no-relative-parent-imports": "off",
64
+
65
+ // 防止通过相对路径导入包
66
+ // https://github.com/benmosher/eslint-plugin-import/blob/1012eb951767279ce3b540a4ec4f29236104bb5b/docs/rules/no-relative-packages.md
67
+ "import/no-relative-packages": "off",
68
+ },
69
+ };
@@ -0,0 +1,97 @@
1
+
2
+ // ==========================================================
3
+ // 风格指南(Style Guide)
4
+ // ==========================================================
5
+
6
+ module.exports = {
7
+ rules: {
8
+ // import 要放在文件最前面
9
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/first.md
10
+ "import/first": "warn",
11
+
12
+ // import 要放在文件最前面(已废弃)
13
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/imports-first.md
14
+ // deprecated: use `import/first`
15
+ "import/imports-first": "off",
16
+
17
+ // export 要放在文件最后面
18
+ // https://github.com/benmosher/eslint-plugin-import/blob/98acd6afd04dcb6920b81330114e146dc8532ea4/docs/rules/exports-last.md
19
+ "import/exports-last": "warn",
20
+
21
+ // 禁止在多个地方重复导入同一模块
22
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md
23
+ "import/no-duplicates": "off",
24
+
25
+ // 禁止命名空间(又名“通配符” *)导入
26
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-namespace.md
27
+ "import/no-namespace": "warn",
28
+
29
+ // 文件后缀名
30
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/extensions.md
31
+ "import/extensions": ["warn", "always", {
32
+ ignorePackages: true,
33
+ }],
34
+
35
+ // import 导入排序
36
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/order.md
37
+ "import/order": ["warn", {
38
+ groups: [
39
+ "builtin",
40
+ ["external", "internal"],
41
+ ],
42
+ }],
43
+
44
+ // 强制在最后一个顶级导入 import 语句或 require 调用之后有一个或多个空行
45
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/newline-after-import.md
46
+ "import/newline-after-import": "off",
47
+
48
+ // 当一个模块只有一个导出时,更喜欢使用默认导出而不是命名导出
49
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/prefer-default-export.md
50
+ "import/prefer-default-export": "warn",
51
+
52
+ // 禁止模块有太多的依赖
53
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/max-dependencies.md
54
+ "import/max-dependencies": ["off", { max: 10 }],
55
+
56
+ // 禁止未分配的导入
57
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unassigned-import.md
58
+ // importing for side effects is perfectly acceptable, if you need side effects.
59
+ "import/no-unassigned-import": ["error", {
60
+ allow: ["**/*.css", "**/*.less", "echarts/**/*.*"],
61
+ }],
62
+
63
+ // import 时不能使用 default 关键字
64
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-default.md
65
+ "import/no-named-default": "warn",
66
+
67
+ // 禁止默认导出
68
+ // https://github.com/benmosher/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/no-default-export.md
69
+ "import/no-default-export": "off",
70
+
71
+ // 禁止命名导出
72
+ // https://github.com/benmosher/eslint-plugin-import/blob/1ec80fa35fa1819e2d35a70e68fb6a149fb57c5e/docs/rules/no-named-export.md
73
+ "import/no-named-export": "off",
74
+
75
+ // 要求默认导出的值必须先定义
76
+ // https://github.com/benmosher/eslint-plugin-import/blob/d9b712ac7fd1fddc391f7b234827925c160d956f/docs/rules/no-anonymous-default-export.md
77
+ "import/no-anonymous-default-export": ["off", {
78
+ allowArray: false,
79
+ allowArrowFunction: false,
80
+ allowAnonymousClass: false,
81
+ allowAnonymousFunction: false,
82
+ allowLiteral: false,
83
+ allowObject: false,
84
+ }],
85
+
86
+ // 一个文件中保留一个导出出口(易辨识、易维护)
87
+ // https://github.com/benmosher/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/group-exports.md
88
+ "import/group-exports": "warn",
89
+
90
+ // 动态导入时要求携带 webpackChunkName 注释
91
+ // https://github.com/benmosher/eslint-plugin-import/blob/ebafcbf59ec9f653b2ac2a0156ca3bcba0a7cf57/docs/rules/dynamic-import-chunkname.md
92
+ "import/dynamic-import-chunkname": ["warn", {
93
+ importFunctions: [],
94
+ webpackChunknameFormat: "[0-9a-zA-Z-_/.]+",
95
+ }],
96
+ },
97
+ };
@@ -0,0 +1,29 @@
1
+
2
+ // ==========================================================
3
+ // 基础规则(plugin:vue/base)
4
+ // 说明:Vue2、Vue3 中最基础的规则
5
+ // ==========================================================
6
+
7
+ module.exports = {
8
+ parser: require.resolve("vue-eslint-parser"),
9
+ parserOptions: {
10
+ ecmaVersion: 2020,
11
+ sourceType: "module",
12
+ },
13
+ env: {
14
+ browser: true,
15
+ es6: true,
16
+ },
17
+ plugins: ["vue"],
18
+ rules: {
19
+ // 在 <template> 中支持 eslint 注释指令
20
+ // https://eslint.vuejs.org/rules/comment-directive.html
21
+ "vue/comment-directive": ["warn", {
22
+ "reportUnusedDisableDirectives": true,
23
+ }],
24
+
25
+ // 防止 JSX 中使用的变量被标记为未使用
26
+ // https://eslint.vuejs.org/rules/jsx-uses-vars.html
27
+ "vue/jsx-uses-vars": "error",
28
+ },
29
+ };