@momsfriendlydevco/eslint-config 2.2.1 → 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.
Files changed (2) hide show
  1. package/index.js +64 -7
  2. package/package.json +4 -4
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,23 +30,41 @@ export let JSCommon = {
28
30
  };
29
31
 
30
32
  export default [
33
+
31
34
  // Generic globals {{{
32
35
  {
33
36
  languageOptions: {
34
37
  globals: {
38
+ // Implied global functions
39
+ atob: 'readable',
40
+ btoa: 'readable',
35
41
  clearInterval: 'readonly',
36
42
  clearTimeout: 'readonly',
37
43
  console: 'readonly',
38
44
  fetch: 'readonly',
39
45
  setInterval: 'readonly',
40
46
  setTimeout: 'readonly',
41
- window: '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',
42
62
  },
43
63
  },
44
64
  },
45
65
  // }}}
46
66
 
47
- // eslint-plugin-jsdoc (with custom settings)
67
+ // eslint-plugin-jsdoc (with custom settings) {{{
48
68
  {
49
69
  ...pluginJSDoc.configs['flat/recommended'],
50
70
  settings: {
@@ -60,6 +80,7 @@ export default [
60
80
  },
61
81
  },
62
82
  },
83
+ // }}}
63
84
 
64
85
  // eslint-plugin-unicorn {{{
65
86
  {
@@ -101,6 +122,27 @@ export default [
101
122
  ...pluginVue.configs['flat/recommended'],
102
123
  // }}}
103
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
+ // }}}
145
+
104
146
  // .doop backend Files {{{
105
147
  {
106
148
  files: ['**/*.doop'],
@@ -121,6 +163,12 @@ export default [
121
163
  // .mjs / .js regular files {{{
122
164
  {
123
165
  files: ['**/*.js', '**/*.mjs'],
166
+ languageOptions: {
167
+ globals: {
168
+ // Implied Global singletons
169
+ process: 'readable',
170
+ },
171
+ },
124
172
  rules: {
125
173
  ...JSCommon,
126
174
  },
@@ -132,8 +180,12 @@ export default [
132
180
  files: ['**/test/**/*.js'],
133
181
  languageOptions: {
134
182
  globals: {
135
- it: 'readonly',
183
+ afterAll: 'readonly',
184
+ after: 'readonly',
185
+ beforeAll: 'readonly',
186
+ before: 'readonly',
136
187
  describe: 'readonly',
188
+ it: 'readonly',
137
189
  },
138
190
  },
139
191
  },
@@ -144,10 +196,14 @@ export default [
144
196
  files: ['**/*.vue'],
145
197
  languageOptions: {
146
198
  globals: {
147
- $: 'readable', // jQuery
148
- _: 'readable', // Lodash
149
- 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
150
205
  document: 'readable',
206
+ navigator: 'readable',
151
207
  window: 'readable',
152
208
  },
153
209
  parser: eslintParser,
@@ -273,4 +329,5 @@ export default [
273
329
  },
274
330
  },
275
331
  // }}}
332
+
276
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.1",
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"