Skip to content

Commit

Permalink
Update to [email protected]
Browse files Browse the repository at this point in the history
  • Loading branch information
anselmbradford committed Oct 31, 2024
1 parent 8d853a2 commit b7fff18
Show file tree
Hide file tree
Showing 72 changed files with 448 additions and 365 deletions.
4 changes: 0 additions & 4 deletions .eslintignore

This file was deleted.

50 changes: 0 additions & 50 deletions .eslintrc.cjs

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/assets/js/admin/widgets/genericPreviewTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import PropTypes from 'prop-types';
import React, { Component } from 'react';
import { ReactLiquid, liquidEngine } from 'react-liquid';
import template from '../../../../_includes/generic-content.html';
// eslint-disable-next-line import/namespace

import { marked } from '../../../../../node_modules/marked/lib/marked.esm.js';

export default class Preview extends Component {
Expand Down
4 changes: 2 additions & 2 deletions docs/assets/js/admin/widgets/pagePreviewTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Tabs from '../../../../assets/js/tabs.js';
import { encode } from 'html-entities';
import slugify from 'slugify';
import template from '../../../../_includes/variation-content.html';
// eslint-disable-next-line import/namespace

import { marked } from '../../../../../node_modules/marked/lib/marked.esm.js';

// react-liquid (https://github.com/aquibm/react-liquid/) isn't able to `include` other files so we
Expand Down Expand Up @@ -71,7 +71,7 @@ export default class Preview extends Component {
};
return (
// TODO: We're breaking some a11y here by making the whole page clickable.
// eslint-disable-next-line
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
<div ref={this.containerRef} onClick={(event) => this.handleClick(event)}>
<ReactLiquid template={templateWithIcons} data={data} html />
</div>
Expand Down
73 changes: 73 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
// Run `npx @eslint/config-inspector` to inspect the config.

import globals from 'globals';
import js from '@eslint/js';
import importPlugin from 'eslint-plugin-import';
import jsdoc from 'eslint-plugin-jsdoc';
import jsxA11y from 'eslint-plugin-jsx-a11y';
import reactPlugin from 'eslint-plugin-react';
import pluginCypress from 'eslint-plugin-cypress/flat';
import eslintConfigPrettier from 'eslint-config-prettier';

export default [
{
ignores: [
'.yarn/',
'docs/_site/',
'docs/dist/',
'test/unit-test-coverage/',
'packages/cfpb-design-system/dist/',
],
},
js.configs.recommended,
importPlugin.flatConfigs.recommended,
jsdoc.configs['flat/recommended'],
jsxA11y.flatConfigs.recommended,
reactPlugin.configs.flat.recommended,
pluginCypress.configs.recommended,
eslintConfigPrettier,
{
languageOptions: {
ecmaVersion: 2023,
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
globals: {
...globals.browser,
...globals.node,
...globals.jest,
},
},
settings: {
'import/resolver': {
node: {
paths: ['src'],
extensions: ['.js', '.ts', '.d.ts', '.tsx'],
},
},
react: {
version: 'detect',
},
},
// Some plugins are automatically included.
// plugins: {},
rules: {
'jsdoc/require-hyphen-before-param-description': 'warn',
'no-console': ['warn'],
'no-use-before-define': ['error', 'nofunc'],
'no-unused-vars': [
'error',
{
vars: 'all',
args: 'after-used',
ignoreRestSiblings: false,
},
],
'no-var': ['error'],
'prefer-const': ['error'],
radix: ['error'],
},
},
];
2 changes: 1 addition & 1 deletion lighthouserc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if (!urlsSpecified) {
"No HTML files found; build the docs first with 'yarn build-decap'.",
);

// eslint-disable-next-line no-process-exit
process.exit(1);
}

Expand Down
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,15 @@
"cypress": "13.15.1",
"esbuild": "0.24.0",
"esbuild-plugin-liquid": "0.2.0",
"eslint": "8.57.0",
"eslint": "9.13.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-cypress": "3.2.0",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-jsdoc": "48.2.3",
"eslint-plugin-jsx-a11y": "6.8.0",
"eslint-plugin-react": "7.34.1",
"eslint-plugin-cypress": "4.1.0",
"eslint-plugin-import": "2.31.0",
"eslint-plugin-jsdoc": "50.4.3",
"eslint-plugin-jsx-a11y": "6.10.2",
"eslint-plugin-react": "7.37.2",
"glob": "11.0.0",
"globals": "15.11.0",
"http-server": "14.1.1",
"jest": "29.7.0",
"jest-cli": "29.7.0",
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/cfpb-design-system/dist/index.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/cfpb-design-system/dist/utilities/index.js.map

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-use-before-define */
import {
add as addDataHook,
checkDom,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-use-before-define */
import {
add as addDataHook,
checkDom,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ function _findElements(behaviorSelector, baseElement) {
behaviorElements.length === 0 &&
behaviorSelector.indexOf(BEHAVIOR_PREFIX) === -1
) {
// eslint-disable-next-line no-use-before-define
behaviorElements = find(behaviorSelector, baseElement);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-use-before-define */
import {
BEHAVIOR_PREFIX,
JS_HOOK,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function getBreakpointState(width) {
width = width || window.innerWidth;

let rangeKey;
// eslint-disable-next-line guard-for-in

for (rangeKey in varsBreakpoints) {
breakpointState[rangeKey] = _inBreakpointRange(
varsBreakpoints[rangeKey],
Expand Down
3 changes: 1 addition & 2 deletions packages/cfpb-design-system/src/utilities/type-checkers.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ function isFunction(value) {
}

// TODO Fix complexity issue
/* eslint-disable complexity, no-mixed-operators */

/**
* @name isEmpty
* @kind function
Expand All @@ -138,7 +138,6 @@ function isEmpty(value) {
/^\s*$/.test(value)
);
}
/* eslint-enable complexity, no-mixed-operators */

// Expose public methods.
export {
Expand Down
2 changes: 1 addition & 1 deletion scripts/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
yarn prettier "./**/*.{js,jsx,ts,tsx,md,css,less}" --write

## Run JS linting. See ignored path in .eslintignore.
yarn eslint ./{.,test,docs,packages} --fix
yarn eslint "./{.,test,docs,packages}/**/*.js" --fix

## Run CSS linting. See ignored path in .stylelintignore.
yarn stylelint "{docs,packages}/**/*.scss" --fix
58 changes: 28 additions & 30 deletions scripts/svgo-plugin-add-classes-to-svg-element.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const path = require('path');
exports.name = 'addClassesToSVGElement';
exports.description = 'adds classnames to an outer <svg> element';

var ENOCLS = `Error in plugin "addClassesToSVGElement": absent parameters.
const ENOCLS = `Error in plugin "addClassesToSVGElement": absent parameters.
It should have a list of classes in "classNames" or one "className".
Config example:
plugins: [
Expand Down Expand Up @@ -42,52 +42,50 @@ plugins: [
* Add classnames to an outer <svg> element. Example config:
*
* plugins: [
* {
* name: "addClassesToSVGElement",
* params: {
* className: "mySvg"
* }
* }
* {
* name: "addClassesToSVGElement",
* params: {
* className: "mySvg"
* }
* }
* ]
*
* plugins: [
* {
* name: "addClassesToSVGElement",
* params: {
* classNames: ["mySvg", "size-big"]
* }
* }
* {
* name: "addClassesToSVGElement",
* params: {
* classNames: ["mySvg", "size-big"]
* }
* }
* ]
*
* Use the suffixPattern parameter to add an arbitrary suffix to
* the class names.
*
* plugins: [
* {
* name: "addClassesToSVGElement",
* params: {
* classNames: ["mySvg"],
* suffixPattern: "__$FILENAME"
* }
* }
* {
* name: "addClassesToSVGElement",
* params: {
* classNames: ["mySvg"],
* suffixPattern: "__$FILENAME"
* }
* }
* ]
*
* Use the boolean doesPreserveClasses parameter to preserve any
* existing classes on the SVG element, otherwise any existing
* classes will be removed.
*
* plugins: [
* {
* name: "addClassesToSVGElement",
* params: {
* classNames: ["mySvg"],
* doesPreserveClasses: true
* }
* }
* {
* name: "addClassesToSVGElement",
* params: {
* classNames: ["mySvg"],
* doesPreserveClasses: true
* }
* }
* ]
*
* @author April Arcus, Anselm Bradford
*
* @type {import('./plugins-types').Plugin<'addClassesToSVGElement'>}
*/
exports.fn = (root, params, info) => {
Expand All @@ -114,7 +112,7 @@ exports.fn = (root, params, info) => {
let suffixPattern = params.suffixPattern;
const filename = path.basename(info.path, '.svg');
suffixPattern = suffixPattern.replace('$FILENAME', filename);
for (var i = 0, len = classNames.length; i < len; i++) {
for (let i = 0, len = classNames.length; i < len; i++) {
classNames.push(classNames[i] + suffixPattern);
}
}
Expand Down
3 changes: 0 additions & 3 deletions test/cypress/e2e/docs/decap-cms.cy.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/* eslint-disable handle-callback-err */
/* eslint-disable no-undef */

const getIframeBody = () => {
// Get the iframe > document > body
// and retry until the body element is not empty
Expand Down
Loading

0 comments on commit b7fff18

Please sign in to comment.