Skip to content

Commit

Permalink
Suppress all eslint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
maxatdetroit committed Sep 12, 2023
1 parent 07d24e4 commit 0254713
Show file tree
Hide file tree
Showing 65 changed files with 774 additions and 2 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
},
"homepage": "https://jedgar1mx.github.io/COD-Design-System",
"scripts": {
"check-lint-config": "npx eslint-config-prettier src/index.js",
"lint": "eslint src && prettier --check src/*",
"build": "webpack --mode production",
"build-package": "cross-env BABEL_ENV=production babel src -d dist",
"start": "webpack-dev-server --mode development",
Expand Down
4 changes: 4 additions & 0 deletions src/components/atoms/AccordionBody/AccordionBody.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ export default class AccordionBody extends HTMLElement {
const shadow = this.attachShadow({ mode: 'open' });
shadow.appendChild(template.content.cloneNode(true));
this.accordionBody = document.createElement('div');
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line no-unused-vars
this.shadowRoot.addEventListener('slotchange', (ev) => {
let tempElements = Array.from(this.children);
tempElements.forEach((node) => {
Expand All @@ -39,6 +41,8 @@ export default class AccordionBody extends HTMLElement {
// Nav attributes
let extraClasses = this.getAttribute('data-extra-classes');
let accordionBodyClasses = ['accordion-body'];
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line eqeqeq
extraClasses != undefined && extraClasses != null
? accordionBodyClasses.push(extraClasses)
: 0;
Expand Down
10 changes: 10 additions & 0 deletions src/components/atoms/AccordionHeader/AccordionHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export default class AccordionHeader extends HTMLElement {
this.accordionHeader = document.createElement('div');
this.accordionBtn = document.createElement('button');
this.accordionHeader.appendChild(this.accordionBtn);
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line no-unused-vars
this.shadowRoot.addEventListener('slotchange', (ev) => {
let tempElements = Array.from(this.children);
tempElements.forEach((node) => {
Expand All @@ -45,7 +47,11 @@ export default class AccordionHeader extends HTMLElement {
this.accordionBtn.setAttribute('aria-expanded', newValue);
let tempClasses = this.accordionBtn.className.split(' ');
let popValue = tempClasses.pop();
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line eqeqeq
popValue != 'collapsed' ? tempClasses.push(popValue) : 0;
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line eqeqeq
if (newValue == 'false') {
tempClasses.push('collapsed');
}
Expand All @@ -62,12 +68,16 @@ export default class AccordionHeader extends HTMLElement {
this.accordionBtn.setAttribute('data-bs-toggle', 'collapse');
this.accordionBtn.setAttribute('aria-controls', parentID);
this.accordionBtn.setAttribute('data-bs-target', `#${parentID}`);
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line eqeqeq
if (expanded == 'true') {
this.accordionBtn.setAttribute('aria-expanded', 'true');
} else {
accordionBtnClasses.push('collapsed');
this.accordionBtn.setAttribute('aria-expanded', 'false');
}
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line eqeqeq
extraClasses != undefined && extraClasses != null
? accordionBtnClasses.push(extraClasses)
: 0;
Expand Down
20 changes: 20 additions & 0 deletions src/components/atoms/AccordionItem/AccordionItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ export default class AccordionItem extends HTMLElement {
shadow.appendChild(template.content.cloneNode(true));
this.accordionHeader = document.createElement('div');
this.accordionBody = document.createElement('div');
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line no-unused-vars
this.shadowRoot.addEventListener('slotchange', (ev) => {
let tempElements = Array.from(this.children);
tempElements.forEach((node) => {
Expand All @@ -30,9 +32,13 @@ export default class AccordionItem extends HTMLElement {
'data-index',
)}`,
);
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line eqeqeq
this.getAttribute('data-expanded') == 'true'
? node.setAttribute('data-expanded', true)
: 0;
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line eqeqeq
if (node.tagName == 'COD-ACCORDION-HEADER') {
this.accordionHeader.append(node);
} else {
Expand Down Expand Up @@ -62,7 +68,11 @@ export default class AccordionItem extends HTMLElement {
.setAttribute('data-expanded', newValue);
let tempClasses = this.accordionBody.className.split(' ');
let popValue = tempClasses.pop();
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line eqeqeq
popValue != 'show' ? tempClasses.push(popValue) : 0;
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line eqeqeq
if (newValue == 'true') {
tempClasses.push('show');
}
Expand All @@ -74,15 +84,23 @@ export default class AccordionItem extends HTMLElement {
let parentID = this.getAttribute('data-parent-id');
let index = this.getAttribute('data-index');
let expanded = this.getAttribute('data-expanded');
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line no-unused-vars
let alwaysOpen = this.getAttribute('data-always-open');
let headerExtraClasses = this.getAttribute('data-header-extra-classes');
let bodyExtraClasses = this.getAttribute('data-body-extra-classes');
let accordionHeaderClasses = ['accordion-header'];
let accordionBodyClasses = ['accordion-collapse collapse'];
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line eqeqeq
expanded == 'true' ? accordionBodyClasses.push('show') : 0;
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line eqeqeq
headerExtraClasses != undefined && headerExtraClasses != null
? accordionHeaderClasses.push(headerExtraClasses)
: 0;
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line eqeqeq
bodyExtraClasses != undefined && bodyExtraClasses != null
? accordionBodyClasses.push(bodyExtraClasses)
: 0;
Expand All @@ -106,6 +124,8 @@ export default class AccordionItem extends HTMLElement {
}

_onClick(e) {
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line eqeqeq
if (e.target.getAttribute('data-expanded') == 'true') {
this.getRootNode().host.setAttribute('data-expanded', 'false');
} else {
Expand Down
4 changes: 4 additions & 0 deletions src/components/atoms/Alert/Alert.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export default class Alert extends HTMLElement {
const alertContent = document.createElement('div');
alertContent.id = 'alert-content';
this.alert.appendChild(alertContent);
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line no-unused-vars
shadow.addEventListener('slotchange', (ev) => {
let tempElements = Array.from(this.children);
tempElements.forEach((node) => {
Expand Down Expand Up @@ -52,6 +54,8 @@ export default class Alert extends HTMLElement {
let extraClasses = this.getAttribute('data-extra-classes');
this.alert.role = 'alert';
let iconClass = '';
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line eqeqeq
if (icon != undefined && icon != null) {
this.alert.querySelector('#alert-content').className = 'col';
let activeIcon = document.createElement('cod-icon');
Expand Down
8 changes: 8 additions & 0 deletions src/components/atoms/Badge/Badge.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ export default class Badge extends HTMLElement {
// Always call super first in constructor
super();
// Create a shadow root
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line no-unused-vars
const shadow = this.attachShadow({ mode: 'open' });
}

Expand All @@ -28,14 +30,20 @@ export default class Badge extends HTMLElement {
let url = this.getAttribute('data-url');
let extraClasses = this.getAttribute('data-extra-classes');
let badge = null;
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line eqeqeq
pill == 'true' ? (pill = 'rounded-pill') : (pill = '');
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line eqeqeq
if (url != undefined || url != null) {
badge = document.createElement('a');
badge.href = url;
} else {
badge = document.createElement(tag);
}
badge.innerText = text;
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line eqeqeq
if (hiddenText != undefined || hiddenText != null) {
const hiddenBadge = document.createElement('span');
hiddenBadge.className = 'visually-hidden';
Expand Down
6 changes: 6 additions & 0 deletions src/components/atoms/Breadcrumb/Breadcrumb.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ export default class Container extends HTMLElement {
shadow.appendChild(template.content.cloneNode(true));
this.nav = shadow.querySelector('nav');
this.breadcrumb = shadow.querySelector('ol');
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line no-unused-vars
shadow.addEventListener('slotchange', (ev) => {
let tempElements = Array.from(this.children);
tempElements.forEach((node) => {
Expand Down Expand Up @@ -48,9 +50,13 @@ export default class Container extends HTMLElement {
// Breadcrumb attributes
let noDivider = this.getAttribute('data-no-divider');
let svg = this.getAttribute('data-svg-divider');
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line eqeqeq
if (noDivider == 'true') {
this.nav.style.cssText = "--bs-breadcrumb-divider: '';";
}
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line eqeqeq
if (svg != undefined || svg != null) {
this.nav.style.cssText = `--bs-breadcrumb-divider: url(${svg});`;
}
Expand Down
32 changes: 32 additions & 0 deletions src/components/atoms/Button/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export default class Button extends HTMLElement {
// Always call super first in constructor
super();
// Create a shadow root
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line no-unused-vars
const shadow = this.attachShadow({ mode: 'open' });
}

Expand All @@ -25,6 +27,8 @@ export default class Button extends HTMLElement {
let hiddenLabel = this.getAttribute('data-hidden-label');
let imgSrc = this.getAttribute('data-img');
let imgAlt = this.getAttribute('data-img-alt');
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line no-unused-vars, eqeqeq
let img = imgAlt != '' ? 'img' : 'not-img';
let size = this.getAttribute('data-size');
let extraClasses = this.getAttribute('data-extra-classes');
Expand All @@ -34,29 +38,49 @@ export default class Button extends HTMLElement {
const btn = document.createElement('button');
let btnClasses = ['btn'];
btn.type = 'button';
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line eqeqeq
if (btnID != null && btnID != undefined) {
btn.id = btnID;
}
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line eqeqeq
disableStatus == 'true' ? (btn.disabled = true) : (btn.disabled = false);
btn.setAttribute('aria-label', `${ariaLabel || ''}`);
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line eqeqeq
if (primary == 'true') {
btnClasses.push(`btn-${backgroundColor}`);
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line eqeqeq
} else if (primary == 'false') {
btnClasses.push(`btn-outline-${backgroundColor}`);
}
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line eqeqeq
shape == 'square'
? btnClasses.push('cod-button--square')
: btnClasses.push('cod-button-fluid');
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line eqeqeq
size != undefined && size != null ? btnClasses.push(`btn-${size}`) : 0;
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line eqeqeq
extraClasses != undefined && extraClasses != null
? btnClasses.push(extraClasses)
: 0;
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line eqeqeq
imgAlt != ''
? btnClasses.push('cod-button--img')
: btnClasses.push('cod-button--not-img');
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line eqeqeq
close == 'true' ? btnClasses.push('btn-close') : 0;
btn.className = btnClasses.join(' ');

// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line eqeqeq
if (icon != '') {
// Loading icon
let iconContainer = document.createElement('span');
Expand All @@ -65,11 +89,15 @@ export default class Button extends HTMLElement {
activeIcon.setAttribute('data-size', iconSize);
iconContainer.appendChild(activeIcon);
btn.innerText = label;
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line eqeqeq
if (iconOrder == 'left') {
btn.insertBefore(iconContainer, btn.firstChild);
} else {
btn.appendChild(iconContainer);
}
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line eqeqeq
} else if (imgAlt != '') {
// Loading image
btn.innerText = label;
Expand All @@ -81,6 +109,8 @@ export default class Button extends HTMLElement {
btn.innerText = label;
}
// Create hidden label
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line eqeqeq
if (hiddenLabel != undefined && hiddenLabel != null) {
let hLabel = document.createElement('span');
hLabel.className = 'visually-hidden';
Expand All @@ -98,6 +128,8 @@ export default class Button extends HTMLElement {
const btnStyles = document.createElement('style');
btnStyles.textContent = styles;
this.shadowRoot.appendChild(btnStyles);
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line eqeqeq
if (link == undefined || link == null) {
this.shadowRoot.appendChild(btn);
let ghostBtn = this.appendChild(document.createElement('button'));
Expand Down
2 changes: 2 additions & 0 deletions src/components/atoms/CardBody/CardBody.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ export default class CardBody extends HTMLElement {
const shadow = this.attachShadow({ mode: 'open' });
shadow.appendChild(template.content.cloneNode(true));
this.cardBody = document.createElement('div');
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line no-unused-vars
shadow.addEventListener('slotchange', (ev) => {
let tempElements = Array.from(this.children);
tempElements.forEach((node) => {
Expand Down
2 changes: 2 additions & 0 deletions src/components/atoms/CardFooter/CardFooter.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ export default class CardFooter extends HTMLElement {
const shadow = this.attachShadow({ mode: 'open' });
shadow.appendChild(template.content.cloneNode(true));
this.cardFooter = document.createElement('div');
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line no-unused-vars
shadow.addEventListener('slotchange', (ev) => {
let tempElements = Array.from(this.children);
tempElements.forEach((node) => {
Expand Down
2 changes: 2 additions & 0 deletions src/components/atoms/CardHeader/CardHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ export default class CardHeader extends HTMLElement {
const shadow = this.attachShadow({ mode: 'open' });
shadow.appendChild(template.content.cloneNode(true));
this.cardHeader = document.createElement('div');
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line no-unused-vars
shadow.addEventListener('slotchange', (ev) => {
let tempElements = Array.from(this.children);
tempElements.forEach((node) => {
Expand Down
2 changes: 2 additions & 0 deletions src/components/atoms/CardOverlay/CardOverlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ export default class CardOverlay extends HTMLElement {
const shadow = this.attachShadow({ mode: 'open' });
shadow.appendChild(template.content.cloneNode(true));
this.cardOverlay = document.createElement('div');
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line no-unused-vars
shadow.addEventListener('slotchange', (ev) => {
let tempElements = Array.from(this.children);
tempElements.forEach((node) => {
Expand Down
4 changes: 4 additions & 0 deletions src/components/atoms/CarouselCaption/CarouselCaption.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ export default class CarouselCaption extends HTMLElement {
const shadow = this.attachShadow({ mode: 'open' });
shadow.appendChild(template.content.cloneNode(true));
this.carouselCaption = document.createElement('div');
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line no-unused-vars
shadow.addEventListener('slotchange', (ev) => {
let tempElements = Array.from(this.children);
tempElements.forEach((node) => {
Expand All @@ -39,6 +41,8 @@ export default class CarouselCaption extends HTMLElement {
// Modal attributes
let extraClasses = this.getAttribute('data-extra-classes');
let carouselCaptionClasses = ['carousel-caption d-none d-md-block'];
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line eqeqeq
extraClasses != undefined && extraClasses != null
? carouselCaptionClasses.push(extraClasses)
: 0;
Expand Down
2 changes: 2 additions & 0 deletions src/components/atoms/CarouselItem/CarouselItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ export default class CarouselItem extends HTMLElement {
const shadow = this.attachShadow({ mode: 'open' });
shadow.appendChild(template.content.cloneNode(true));
this.carouselItem = document.createElement('div');
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line no-unused-vars
shadow.addEventListener('slotchange', (ev) => {
let tempElements = Array.from(this.children);
tempElements.forEach((node) => {
Expand Down
2 changes: 2 additions & 0 deletions src/components/atoms/Container/Container.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ export default class Container extends HTMLElement {
const shadow = this.attachShadow({ mode: 'open' });
shadow.appendChild(template.content.cloneNode(true));
this.container = document.createElement('div');
// See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line no-unused-vars
shadow.addEventListener('slotchange', (ev) => {
let tempElements = Array.from(this.children);
tempElements.forEach((node) => {
Expand Down
Loading

0 comments on commit 0254713

Please sign in to comment.