@momsfriendlydevco/eslint-config 2.2.0 → 2.3.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.
package/eslint.config.js CHANGED
@@ -13,8 +13,7 @@ export default [
13
13
  // Generic globals
14
14
  languageOptions: {
15
15
  globals: {
16
- console: 'readonly',
17
- fetch: 'readonly',
16
+ // Put custom globals here
18
17
  },
19
18
  },
20
19
  },
package/index.js CHANGED
@@ -12,15 +12,17 @@ export let JSCommon = {
12
12
  // Generic rules
13
13
  'html-closing-bracket-spacing': ['off'], // Annoying doesn't allow <this-kind-of-thing/>
14
14
  'no-debugger': ['warn'], // Debuggers are fine, just warn
15
+ 'no-extra-boolean-cast': ['off'], // ESlint being a mama bear over boolean casting shorthand (`!!thing`)
15
16
  'no-useless-escape': ['off'], // ESlint frequently gets what should and shouldn't be escaped wrong
16
17
  'no-unused-vars': ['warn'], // Dont make unused vars the end of the world
17
18
 
18
19
  // JSDoc
19
20
  'jsdoc/check-alignment': ['off'], // Disable the JSDoc parser insisting on correct indents
20
21
  'jsdoc/check-tag-names': ['warn', { // Extend JSDoc allowed tags
21
- definedTags: ['date', 'fixme', 'note', 'slot', 'url'],
22
+ definedTags: ['date', 'env', 'fixme', 'note', 'slot', 'url'],
22
23
  }],
23
24
  'jsdoc/check-types': ['off'], // Disable the JSDoc parser being fussy about `@param {String}` vs `@param {string}`
25
+ 'jsdoc/empty-tags': ['off'], // Disable JSDoc being fussy about using stuff like `@override` with any other description parts
24
26
  'jsdoc/no-defaults': ['off'], // Disable the JSDoc parser that complains about optional params as its just silly
25
27
  'jsdoc/no-undefined-types': ['warn', {disableReporting: true}], // Disable the JSDoc parser for "undefined" types which it usually gets wrong. Ask eslint to still mark these as used though
26
28
  'jsdoc/require-returns-description': ['off'], // Disable the JSDoc parse being fussy about return descriptions
@@ -28,7 +30,41 @@ export let JSCommon = {
28
30
  };
29
31
 
30
32
  export default [
31
- // eslint-plugin-jsdoc (with custom settings)
33
+
34
+ // Generic globals {{{
35
+ {
36
+ languageOptions: {
37
+ globals: {
38
+ // Implied global functions
39
+ atob: 'readable',
40
+ btoa: 'readable',
41
+ clearInterval: 'readonly',
42
+ clearTimeout: 'readonly',
43
+ console: 'readonly',
44
+ fetch: 'readonly',
45
+ setInterval: 'readonly',
46
+ setTimeout: 'readonly',
47
+
48
+ // Implied Global singletons
49
+ console: 'readable',
50
+
51
+ // Implied Global Classes
52
+ Array: 'readable',
53
+ Blob: 'readable',
54
+ Buffer: 'readable',
55
+ File: 'readable',
56
+ FormData: 'readable',
57
+ JSON: 'readable',
58
+ Promise: 'readable',
59
+ RegExp: 'readable',
60
+ URL: 'readable',
61
+ URLSearchParams: 'readable',
62
+ },
63
+ },
64
+ },
65
+ // }}}
66
+
67
+ // eslint-plugin-jsdoc (with custom settings) {{{
32
68
  {
33
69
  ...pluginJSDoc.configs['flat/recommended'],
34
70
  settings: {
@@ -44,8 +80,9 @@ export default [
44
80
  },
45
81
  },
46
82
  },
83
+ // }}}
47
84
 
48
- // eslint-plugin-unicorn
85
+ // eslint-plugin-unicorn {{{
49
86
  {
50
87
  ...pluginUnicorn.configs['flat/recommended'],
51
88
  rules: {
@@ -79,9 +116,32 @@ export default [
79
116
  'unicorn/switch-case-braces': ['warn', 'avoid'],
80
117
  },
81
118
  },
119
+ // }}}
82
120
 
83
- // eslint-plugin-vue
121
+ // eslint-plugin-vue {{{
84
122
  ...pluginVue.configs['flat/recommended'],
123
+ // }}}
124
+
125
+ // Cloudflare workers {{{
126
+ {
127
+ files: ['**/workers/**/*.js'],
128
+
129
+ // Wrangler ignore rules
130
+ languageOptions: {
131
+ globals: {
132
+ // Implied Global Cloudflare Worker Classes
133
+ crypto: 'readable',
134
+ Headers: 'readable',
135
+ TextEncoder: 'readable',
136
+ Request: 'readable',
137
+ Response: 'readable',
138
+ },
139
+ },
140
+ rules: {
141
+ ...JSCommon,
142
+ },
143
+ },
144
+ // }}}
85
145
 
86
146
  // .doop backend Files {{{
87
147
  {
@@ -103,20 +163,48 @@ export default [
103
163
  // .mjs / .js regular files {{{
104
164
  {
105
165
  files: ['**/*.js', '**/*.mjs'],
166
+ languageOptions: {
167
+ globals: {
168
+ // Implied Global singletons
169
+ process: 'readable',
170
+ },
171
+ },
106
172
  rules: {
107
173
  ...JSCommon,
108
174
  },
109
175
  },
110
176
  // }}}
111
177
 
178
+ // Mocha test files {{{
179
+ {
180
+ files: ['**/test/**/*.js'],
181
+ languageOptions: {
182
+ globals: {
183
+ afterAll: 'readonly',
184
+ after: 'readonly',
185
+ beforeAll: 'readonly',
186
+ before: 'readonly',
187
+ describe: 'readonly',
188
+ it: 'readonly',
189
+ },
190
+ },
191
+ },
192
+ // }}}
193
+
112
194
  // .vue frontend Files {{{
113
195
  {
114
196
  files: ['**/*.vue'],
115
197
  languageOptions: {
116
198
  globals: {
117
- $: 'readable', // jQuery
118
- _: 'readable', // Lodash
119
- app: 'readable', // Global frontend app object
199
+ // See also: "Generic globals" > languageOptions > globals
200
+
201
+ // Not-really-a-thing-but-I'll-allow-it globals
202
+ app: 'readable', // Generally the Vue.$root frontend app object
203
+
204
+ // Implied meta-globals
205
+ document: 'readable',
206
+ navigator: 'readable',
207
+ window: 'readable',
120
208
  },
121
209
  parser: eslintParser,
122
210
  parserOptions: {
@@ -241,4 +329,5 @@ export default [
241
329
  },
242
330
  },
243
331
  // }}}
332
+
244
333
  ]
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@momsfriendlydevco/eslint-config",
3
3
  "description": "ESLint plugin for @MomsFriendlyDevCo projects",
4
- "version": "2.2.0",
4
+ "version": "2.3.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "test": "eslint --config index.js test/data"
@@ -24,10 +24,10 @@
24
24
  },
25
25
  "homepage": "https://github.com/MomsFriendlyDevCo/eslint#readme",
26
26
  "dependencies": {
27
- "eslint-plugin-jsdoc": "^51.0.1",
27
+ "eslint-plugin-jsdoc": "^51.3.4",
28
28
  "eslint-plugin-unicorn": "^59.0.1",
29
- "eslint-plugin-vue": "^10.2.0",
30
- "vue-eslint-parser": "^10.1.3"
29
+ "eslint-plugin-vue": "^10.3.0",
30
+ "vue-eslint-parser": "^10.2.0"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "eslint": "^9.26.0"