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

Bump eslint from 8.57.0 to 9.0.0 #681

Merged
merged 11 commits into from
May 7, 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
22 changes: 0 additions & 22 deletions .eslintrc.yml

This file was deleted.

40 changes: 12 additions & 28 deletions assets/js/touchpoints.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Form components are namespaced under 'fba' = 'Feedback Analytics'
"use strict";

function FBAform(d, N) {
function FBAform(d) {
Copy link
Contributor

Choose a reason for hiding this comment

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

went ahead and added the touchpoints form into the linting setup / fixed the errors there.

return {
formId: "2a6e9509",
formComponent: function () {
Expand Down Expand Up @@ -81,8 +81,8 @@ function FBAform(d, N) {
);
}
var phoneElements = d.querySelectorAll("input[type='tel']");
for (var i = 0; i < phoneElements.length; i++) {
phoneElements[i].addEventListener(
for (var j = 0; j < phoneElements.length; j++) {
phoneElements[j].addEventListener(
"keyup",
this.handlePhoneInput.bind(this),
false,
Expand Down Expand Up @@ -169,21 +169,6 @@ function FBAform(d, N) {
}
e.srcElement.value = number;
},
handleEmailInput: function (e) {
var EmailRegex =
/^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
var email = e.srcElement.value.trim();
if (email.length == 0) {
return;
}
result = EmailRegex.test(email);
if (!result) {
showWarning($(this), "Please enter a valid email address");
} else {
showValid($(this));
}
e.srcElement.value = number;
},
handleSubmitClick: function (e) {
e.preventDefault();
this.resetErrors();
Expand Down Expand Up @@ -292,7 +277,7 @@ function FBAform(d, N) {
delete questions[item.name];
} else {
var EmailRegex =
/^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
/^([a-zA-Z0-9_.+-])+@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (EmailRegex.test(item.value)) delete questions[item.name];
}
});
Expand Down Expand Up @@ -368,10 +353,10 @@ function FBAform(d, N) {
var elem = form.querySelector(".usa-form-group--error");
if (elem == null) return;
elem.setAttribute("class", "question");
var elem = form.querySelector("#input-error-message");
if (elem != null) elem.parentNode.removeChild(elem);
elem = form.querySelector("#input-error");
if (elem != null) elem.parentNode.removeChild(elem);
var newElem = form.querySelector("#input-error-message");
if (newElem != null) newElem.parentNode.removeChild(newElem);
newElem = form.querySelector("#input-error");
if (newElem != null) newElem.parentNode.removeChild(newElem);
},
textCounter: function (field, maxlimit) {
var countfield = field.parentNode.querySelector(".counter-msg");
Expand Down Expand Up @@ -440,7 +425,7 @@ function FBAform(d, N) {
successText: function () {
return "Thanks for your feedback!";
},
showFormSuccess: function (e) {
showFormSuccess: function () {
var formComponent = this.formComponent();
var formElement = this.formElement();
var alertElement = formComponent.querySelector(".fba-alert");
Expand Down Expand Up @@ -500,7 +485,6 @@ function FBAform(d, N) {
formSuccess: function (e) {
// Clear the alert box
var formComponent = this.formComponent();
var alertElement = formComponent.querySelector(".fba-alert");
var alertElementBody =
formComponent.getElementsByClassName("usa-alert__text")[0];
var alertErrorElement = formComponent.querySelector(".fba-alert-error");
Expand Down Expand Up @@ -530,7 +514,7 @@ function FBAform(d, N) {
var errors = jsonResponse.messages;

for (var err in errors) {
if (errors.hasOwnProperty(err)) {
if (Object.prototype.hasOwnProperty.call(errors, err)) {
alertErrorElementBody.innerHTML += err;
alertErrorElementBody.innerHTML += " ";
alertErrorElementBody.innerHTML += errors[err];
Expand Down Expand Up @@ -622,8 +606,8 @@ function FBAform(d, N) {
);
}

for (var i = 0; i < nextButtons.length; i++) {
nextButtons[i].addEventListener(
for (var k = 0; k < nextButtons.length; k++) {
nextButtons[k].addEventListener(
"click",
function (e) {
e.preventDefault();
Expand Down
23 changes: 23 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import globals from "globals";
import js from '@eslint/js';

export default [
{
files:["assets/**/*.js"],
languageOptions: {
ecmaVersion: 2020,
sourceType: "module",
globals: {
...globals.browser,
}
},
...js.configs.recommended
},
{
ignores: [
"**/uswds*.js",
"**/main.js",
"**/anchor*.js",
],
}
];
1 change: 0 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
USWDS SASS GULPFILE
----------------------------------------
*/

const autoprefixer = require("autoprefixer");
const csso = require("postcss-csso");
const uncss = require("postcss-uncss");
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"uswds-update": "npm update uswds",
"uncss": "gulp uncss",
"watch": "gulp watch",
"eslint": "eslint assets/js/",
"eslint": "eslint",
"build": "gulp build-sass && bundle exec jekyll build --config _config.yml",
"build:dev": "gulp build-sass && bundle exec jekyll build --config _config.yml,_dev_config.yml",
"build:dev2": "gulp build-sass && bundle exec jekyll build --config _config.yml,_dev2_config.yml",
Expand Down Expand Up @@ -57,8 +57,7 @@
"@uswds/compile": "^1.1.0",
"autoprefixer": "^10.4.19",
"del": "^6.0.0",
"eslint": "^8.57.0",
"eslint-plugin-frontmatter": "0.0.8",
Copy link
Contributor

Choose a reason for hiding this comment

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

We weren't using this plugin anymore so went ahead and removed it

"eslint": "^9.0.0",
"gulp": "^4.0.2",
"gulp-postcss": "^9.1.0",
"gulp-rename": "^2.0.0",
Expand Down
Loading
Loading