@meteorlxy/eslint-config 2.9.0 → 2.14.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 (2) hide show
  1. package/lib/index.js +57 -7
  2. package/package.json +2 -2
package/lib/index.js CHANGED
@@ -1,3 +1,5 @@
1
+ const airbnbRulesImports = require('eslint-config-airbnb-base/rules/imports');
2
+
1
3
  /**
2
4
  * Based on Airbnb JavaScript Base Style
3
5
  *
@@ -13,18 +15,29 @@ module.exports = {
13
15
  // Rules overrides
14
16
  rules: {
15
17
  /**
16
- * Override airbnb-base rules to allow for-of
18
+ * Disable checking for-in loops guard
19
+ *
20
+ * @see https://eslint.org/docs/rules/guard-for-in
21
+ * @see https://github.com/airbnb/javascript/blob/366bfa66380c08304101c6add46355696e90b348/packages/eslint-config-airbnb-base/rules/best-practices.js#L60-L62
22
+ */
23
+ 'guard-for-in': 'off',
24
+
25
+ /**
26
+ * Allow await in loop
27
+ *
28
+ * @see https://eslint.org/docs/rules/no-await-in-loop
29
+ * @see https://github.com/airbnb/javascript/blob/366bfa66380c08304101c6add46355696e90b348/packages/eslint-config-airbnb-base/rules/errors.js#L15-L17
30
+ */
31
+ 'no-await-in-loop': 'off',
32
+
33
+ /**
34
+ * Override airbnb-base rules to allow for-of and for-in
17
35
  *
18
36
  * @see https://eslint.org/docs/rules/no-restricted-syntax
19
- * @see https://github.com/airbnb/javascript/blob/1ca21aba799699ba556bed058e3900514a9fbee3/packages/eslint-config-airbnb-base/rules/style.js#L336-L339
37
+ * @see https://github.com/airbnb/javascript/blob/366bfa66380c08304101c6add46355696e90b348/packages/eslint-config-airbnb-base/rules/style.js#L334-L354
20
38
  */
21
39
  'no-restricted-syntax': [
22
40
  'error',
23
- {
24
- selector: 'ForInStatement',
25
- message:
26
- 'for..in loops iterate over the entire prototype chain, which is virtually never what you want.',
27
- },
28
41
  {
29
42
  selector: 'LabeledStatement',
30
43
  message:
@@ -67,6 +80,43 @@ module.exports = {
67
80
  },
68
81
  ],
69
82
 
83
+ /**
84
+ * Override airbnb-base rules to enforce .mjs extension
85
+ *
86
+ * @see https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/extensions.md
87
+ * @see https://github.com/airbnb/javascript/blob/1ca21aba799699ba556bed058e3900514a9fbee3/packages/eslint-config-airbnb-base/rules/imports.js#L138-L142
88
+ */
89
+ 'import/extensions': [
90
+ airbnbRulesImports.rules['import/extensions'][0],
91
+ airbnbRulesImports.rules['import/extensions'][1],
92
+ {
93
+ ...airbnbRulesImports.rules['import/extensions'][2],
94
+ mjs: 'always',
95
+ },
96
+ ],
97
+
98
+ /**
99
+ * Add config files of some other tools
100
+ *
101
+ * @see https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-extraneous-dependencies.md
102
+ */
103
+ 'import/no-extraneous-dependencies': [
104
+ airbnbRulesImports.rules['import/no-extraneous-dependencies'][0],
105
+ {
106
+ ...airbnbRulesImports.rules['import/no-extraneous-dependencies'][1],
107
+ devDependencies: [
108
+ ...airbnbRulesImports.rules['import/no-extraneous-dependencies'][1]
109
+ .devDependencies,
110
+ '**/.vitepress/*.js',
111
+ '**/.vuepress/*.js',
112
+ '**/tsup.config.js',
113
+ '**/vite.config.js',
114
+ '**/vitest.config.js',
115
+ '**/vuepress.config.js',
116
+ ],
117
+ },
118
+ ],
119
+
70
120
  /**
71
121
  * Override airbnb-base rules to ensure import order
72
122
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meteorlxy/eslint-config",
3
- "version": "2.9.0",
3
+ "version": "2.14.0",
4
4
  "description": "meteorlxy eslint config",
5
5
  "keywords": [
6
6
  "config",
@@ -25,5 +25,5 @@
25
25
  "publishConfig": {
26
26
  "access": "public"
27
27
  },
28
- "gitHead": "74b8742085fab0087bfd67aef778521b2d62010e"
28
+ "gitHead": "c44744f2ce35da54fc07e44aa0227c067a4724f7"
29
29
  }