@momsfriendlydevco/eslint-config 2.0.5 → 2.1.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 +48 -1
  2. package/package.json +4 -3
package/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import eslintParser from 'vue-eslint-parser';
2
2
  import pluginJSDoc from 'eslint-plugin-jsdoc';
3
+ import pluginUnicorn from 'eslint-plugin-unicorn';
3
4
  import pluginVue from 'eslint-plugin-vue';
4
5
 
5
6
  // Rules shared by both .doop + .vue files
@@ -40,6 +41,38 @@ export default [
40
41
  },
41
42
  },
42
43
 
44
+ // eslint-plugin-unicorn
45
+ {
46
+ ...pluginUnicorn.configs['flat/recommended'],
47
+ rules: {
48
+ ...pluginUnicorn.configs['flat/recommended'].rules,
49
+ 'unicorn/no-anonymous-default-export': ['off'],
50
+ 'unicorn/prefer-string-replace-all': ['off'], // Gets annoying pretty fast and its rarely correct
51
+ 'unicorn/prefer-dom-node-append': ['warn'],
52
+ 'unicorn/prefer-global-this': ['warn'], // Disabled in .vue files to allow 'window' directly
53
+ 'unicorn/prefer-ternary': ['warn'],
54
+ 'unicorn/no-magic-array-flat-depth': ['warn'],
55
+ 'unicorn/switch-case-braces': ['warn', 'avoid'],
56
+ 'unicorn/consistent-function-scoping': ['off'], // This rule means well and its more optimal but makes functions with constants harder to read
57
+ 'unicorn/prefer-ternary': ['off'], // This rule means well but it can screw up perfectly readable code
58
+ 'unicorn/catch-error-name': ['off'],
59
+ 'unicorn/explicit-length-check': ['off'],
60
+ 'unicorn/filename-case': ['off'], // Disabled globally (gets re-enabled for .vue files)
61
+ 'unicorn/no-array-callback-reference': ['off'], // Overly aggressively attaches itself to all .find() operations
62
+ 'unicorn/no-await-expression-member': ['off'], // There is nothing wrong with `(await thing).prop`
63
+ 'unicorn/no-empty-file': ['off'], // Breaks interface files + schema files with just JSDoc
64
+ 'unicorn/prefer-logical-operator-over-ternary': ['off'],
65
+ 'unicorn/prefer-string-raw': ['off'], // Just a downright weird rule
66
+ 'unicorn/prefer-spread': ['off'],
67
+ 'unicorn/no-array-reduce': ['off'],
68
+ 'unicorn/no-nested-ternary': ['off'],
69
+ 'unicorn/no-negated-condition': ['off'],
70
+ 'unicorn/no-array-for-each': ['off'],
71
+ 'unicorn/no-null': ['off'],
72
+ 'unicorn/prevent-abbreviations': ['off'],
73
+ },
74
+ },
75
+
43
76
  // eslint-plugin-vue
44
77
  ...pluginVue.configs['flat/recommended'],
45
78
 
@@ -118,7 +151,12 @@ export default [
118
151
  'vue/html-closing-bracket-spacing': ['warn', {
119
152
  selfClosingTag: 'never'
120
153
  }],
121
- 'vue/html-indent': ['warn', 'tab'],
154
+ 'vue/html-indent': ['warn', 'tab', {
155
+ ignores: [ // Don't enforce indent rules for attributes that get complicated
156
+ '[class]',
157
+ '[v-tooltip]',
158
+ ],
159
+ }],
122
160
  'vue/html-self-closing': ['warn', {
123
161
  html: {
124
162
  void: 'always',
@@ -175,6 +213,15 @@ export default [
175
213
  ignoreWhenNoAttributes: true,
176
214
  ignores: ['pre', 'textarea', 'div', 'INLINE_ELEMENTS'],
177
215
  }],
216
+
217
+ 'unicorn/prefer-global-this': ['off'], // Allow direct use of `window.`
218
+ 'unicorn/filename-case': ['warn', {
219
+ case: 'kebabCase',
220
+ ignore: [
221
+ '^App.vue$', // Vite projects
222
+ ],
223
+ }],
224
+
178
225
  ...jsCommonRules,
179
226
  },
180
227
  },
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.0.5",
4
+ "version": "2.1.1",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "test": "eslint --config index.js test/data"
@@ -24,8 +24,9 @@
24
24
  },
25
25
  "homepage": "https://github.com/MomsFriendlyDevCo/eslint#readme",
26
26
  "dependencies": {
27
- "eslint-plugin-jsdoc": "^48.8.3",
28
- "eslint-plugin-vue": "^9.27.0",
27
+ "eslint-plugin-jsdoc": "^50.6.2",
28
+ "eslint-plugin-unicorn": "^56.0.1",
29
+ "eslint-plugin-vue": "^9.32.0",
29
30
  "vue-eslint-parser": "^9.4.3"
30
31
  },
31
32
  "peerDependencies": {