@momsfriendlydevco/eslint-config 2.0.5 → 2.1.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 +46 -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,36 @@ 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-empty-file': ['off'], // Breaks interface files + schema files with just JSDoc
62
+ 'unicorn/prefer-logical-operator-over-ternary': ['off'],
63
+ 'unicorn/prefer-string-raw': ['off'], // Just a downright weird rule
64
+ 'unicorn/prefer-spread': ['off'],
65
+ 'unicorn/no-array-reduce': ['off'],
66
+ 'unicorn/no-nested-ternary': ['off'],
67
+ 'unicorn/no-negated-condition': ['off'],
68
+ 'unicorn/no-array-for-each': ['off'],
69
+ 'unicorn/no-null': ['off'],
70
+ 'unicorn/prevent-abbreviations': ['off'],
71
+ },
72
+ },
73
+
43
74
  // eslint-plugin-vue
44
75
  ...pluginVue.configs['flat/recommended'],
45
76
 
@@ -118,7 +149,12 @@ export default [
118
149
  'vue/html-closing-bracket-spacing': ['warn', {
119
150
  selfClosingTag: 'never'
120
151
  }],
121
- 'vue/html-indent': ['warn', 'tab'],
152
+ 'vue/html-indent': ['warn', 'tab', {
153
+ ignores: [ // Don't enforce indent rules for attributes that get complicated
154
+ '[class]',
155
+ '[v-tooltip]',
156
+ ],
157
+ }],
122
158
  'vue/html-self-closing': ['warn', {
123
159
  html: {
124
160
  void: 'always',
@@ -175,6 +211,15 @@ export default [
175
211
  ignoreWhenNoAttributes: true,
176
212
  ignores: ['pre', 'textarea', 'div', 'INLINE_ELEMENTS'],
177
213
  }],
214
+
215
+ 'unicorn/prefer-global-this': ['off'], // Allow direct use of `window.`
216
+ 'unicorn/filename-case': ['warn', {
217
+ case: 'kebabCase',
218
+ ignore: [
219
+ '^App.vue$', // Vite projects
220
+ ],
221
+ }],
222
+
178
223
  ...jsCommonRules,
179
224
  },
180
225
  },
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.0",
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": {