@momsfriendlydevco/eslint-config 2.2.1 → 2.3.1

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 +41 -19
  2. package/package.json +5 -4
package/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import eslintParser from 'vue-eslint-parser';
2
+ import globals from 'globals';
2
3
  import pluginEslintJS from '@eslint/js';
3
4
  import pluginJSDoc from 'eslint-plugin-jsdoc';
4
5
  import pluginUnicorn from 'eslint-plugin-unicorn';
@@ -12,15 +13,17 @@ export let JSCommon = {
12
13
  // Generic rules
13
14
  'html-closing-bracket-spacing': ['off'], // Annoying doesn't allow <this-kind-of-thing/>
14
15
  'no-debugger': ['warn'], // Debuggers are fine, just warn
16
+ 'no-extra-boolean-cast': ['off'], // ESlint being a mama bear over boolean casting shorthand (`!!thing`)
15
17
  'no-useless-escape': ['off'], // ESlint frequently gets what should and shouldn't be escaped wrong
16
18
  'no-unused-vars': ['warn'], // Dont make unused vars the end of the world
17
19
 
18
20
  // JSDoc
19
21
  'jsdoc/check-alignment': ['off'], // Disable the JSDoc parser insisting on correct indents
20
22
  'jsdoc/check-tag-names': ['warn', { // Extend JSDoc allowed tags
21
- definedTags: ['date', 'fixme', 'note', 'slot', 'url'],
23
+ definedTags: ['date', 'env', 'fixme', 'note', 'slot', 'url'],
22
24
  }],
23
25
  'jsdoc/check-types': ['off'], // Disable the JSDoc parser being fussy about `@param {String}` vs `@param {string}`
26
+ 'jsdoc/empty-tags': ['off'], // Disable JSDoc being fussy about using stuff like `@override` with any other description parts
24
27
  'jsdoc/no-defaults': ['off'], // Disable the JSDoc parser that complains about optional params as its just silly
25
28
  '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
29
  'jsdoc/require-returns-description': ['off'], // Disable the JSDoc parse being fussy about return descriptions
@@ -28,23 +31,18 @@ export let JSCommon = {
28
31
  };
29
32
 
30
33
  export default [
34
+
31
35
  // Generic globals {{{
32
36
  {
33
37
  languageOptions: {
34
38
  globals: {
35
- clearInterval: 'readonly',
36
- clearTimeout: 'readonly',
37
- console: 'readonly',
38
- fetch: 'readonly',
39
- setInterval: 'readonly',
40
- setTimeout: 'readonly',
41
- window: 'readonly',
39
+ ...globals.node,
42
40
  },
43
41
  },
44
42
  },
45
43
  // }}}
46
44
 
47
- // eslint-plugin-jsdoc (with custom settings)
45
+ // eslint-plugin-jsdoc (with custom settings) {{{
48
46
  {
49
47
  ...pluginJSDoc.configs['flat/recommended'],
50
48
  settings: {
@@ -60,6 +58,7 @@ export default [
60
58
  },
61
59
  },
62
60
  },
61
+ // }}}
63
62
 
64
63
  // eslint-plugin-unicorn {{{
65
64
  {
@@ -101,14 +100,31 @@ export default [
101
100
  ...pluginVue.configs['flat/recommended'],
102
101
  // }}}
103
102
 
103
+ // Cloudflare workers {{{
104
+ {
105
+ files: ['**/workers/**/*.js'],
106
+
107
+ // Wrangler ignore rules
108
+ languageOptions: {
109
+ globals: {
110
+ // Global Cloudflare Worker Classes
111
+ ...globals.worker,
112
+ },
113
+ },
114
+ rules: {
115
+ ...JSCommon,
116
+ },
117
+ },
118
+ // }}}
119
+
104
120
  // .doop backend Files {{{
105
121
  {
106
122
  files: ['**/*.doop'],
107
123
  languageOptions: {
108
124
  parser: eslintParser,
109
125
  globals: {
110
- app: 'readable', // Global backend App object
111
- db: 'readable', // Global app.db shortcut
126
+ app: 'readonly', // Global backend App object
127
+ db: 'readonly', // Global app.db shortcut
112
128
  },
113
129
  },
114
130
  rules: {
@@ -121,19 +137,25 @@ export default [
121
137
  // .mjs / .js regular files {{{
122
138
  {
123
139
  files: ['**/*.js', '**/*.mjs'],
140
+ languageOptions: {
141
+ globals: {
142
+ ...globals.node,
143
+ },
144
+ },
124
145
  rules: {
125
146
  ...JSCommon,
126
147
  },
127
148
  },
128
149
  // }}}
129
150
 
130
- // Mocha test files {{{
151
+ // Mocha/Chai test files {{{
131
152
  {
132
153
  files: ['**/test/**/*.js'],
133
154
  languageOptions: {
134
155
  globals: {
135
- it: 'readonly',
136
- describe: 'readonly',
156
+ ...globals.chai,
157
+ ...globals.mocha,
158
+ ...globals.node,
137
159
  },
138
160
  },
139
161
  },
@@ -144,11 +166,10 @@ export default [
144
166
  files: ['**/*.vue'],
145
167
  languageOptions: {
146
168
  globals: {
147
- $: 'readable', // jQuery
148
- _: 'readable', // Lodash
149
- app: 'readable', // Global frontend app object
150
- document: 'readable',
151
- window: 'readable',
169
+ // Not-really-a-thing-but-I'll-allow-it globals
170
+ app: 'readonly', // Generally the Vue.$root frontend app object
171
+
172
+ ...globals.browser,
152
173
  },
153
174
  parser: eslintParser,
154
175
  parserOptions: {
@@ -273,4 +294,5 @@ export default [
273
294
  },
274
295
  },
275
296
  // }}}
297
+
276
298
  ]
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.1",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "test": "eslint --config index.js test/data"
@@ -24,10 +24,11 @@
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
+ "globals": "^16.3.0",
31
+ "vue-eslint-parser": "^10.2.0"
31
32
  },
32
33
  "peerDependencies": {
33
34
  "eslint": "^9.26.0"