@energysage/es-ds-components 3.0.2 → 3.0.3

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.
@@ -69,7 +69,7 @@ const props = defineProps({
69
69
 
70
70
  const getRootClasses = computed(() => {
71
71
  const withOutline = props.outline ? '-outline' : '';
72
- // eslint-disable-next-line no-nested-ternary
72
+
73
73
  const btnVariant =
74
74
  props.variant === 'link'
75
75
  ? 'btn-link'
@@ -30,7 +30,7 @@ interface IProps {
30
30
  breakpoints?: EsCarouselBreakpointsInterface;
31
31
  circular?: boolean;
32
32
  controlGap?: number;
33
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
33
+
34
34
  items: Array<any>;
35
35
  numScroll?: number;
36
36
  numVisible?: number;
@@ -5,6 +5,7 @@ import type { ComponentOptionsMixin } from 'vue';
5
5
  // magic solution for wrapping Column successfully
6
6
  // https://www.reddit.com/r/vuejs/comments/1g17u7u/comment/lvjv91h/
7
7
  defineOptions({
8
+ // eslint-disable-next-line vue/multi-word-component-names
8
9
  name: 'Column',
9
10
  extends: (Column as unknown as ComponentOptionsMixin).extends,
10
11
  inheritAttrs: false,
@@ -4,7 +4,6 @@ import { useFocus } from '@vueuse/core';
4
4
  const inputElem = useTemplateRef('input-elem');
5
5
  const { focused: inputFocused } = useFocus(inputElem);
6
6
 
7
- /* eslint-disable @typescript-eslint/no-explicit-any */
8
7
  interface IProps {
9
8
  id: string;
10
9
  name: string;
@@ -30,7 +29,6 @@ function handleRadioButtonClick() {
30
29
  }
31
30
  }
32
31
 
33
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
34
32
  const model = defineModel<any>();
35
33
  const isChecked = computed(() => props.value === model.value);
36
34
  </script>
@@ -2,7 +2,7 @@
2
2
  interface Option {
3
3
  id: string;
4
4
  text: string;
5
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
5
+
6
6
  value: any;
7
7
  disabled?: boolean;
8
8
  inline?: boolean;
@@ -14,7 +14,7 @@ interface Props {
14
14
  name?: string;
15
15
  options?: Option[];
16
16
  inline?: boolean;
17
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
+
18
18
  modelValue?: any;
19
19
  hasIcon?: boolean;
20
20
  labelClass?: string;
@@ -32,7 +32,6 @@ const props = withDefaults(defineProps<Props>(), {
32
32
 
33
33
  const emit = defineEmits(['update:model-value']);
34
34
 
35
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
36
35
  function handleUpdate(value: any) {
37
36
  emit('update:model-value', value);
38
37
  }
@@ -71,7 +71,6 @@ export default {
71
71
  // Show overlay on hovers for desktop only
72
72
  document
73
73
  .querySelectorAll(
74
- // eslint-disable-next-line max-len
75
74
  '.nav-es-container .nav-item .dropdown-toggle, .nav-es-container .nav-item .dropdown-menu, .nav-es-container .nav-item.has-dropdown',
76
75
  )
77
76
  .forEach((element) => {
@@ -113,14 +112,14 @@ export default {
113
112
  // logged out so allow loggedOut menu and the compare buttons to be visible
114
113
  document.querySelectorAll('.nav-es-container .loggedOut').forEach((element) => {
115
114
  // @ts-expect-error legacy code
116
- // eslint-disable-next-line no-param-reassign
115
+
117
116
  element.style.display = null;
118
117
  });
119
118
  } else {
120
119
  // logged in so allow logged in menu to be visible, and show name with appropriate layout
121
120
  document.querySelectorAll('.nav-es-container .loggedIn').forEach((element) => {
122
121
  // @ts-expect-error legacy code
123
- // eslint-disable-next-line no-param-reassign
122
+
124
123
  element.style.display = null;
125
124
  });
126
125
  // @ts-expect-error legacy code
@@ -128,7 +127,7 @@ export default {
128
127
  const selector = '.nav-es-container .icon-dropdown .dropdown-toggle .first-name';
129
128
  document.querySelectorAll(selector).forEach((element) => {
130
129
  // @ts-expect-error legacy code
131
- // eslint-disable-next-line no-param-reassign
130
+
132
131
  element.style.display = 'block';
133
132
  });
134
133
  }
@@ -143,13 +142,11 @@ export default {
143
142
  const name = data?.first_name || null;
144
143
  const selector = '.nav-es-container .icon-dropdown .dropdown-toggle .first-name';
145
144
  document.querySelectorAll(selector).forEach((element) => {
146
- // eslint-disable-next-line no-param-reassign
147
145
  element.innerHTML = name;
148
146
  });
149
147
  menuDisplay({ loggedOut: name === null });
150
148
  })
151
149
  .catch((e) => {
152
- // eslint-disable-next-line no-console
153
150
  console.log('error', e);
154
151
  menuDisplay({ loggedOut: true });
155
152
  });
@@ -38,7 +38,7 @@ onMounted(() => {
38
38
  const targetElement = document.getElementById(props.target);
39
39
  if (targetElement) {
40
40
  const triggers = props.triggers.split(' ').map((trigger) => (trigger === 'hover' ? 'mouseover' : trigger));
41
- // eslint-disable-next-line no-restricted-syntax
41
+
42
42
  for (const trigger of triggers) {
43
43
  targetElement.addEventListener(trigger, showPanel);
44
44
  }
@@ -2,7 +2,7 @@
2
2
  interface IOptions {
3
3
  id: string;
4
4
  text: string;
5
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
5
+
6
6
  value: any;
7
7
  disabled?: boolean;
8
8
  }
@@ -13,7 +13,7 @@ interface IProps {
13
13
  name?: string;
14
14
  options?: IOptions[];
15
15
  inline?: boolean;
16
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
+
17
17
  modelValue?: any;
18
18
  }
19
19
  const props = withDefaults(defineProps<IProps>(), {
@@ -1,5 +1,4 @@
1
1
  <script setup lang="ts">
2
- /* eslint-disable @typescript-eslint/no-explicit-any */
3
2
  interface IProps {
4
3
  name: string;
5
4
  value: any;
@@ -26,7 +25,7 @@ function handleRadioButtonClick() {
26
25
 
27
26
  // Similar to the API of https://bootstrap-vue.org/docs/components/form-radio#changing-the-option-field-names
28
27
  // the value can be a string, number, or simple object. Avoid using complex types in values.
29
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
28
+
30
29
  const model = defineModel<any>();
31
30
  const isChecked = computed(() => props.value === model.value);
32
31
  </script>
@@ -37,7 +37,7 @@ const initializeWidget = () => {
37
37
  // @ts-expect-error global-scoped ReviewsIO stuff
38
38
  if (typeof window !== 'undefined' && window.carouselInlineWidget) {
39
39
  // @ts-expect-error global-scoped ReviewsIO stuff
40
- // eslint-disable-next-line no-new, new-cap
40
+
41
41
  new window.carouselInlineWidget('reviewsio-carousel-widget', {
42
42
  /* Your REVIEWS.io account ID: */
43
43
  store: 'energy-sage',
@@ -28,7 +28,7 @@ const props = defineProps({
28
28
  */
29
29
  labelFormatter: {
30
30
  type: Function,
31
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
31
+
32
32
  default: (val: any) => val,
33
33
  },
34
34
  /**
@@ -66,7 +66,7 @@ const props = defineProps({
66
66
  */
67
67
  tooltipFormatter: {
68
68
  type: Function,
69
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
69
+
70
70
  default: (val: any) => val,
71
71
  },
72
72
  });
@@ -22,7 +22,7 @@ watch(model, (newVal) => {
22
22
 
23
23
  // Note: @update:model-value is erroneously requiring a boolean function argument,
24
24
  // workaround for error is to specify any
25
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
25
+
26
26
  const updateCode = (newValue: any) => {
27
27
  model.value = newValue.split('');
28
28
  };
@@ -1,11 +1,10 @@
1
1
  import { type ErrorObject, useVuelidate, type ValidationArgs } from '@vuelidate/core';
2
2
  import type { ToRefs, Ref } from 'vue';
3
3
 
4
- export function useEsForms<
5
- // eslint-disable-next-line no-unused-vars, no-use-before-define, @typescript-eslint/no-explicit-any
6
- T extends { [key in keyof Vargs]: any },
7
- Vargs extends ValidationArgs = ValidationArgs,
8
- >(validationsArgs: Ref<Vargs> | Vargs, state: T | Ref<T> | ToRefs<T>) {
4
+ export function useEsForms<T extends { [key in keyof Vargs]: any }, Vargs extends ValidationArgs = ValidationArgs>(
5
+ validationsArgs: Ref<Vargs> | Vargs,
6
+ state: T | Ref<T> | ToRefs<T>,
7
+ ) {
9
8
  const v$ = useVuelidate(validationsArgs, state);
10
9
 
11
10
  const submitInProgress = ref(false);
@@ -19,7 +18,7 @@ export function useEsForms<
19
18
  let objKeys = null;
20
19
  try {
21
20
  objKeys = Object.keys(obj);
22
- // eslint-disable-next-line no-console
21
+
23
22
  console.log('objKeys: ', objKeys);
24
23
  } catch {
25
24
  return [];
@@ -29,10 +28,9 @@ export function useEsForms<
29
28
 
30
29
  const formErrors = computed(() => {
31
30
  const errors = v$.value.$errors.map((error) => error);
32
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
31
+
33
32
  return errors.reduce((acc: any, error: ErrorObject) => {
34
33
  if (!(error.$property in acc)) {
35
- // eslint-disable-next-line no-param-reassign
36
34
  acc[error.$property] = [];
37
35
  }
38
36
  acc[error.$property].push(error.$validator);
@@ -42,7 +40,6 @@ export function useEsForms<
42
40
 
43
41
  const getValidatorField = (dotPath: string) => {
44
42
  const validatorField = dotPath.split('.').reduce((acc, field) => {
45
- // eslint-disable-next-line no-param-reassign
46
43
  acc = acc[field];
47
44
  return acc;
48
45
  }, v$.value);
@@ -0,0 +1,37 @@
1
+ import withNuxt from '../es-ds-docs/.nuxt/eslint.config.mjs';
2
+
3
+ export default withNuxt()
4
+ .override('nuxt/vue/rules', {
5
+ rules: {
6
+ 'vue/component-name-in-template-casing': [
7
+ 'error',
8
+ 'kebab-case',
9
+ {
10
+ registeredComponentsOnly: false,
11
+ ignores: [],
12
+ },
13
+ ],
14
+ 'vue/block-order': [
15
+ 'error',
16
+ {
17
+ order: [['script[setup]', 'script:not([setup])'], 'template', 'style'],
18
+ },
19
+ ],
20
+ 'vue/block-lang': [
21
+ 'error',
22
+ {
23
+ script: {
24
+ lang: 'ts',
25
+ },
26
+ },
27
+ ],
28
+ 'vue/html-self-closing': 'off',
29
+ },
30
+ })
31
+ .override('nuxt/typescript/rules', {
32
+ rules: {
33
+ '@typescript-eslint/no-explicit-any': 'off',
34
+ '@typescript-eslint/no-unsafe-function-type': 'off',
35
+ '@typescript-eslint/ban-ts-comment': 'off',
36
+ },
37
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@energysage/es-ds-components",
3
- "version": "3.0.2",
3
+ "version": "3.0.3",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "An EnergySage Vue component library",
@@ -17,33 +17,26 @@
17
17
  "author": "EnergySage",
18
18
  "license": "MIT",
19
19
  "dependencies": {
20
- "@energysage/es-ds-styles": "^3.0.0",
20
+ "@energysage/es-ds-styles": "^3.0.3",
21
+ "@nuxt/eslint": "^1.0.1",
21
22
  "@nuxtjs/google-fonts": "^3.2.0",
22
23
  "@vuelidate/core": "^2.0.3",
23
24
  "@vuelidate/validators": "^2.0.4",
24
25
  "@vueuse/core": "^11.1.0",
25
26
  "html-truncate": "^1.2.2",
26
- "nuxt": "^3.13.2",
27
+ "nuxt": "^3.15.4",
27
28
  "nuxt-primevue": "^3.0.0",
28
29
  "primevue": "^3.53.0",
29
30
  "prismjs": "^1.29.0",
30
31
  "vue": "^3.5.6"
31
32
  },
32
33
  "devDependencies": {
33
- "@eslint/js": "^9.9.0",
34
- "@types/eslint__js": "^8.42.3",
35
- "eslint": "^8.57.0",
36
- "eslint-config-airbnb-base": "^15.0.0",
37
- "eslint-config-prettier": "^9.1.0",
38
- "eslint-import-resolver-typescript": "^3.6.1",
39
- "eslint-plugin-import": "^2.29.1",
40
- "eslint-plugin-vitest": "^0.5.4",
41
- "eslint-plugin-vue": "^9.27.0",
34
+ "eslint": "^9.20.1",
35
+ "eslint-config-prettier": "^10.0.1",
42
36
  "nuxt-primevue": "^3.0.0",
43
37
  "prettier": "^3.3.3",
44
38
  "sass": "^1.77.8",
45
39
  "typescript": "^5.5.4",
46
- "typescript-eslint": "^8.2.0",
47
40
  "vue-tsc": "^2.0.29"
48
41
  }
49
42
  }
package/utils/forms.ts CHANGED
@@ -25,7 +25,7 @@ export const vuelidateHelpers = helpers;
25
25
  * @returns a function that takes a number, and returns another function which takes a string param
26
26
  * that will ultimately be what you're comparing the pattern against N times.
27
27
  */
28
- // eslint-disable-next-line max-len
28
+
29
29
  const matchesPatternNTimes =
30
30
  (pattern: RegExp) =>
31
31
  (N = 1) =>
@@ -88,7 +88,7 @@ export function vuelidatePhone(number: string) {
88
88
  /**
89
89
  * @returns if not required or string contains a number
90
90
  */
91
- // eslint-disable-next-line max-len
91
+
92
92
  export const vuelidateHasNumber = (X: number) =>
93
93
  helpers.withParams({ type: 'xTimes', value: X }, (value: string) => !helpers.req(value) || hasNumber(X)(value));
94
94
 
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable @typescript-eslint/no-unused-vars */
2
- /* eslint-disable no-unused-vars */
2
+
3
3
  // keeping COMMUNITY_SOLAR_DOMAIN, HEAT_PUMPS_DOMAIN and NEWS_DOMAIN for now to keep function argument order intact
4
4
  // and to minimize breaking change to consuming applications, but they are now deprecated in this function
5
5
  export default (
@@ -1,4 +1,3 @@
1
- /* eslint-disable no-unused-vars */
2
1
  /* eslint-disable @typescript-eslint/no-unused-vars */
3
2
  const NAV_BAR_ICONS = {
4
3
  CALCULATOR: 'calculator',
@@ -64,7 +63,7 @@ export default (
64
63
  },
65
64
  {
66
65
  name: 'Home batteries vs. generators',
67
- // eslint-disable-next-line max-len
66
+
68
67
  link: `${ES_DOMAIN}/energy-storage/battery-backup-power-vs-generators-which-is-right-for-you/`,
69
68
  },
70
69
  ],
@@ -78,7 +77,7 @@ export default (
78
77
  },
79
78
  {
80
79
  name: 'How much do heat pumps cost?',
81
- // eslint-disable-next-line max-len
80
+
82
81
  link: `${ES_DOMAIN}/heat-pumps/costs-and-benefits-air-source-heat-pumps/`,
83
82
  },
84
83
  {
@@ -172,7 +171,7 @@ export default (
172
171
  subtopics: [
173
172
  {
174
173
  name: 'How long can you run your house on a Tesla Powerwall?',
175
- // eslint-disable-next-line max-len
174
+
176
175
  link: `${ES_DOMAIN}/energy-storage/tesla-powerwall-how-much-home-can-you-run-on-it-for-how-long/`,
177
176
  },
178
177
  {
@@ -301,7 +300,7 @@ export default (
301
300
  },
302
301
  {
303
302
  name: 'Search local installers',
304
- // eslint-disable-next-line max-len
303
+
305
304
  link: `${ES_DOMAIN}/supplier/search?selected_facets=services:installers&selected_facets=technology_types:Solar%20PV`,
306
305
  },
307
306
  {
package/.eslintignore DELETED
@@ -1,9 +0,0 @@
1
- # don't ever lint node_modules
2
- node_modules
3
- # don't lint build output (make sure it's set to your correct build folder name)
4
- dist
5
- .nuxt
6
- .output
7
- # don't lint coverage output
8
- coverage
9
- *.json
package/.eslintrc.json DELETED
@@ -1,3 +0,0 @@
1
- {
2
- "extends": ["../es-ds-docs/.eslintrc.json"]
3
- }