eslint-plugin-harlanzw 0.0.2 → 0.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.
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  [![npm downloads][npm-downloads-src]][npm-downloads-href]
5
5
  [![License][license-src]][license-href]
6
6
 
7
- Harlan's ESLint rules for Vue projects.
7
+ Harlan's ESLint rules for Vue projects with focus on link hygiene, Nuxt best practices, and Vue reactivity patterns.
8
8
 
9
9
  <p align="center">
10
10
  <table>
@@ -26,12 +26,31 @@ Try the rules in action with a Nuxt ESLint interactive playground:
26
26
 
27
27
  > **Note:** These rules are experimental and may change. They will be submitted to the official Vue ESLint plugin for consideration.
28
28
 
29
+ The rules are organized into the following categories:
30
+
31
+ - **Link Rules** - Ensure link URLs are clean, accessible, and SEO-friendly
32
+ - **Nuxt Rules** - Best practices for Nuxt applications
33
+ - **Vue Rules** - Vue composition API and reactivity best practices
34
+
29
35
  <!-- rules:start -->
30
- - [`vue-no-faux-composables`](./src/rules/vue-no-faux-composables.md) - stop fake composables that don't use Vue reactivity
31
- - [`vue-no-nested-reactivity`](./src/rules/vue-no-nested-reactivity.md) - don't mix `ref()` and `reactive()` together
32
- - [`vue-no-passing-refs-as-props`](./src/rules/vue-no-passing-refs-as-props.md) - don't pass refs as props - unwrap them first
33
- - [`vue-no-ref-access-in-templates`](./src/rules/vue-no-ref-access-in-templates.md) - don't use `.value` in Vue templates
34
- - [`vue-no-torefs-on-props`](./src/rules/vue-no-torefs-on-props.md) - don't use `toRefs()` on the props object
36
+ | Rule | Description |
37
+ | --- | --- |
38
+ | [`link-ascii-only`](./src/rules/link-ascii-only.md) | ensure link URLs contain only ASCII characters |
39
+ | [`link-lowercase`](./src/rules/link-lowercase.md) | ensure link URLs do not contain uppercase characters |
40
+ | [`link-no-double-slashes`](./src/rules/link-no-double-slashes.md) | ensure link URLs do not contain consecutive slashes |
41
+ | [`link-no-whitespace`](./src/rules/link-no-whitespace.md) | ensure link URLs do not contain whitespace characters |
42
+ | [`nuxt-await-navigate-to`](./src/rules/nuxt-await-navigate-to.md) | enforce awaiting `navigateTo()` calls |
43
+ | [`nuxt-no-redundant-import-meta`](./src/rules/nuxt-no-redundant-import-meta.md) | disallow redundant `import.meta.server` or `import.meta.client` checks in scoped components |
44
+ | [`nuxt-no-side-effects-in-async-data-handler`](./src/rules/nuxt-no-side-effects-in-async-data-handler.md) | disallow side effects in async data handlers |
45
+ | [`nuxt-no-side-effects-in-setup`](./src/rules/nuxt-no-side-effects-in-setup.md) | disallow side effects in setup functions |
46
+ | [`nuxt-prefer-navigate-to-over-router-push-replace`](./src/rules/nuxt-prefer-navigate-to-over-router-push-replace.md) | prefer `navigateTo()` over `router.push()` or `router.replace()` |
47
+ | [`nuxt-prefer-nuxt-link-over-router-link`](./src/rules/nuxt-prefer-nuxt-link-over-router-link.md) | prefer `NuxtLink` over `RouterLink` |
48
+ | [`vue-no-faux-composables`](./src/rules/vue-no-faux-composables.md) | stop fake composables that don't use Vue reactivity |
49
+ | [`vue-no-nested-reactivity`](./src/rules/vue-no-nested-reactivity.md) | don't mix `ref()` and `reactive()` together |
50
+ | [`vue-no-passing-refs-as-props`](./src/rules/vue-no-passing-refs-as-props.md) | don't pass refs as props - unwrap them first |
51
+ | [`vue-no-reactive-destructuring`](./src/rules/vue-no-reactive-destructuring.md) | avoid destructuring reactive objects |
52
+ | [`vue-no-ref-access-in-templates`](./src/rules/vue-no-ref-access-in-templates.md) | don't use `.value` in Vue templates |
53
+ | [`vue-no-torefs-on-props`](./src/rules/vue-no-torefs-on-props.md) | don't use `toRefs()` on the props object |
35
54
  <!-- rules:end -->
36
55
 
37
56
  ## Installation
@@ -60,9 +79,20 @@ export default antfu(
60
79
  harlanzw
61
80
  },
62
81
  rules: {
82
+ 'harlanzw/link-ascii-only': 'error',
83
+ 'harlanzw/link-lowercase': 'error',
84
+ 'harlanzw/link-no-double-slashes': 'error',
85
+ 'harlanzw/link-no-whitespace': 'error',
86
+ 'harlanzw/nuxt-await-navigate-to': 'error',
87
+ 'harlanzw/nuxt-no-redundant-import-meta': 'error',
88
+ 'harlanzw/nuxt-no-side-effects-in-async-data-handler': 'error',
89
+ 'harlanzw/nuxt-no-side-effects-in-setup': 'error',
90
+ 'harlanzw/nuxt-prefer-navigate-to-over-router-push-replace': 'error',
91
+ 'harlanzw/nuxt-prefer-nuxt-link-over-router-link': 'error',
63
92
  'harlanzw/vue-no-faux-composables': 'error',
64
93
  'harlanzw/vue-no-nested-reactivity': 'error',
65
94
  'harlanzw/vue-no-passing-refs-as-props': 'error',
95
+ 'harlanzw/vue-no-reactive-destructuring': 'error',
66
96
  'harlanzw/vue-no-ref-access-in-templates': 'error',
67
97
  'harlanzw/vue-no-torefs-on-props': 'error'
68
98
  }
@@ -82,9 +112,20 @@ export default withNuxt([{
82
112
  harlanzw
83
113
  },
84
114
  rules: {
115
+ 'harlanzw/link-ascii-only': 'error',
116
+ 'harlanzw/link-lowercase': 'error',
117
+ 'harlanzw/link-no-double-slashes': 'error',
118
+ 'harlanzw/link-no-whitespace': 'error',
119
+ 'harlanzw/nuxt-await-navigate-to': 'error',
120
+ 'harlanzw/nuxt-no-redundant-import-meta': 'error',
121
+ 'harlanzw/nuxt-no-side-effects-in-async-data-handler': 'error',
122
+ 'harlanzw/nuxt-no-side-effects-in-setup': 'error',
123
+ 'harlanzw/nuxt-prefer-navigate-to-over-router-push-replace': 'error',
124
+ 'harlanzw/nuxt-prefer-nuxt-link-over-router-link': 'error',
85
125
  'harlanzw/vue-no-faux-composables': 'error',
86
126
  'harlanzw/vue-no-nested-reactivity': 'error',
87
127
  'harlanzw/vue-no-passing-refs-as-props': 'error',
128
+ 'harlanzw/vue-no-reactive-destructuring': 'error',
88
129
  'harlanzw/vue-no-ref-access-in-templates': 'error',
89
130
  'harlanzw/vue-no-torefs-on-props': 'error'
90
131
  }
@@ -110,9 +151,20 @@ export default [
110
151
  harlanzw
111
152
  },
112
153
  rules: {
154
+ 'harlanzw/link-ascii-only': 'error',
155
+ 'harlanzw/link-lowercase': 'error',
156
+ 'harlanzw/link-no-double-slashes': 'error',
157
+ 'harlanzw/link-no-whitespace': 'error',
158
+ 'harlanzw/nuxt-await-navigate-to': 'error',
159
+ 'harlanzw/nuxt-no-redundant-import-meta': 'error',
160
+ 'harlanzw/nuxt-no-side-effects-in-async-data-handler': 'error',
161
+ 'harlanzw/nuxt-no-side-effects-in-setup': 'error',
162
+ 'harlanzw/nuxt-prefer-navigate-to-over-router-push-replace': 'error',
163
+ 'harlanzw/nuxt-prefer-nuxt-link-over-router-link': 'error',
113
164
  'harlanzw/vue-no-faux-composables': 'error',
114
165
  'harlanzw/vue-no-nested-reactivity': 'error',
115
166
  'harlanzw/vue-no-passing-refs-as-props': 'error',
167
+ 'harlanzw/vue-no-reactive-destructuring': 'error',
116
168
  'harlanzw/vue-no-ref-access-in-templates': 'error',
117
169
  'harlanzw/vue-no-torefs-on-props': 'error'
118
170
  }
package/dist/index.d.mts CHANGED
@@ -10,9 +10,20 @@ declare const plugin: {
10
10
  version: string;
11
11
  };
12
12
  rules: {
13
+ 'link-ascii-only': RuleModule<[]>;
14
+ 'link-lowercase': RuleModule<[]>;
15
+ 'link-no-double-slashes': RuleModule<[]>;
16
+ 'link-no-whitespace': RuleModule<[]>;
17
+ 'nuxt-await-navigate-to': RuleModule<[]>;
18
+ 'nuxt-no-redundant-import-meta': RuleModule<[]>;
19
+ 'nuxt-no-side-effects-in-async-data-handler': RuleModule<[]>;
20
+ 'nuxt-no-side-effects-in-setup': RuleModule<[]>;
21
+ 'nuxt-prefer-navigate-to-over-router-push-replace': RuleModule<[]>;
22
+ 'nuxt-prefer-nuxt-link-over-router-link': RuleModule<[]>;
13
23
  'vue-no-faux-composables': RuleModule<[]>;
14
24
  'vue-no-nested-reactivity': RuleModule<[]>;
15
25
  'vue-no-passing-refs-as-props': RuleModule<[]>;
26
+ 'vue-no-reactive-destructuring': RuleModule<[]>;
16
27
  'vue-no-ref-access-in-templates': RuleModule<[]>;
17
28
  'vue-no-torefs-on-props': RuleModule<[]>;
18
29
  };