Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update linters #8621

Merged
merged 11 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 0 additions & 53 deletions .eslintrc.cjs

This file was deleted.

16 changes: 7 additions & 9 deletions cfgov/unprocessed/apps/cfpb-chart-builder/js/charts/GeoMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class GeoMap {

/**
* pointDescriptionFormatter - Formatter function for tooltips.
* @returns {type} HTML string for the tooltip.
* @returns {string} HTML string for the tooltip.
*/
this.chartOptions.tooltip.formatter = function () {
return tooltipFormatter(this.point, data[0].meta);
Expand All @@ -103,8 +103,8 @@ class GeoMap {
/**
* pointDescriptionFormatter - Formatter function to use instead of the
* default for point descriptions.
* @param {type} point - Highcharts point to describe
* @returns {type} String with the description of the point for a screen
* @param {object} point - Highcharts point to describe
* @returns {string} String with the description of the point for a screen
* reader user.
*/
this.chartOptions.pointDescriptionFormatter = function (point) {
Expand All @@ -116,8 +116,8 @@ class GeoMap {
/**
* screenReaderSectionFormatter - Formatter function to use instead of the
* default for series descriptions.
* @param {type} series - Highcharts series to describe
* @returns {type} String with the description of the series for a screen
* @param {object} series - Highcharts series to describe
* @returns {string} String with the description of the series for a screen
* reader user.
*/
this.chartOptions.seriesDescriptionFormatter = function (series) {
Expand All @@ -129,8 +129,8 @@ class GeoMap {
/**
* screenReaderSectionFormatter - A formatter function to create the HTML
* contents of the hidden screen reader information region.
* @param {type} chart - Highcharts chart object
* @returns {type} String with the HTML content of the region.
* @param {object} chart - Highcharts chart object
* @returns {string} String with the HTML content of the region.
*/
this.chartOptions.screenReaderSectionFormatter = function (chart) {
return screenReaderSectionFormatter(chart);
Expand All @@ -141,8 +141,6 @@ class GeoMap {
el.classList.add('cfpb-chart');
el.setAttribute('data-chart-type', 'geo-map');

// TODO: remove when gulp build config is updated to handle spread operator.
// eslint-disable-next-line prefer-object-spread
this.chart = Highcharts.mapChart(el, Object.assign({}, this.chartOptions));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefer-object-spread isn't set by default in @eslint.js.configs.recommended. However, we could enable it with prefer-object-spread: [error] in the rules and it'll auto-update this to the spread operator.

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Highcharts.setOptions({
/**
* _getYAxisLabel - Get the text of the y-axis title.
* @param {Array} chartData - An array of values to check.
* @param {sting} yAxisLabel - A string to use for the y-axis label.
* @param {string} yAxisLabel - A string to use for the y-axis label.
* @returns {string} Appropriate y-axis title.
*/
function _getYAxisLabel(chartData, yAxisLabel) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,6 @@ class LineChartComparison {
series: this.constructor.getSeries(data),
};

// TODO: remove when gulp build config is updated to handle spread operator.
// eslint-disable-next-line prefer-object-spread
this.chart = Highcharts.stockChart(
el,
Object.assign({}, this.chartOptions),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable */

// Visual line separators for Hawaii, Alaska, Puerto Rico
export default {
type: 'FeatureCollection',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,8 @@ function removeItem(key, storage) {

/**
* Internal function for whether to use local or session storage.
* @param {object} storage- -
* Use non-persistent storage (sessionStorage)
* @param {object} storage - Use non-persistent storage (sessionStorage)
* or persistent storage (localStorage).
* @param storage
* @returns {object} A local storage or session storage instance.
*/
function _getStorageType(storage) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable */

export default {
type: 'FeatureCollection',
crs: { type: 'name', properties: { name: 'urn:ogc:def:crs:EPSG:102004' } },
Expand Down
62 changes: 31 additions & 31 deletions cfgov/unprocessed/apps/filing-instruction-guide/js/fig-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,37 +19,6 @@
threshold: 0.4,
};

/**
* Initialize the ctrl-f search modal.
* @param {SecondaryNav} secondaryNavArg - A SecondaryNav instance.
*/
function init(secondaryNavArg) {
secondaryNav = secondaryNavArg;
// Each searchable item (an HTML section with a heading and some paragraphs)
// is tagged with a `data-search-section` attribute in the jinja2 template.
const sectionsList = [...document.querySelectorAll('[data-search-section]')];

const searchContainer = document.getElementById('ctrl-f');
const searchData = getSearchData(sectionsList);

search(searchContainer, {
buttonText,
searchOptions,
searchData,
onFollow,
onSubmit,
});

// Track clicks on the FIG search form button
addEventListenerToSelector('#ctrl-f', 'click', () => {
analyticsSendEvent({
event: 'Small Business Lending FIG event',
action: 'search:click',
label: '',
});
});
}

/**
* Generate a list of structured items to search
* @param {Array} sections - HTML elements containing FIG headings and
Expand Down Expand Up @@ -118,4 +87,35 @@
});
};

/**
* Initialize the ctrl-f search modal.
* @param {SecondaryNav} secondaryNavArg - A SecondaryNav instance.

Check warning on line 92 in cfgov/unprocessed/apps/filing-instruction-guide/js/fig-search.js

View workflow job for this annotation

GitHub Actions / frontend

The type 'SecondaryNav' is undefined
*/
function init(secondaryNavArg) {
secondaryNav = secondaryNavArg;
// Each searchable item (an HTML section with a heading and some paragraphs)
// is tagged with a `data-search-section` attribute in the jinja2 template.
const sectionsList = [...document.querySelectorAll('[data-search-section]')];

const searchContainer = document.getElementById('ctrl-f');
const searchData = getSearchData(sectionsList);

search(searchContainer, {
buttonText,
searchOptions,
searchData,
onFollow,
onSubmit,
});

// Track clicks on the FIG search form button
addEventListenerToSelector('#ctrl-f', 'click', () => {
analyticsSendEvent({
event: 'Small Business Lending FIG event',
action: 'search:click',
label: '',
});
});
}

export { init, getSearchData };
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,6 @@ function getStateValue(prop) {
* returning whether the financial-model should use netPrice or not
* @returns {boolean} true if the netPrice should be used
*/

/**
*
*/
function useNetPrice() {
return stateModel.useNetPrice();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
import { financialView } from '../views/financial-view.js';
import { getStateByCode } from '../util/other-utils.js';
import { getSchoolData } from '../dispatchers/get-api-values.js';
import { updateFinancialViewAndFinancialCharts } from '../dispatchers/update-view.js';
import {
updateFinancialViewAndFinancialCharts,
updateSchoolView,
} from '../dispatchers/update-view.js';
import { schoolModel } from '../models/school-model.js';
import { stateModel } from '../models/state-model.js';
import { convertStringToNumber } from '../../../../../js/modules/util/format.js';
Expand All @@ -17,7 +20,6 @@
getSchoolValue,
getStateValue,
} from '../dispatchers/get-model-values.js';
import { updateSchoolView } from './update-view.js';
import { urlParameters } from '../util/url-parameter-utils.js';
import { updateState } from '../dispatchers/update-state.js';

Expand Down Expand Up @@ -218,7 +220,7 @@
})
.catch(function (error) {
iped = iped.replace(/\D/g, '');
console.log(

Check warning on line 223 in cfgov/unprocessed/apps/paying-for-college/js/college-costs/dispatchers/update-models.js

View workflow job for this annotation

GitHub Actions / frontend

Unexpected console statement
'An error occurred when accessing school data for ' + iped,
error,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,9 @@ const stateModel = {
},

/**
* useNetPrice - Uses various state items to determine whether netPrice should be used
* by the financial-model in calculations
* useNetPrice - Uses various state items to determine whether netPrice should
* be used by the financial-model in calculations.
* @returns {boolean} True if using netPrice, false otherwise.
*/
useNetPrice: function () {
const earlyPages = [
Expand All @@ -343,7 +344,7 @@ const stateModel = {
vals.navDestination !== null ? vals.navDestination : vals.activeSection;
if (earlyPages.indexOf(section) > -1) {
return true;
// If the user already set the value to "yes" or we're on the customize estimate page, don't use netPrice
// If the user already set the value to "yes" or we're on the customize estimate page, don't use netPrice.
} else if (
vals.usingNetPrice === 'no' ||
section === 'customize-estimate'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// This file contains the 'view' of expenses budget after graduation
import { updateExpense, updateRegion } from '../dispatchers/update-models.js';
import { getExpensesValue } from '../dispatchers/get-model-values.js';
import { formatUSD } from '../../../../../js/modules/util/format.js';
import {
formatUSD,
convertStringToNumber,
} from '../../../../../js/modules/util/format.js';
import { selectorMatches } from '../util/other-utils.js';
import { convertStringToNumber } from '../../../../../js/modules/util/format.js';
import {
updateAffordingChart,
updateCostOfBorrowingChart,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
// This file contains the 'view' of all financial info, including costs, loans, etc

import { convertStringToNumber } from '../../../../../js/modules/util/format.js';
import {
convertStringToNumber,
formatUSD,
} from '../../../../../js/modules/util/format.js';
import { decimalToPercentString } from '../util/number-utils.js';
import { getFinancialValue } from '../dispatchers/get-model-values.js';
import { updateFinancial } from '../dispatchers/update-models.js';
import { formatUSD } from '../../../../../js/modules/util/format.js';
import { selectorMatches } from '../util/other-utils.js';
import { updateUrlQueryString } from '../dispatchers/update-view.js';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@
updateRepaymentMeterChart,
} from '../dispatchers/update-view.js';
import { decimalToPercentString } from '../util/number-utils.js';
import { formatUSD } from '../../../../../js/modules/util/format.js';
import {
formatUSD,
convertStringToNumber,
} from '../../../../../js/modules/util/format.js';
import { schoolSearch } from '../dispatchers/get-api-values.js';
import { updateState } from '../dispatchers/update-state.js';
import { convertStringToNumber } from '../../../../../js/modules/util/format.js';

const schoolView = {
_searchSection: null,
Expand Down Expand Up @@ -274,7 +276,7 @@
},
(error) => {
stopSearching();
console.log(error);

Check warning on line 279 in cfgov/unprocessed/apps/paying-for-college/js/college-costs/views/school-view.js

View workflow job for this annotation

GitHub Actions / frontend

Unexpected console statement
},
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import $, {window} from '../../../../js/modules/util/dollar-sign.js';
import $, { window } from '../../../../js/modules/util/dollar-sign.js';

/**
* This function determines if the element specified is currently in the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,9 @@ bindEvents('#print', 'click', window.print.bind(window));

// csv download
/**
*
* // TODO: Refactor to remove this. We're in a post-IE world.
* Detect whether IE is used or not.
* @returns {number|boolean} IE version number, or false if not IE.
*/
function detectIE() {
const ua = window.navigator.userAgent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ const _wrapMap = {
};

/**
*
* @param {HTMLElement|string} elements - An HTML element or a selector.
* @param {Function} applyFn - Function to apply to each element.
*/
Expand All @@ -54,7 +53,6 @@ function applyAll(elements, applyFn) {
}

/**
*
* @param {Array} elements - A list of HTML DOM nodes.
* @param {Array|string} events - A list or single event type.
* @param {Function} callback - A function to call at the end.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable-next-line no-undef */
const spy = jest.fn();

module.exports = spy;
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ Object.assign(AtomicComponent.prototype, new EventObserver(), {
*/
ensureElement: function () {
if (!this.element) {
// eslint-disable-line no-negated-condition
const attrs = Object.assign({}, this.attributes);
attrs.id = this.id || this.u_id;
if (this.className) attrs.class = this.className;
Expand Down Expand Up @@ -115,7 +114,7 @@ Object.assign(AtomicComponent.prototype, new EventObserver(), {
},

// TODO Fix complexity issue
/* eslint-disable complexity */

/**
* Function used to set the cached DOM elements.
* @returns {object} Hash of event names and cached elements.
Expand All @@ -141,7 +140,6 @@ Object.assign(AtomicComponent.prototype, new EventObserver(), {

return ui;
},
/* eslint-enable complexity */

/**
* Function used to remove the base element from the DOM
Expand Down Expand Up @@ -175,7 +173,7 @@ Object.assign(AtomicComponent.prototype, new EventObserver(), {
},

// TODO Fix complexity issue
/* eslint-disable complexity */

/**
* Function used to up event delegation on the base element.
* Using Dom-delegate library to enable this functionality.
Expand Down Expand Up @@ -211,7 +209,6 @@ Object.assign(AtomicComponent.prototype, new EventObserver(), {

return this;
},
/* eslint-enable complexity */

/**
* Function used to set the attributes on an element.
Expand Down
Loading
Loading