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 Eslint packages #37830

Merged
merged 13 commits into from
Jun 12, 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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"version-packages": "bash ./tools/version-packages.sh"
},
"devDependencies": {
"eslint": "8.51.0",
"eslint": "8.57.0",
"husky": "8.0.3",
"jetpack-cli": "workspace:*",
"jetpack-js-tools": "workspace:*"
Expand Down
525 changes: 291 additions & 234 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion projects/js-packages/boost-score-api/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const loadIgnorePatterns = require( '../../../tools/js-tools/load-eslint-ignore.js' );
const loadIgnorePatterns = require( 'jetpack-js-tools/load-eslint-ignore.js' );

module.exports = {
root: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: changed

Updated package dependencies.
6 changes: 3 additions & 3 deletions projects/js-packages/boost-score-api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@automattic/jetpack-boost-score-api",
"version": "0.1.31",
"version": "0.1.32-alpha",
"description": "A package to get the Jetpack Boost score of a site",
"homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/boost-score-api/#readme",
"bugs": {
Expand All @@ -25,8 +25,8 @@
},
"devDependencies": {
"@automattic/jetpack-webpack-config": "workspace:*",
"@typescript-eslint/parser": "6.7.5",
"eslint": "8.51.0",
"@typescript-eslint/parser": "6.21.0",
"eslint": "8.57.0",
"jest": "29.7.0",
"jest-environment-jsdom": "29.7.0",
"typescript": "5.0.4",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fixed
Comment: Fix test for eslint upgrade.


2 changes: 1 addition & 1 deletion projects/js-packages/eslint-changed/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@automattic/eslint-changed",
"version": "2.0.8",
"version": "2.0.9-alpha",
"description": "Run eslint on files, but only report warnings and errors from lines that were changed.",
"homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/eslint-changed/#readme",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion projects/js-packages/eslint-changed/src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Command } from 'commander';
import { ESLint } from 'eslint';
import parseDiff from 'parse-diff';

const APP_VERSION = '2.0.8';
const APP_VERSION = '2.0.9-alpha';

/**
* Create a Commander instance.
Expand Down
50 changes: 39 additions & 11 deletions projects/js-packages/eslint-changed/tests/cli.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,34 @@ describe( 'bin/eslint-changed.js', () => {
} );

describe( 'Git mode', function () {
// Apparently eslint deprecated a bunch of rules still in eslint:recommended.
const usedDeprecatedRules = [
{
replacedBy: [],
ruleId: 'indent',
},
{
replacedBy: [],
ruleId: 'quotes',
},
{
replacedBy: [],
ruleId: 'linebreak-style',
},
{
replacedBy: [],
ruleId: 'semi',
},
{
replacedBy: [],
ruleId: 'no-extra-semi',
},
{
replacedBy: [],
ruleId: 'no-mixed-spaces-and-tabs',
},
];

/**
* Set up a temporary directory with a git repo.
*
Expand Down Expand Up @@ -464,7 +492,7 @@ describe( 'bin/eslint-changed.js', () => {
fixableWarningCount: 0,
source: 'console.log( "Hello, world?" );\n',
suppressedMessages: [],
usedDeprecatedRules: [],
usedDeprecatedRules,
},
];
expect( output ).toEqual( expectOutput );
Expand Down Expand Up @@ -507,7 +535,7 @@ describe( 'bin/eslint-changed.js', () => {
fixableWarningCount: 0,
source: 'console.log( "Hello, world?" );\n',
suppressedMessages: [],
usedDeprecatedRules: [],
usedDeprecatedRules,
},
];
expect( output ).toEqual( expectOutput );
Expand Down Expand Up @@ -550,7 +578,7 @@ describe( 'bin/eslint-changed.js', () => {
fixableWarningCount: 0,
source: "console.log( '¡Hola, mundo!' )\n",
suppressedMessages: [],
usedDeprecatedRules: [],
usedDeprecatedRules,
},
];
expect( output ).toEqual( expectOutput );
Expand Down Expand Up @@ -589,7 +617,7 @@ describe( 'bin/eslint-changed.js', () => {
fixableWarningCount: 0,
source: "var x;\nconsole.log( 'Hello, world!' );\n",
suppressedMessages: [],
usedDeprecatedRules: [],
usedDeprecatedRules,
},
];
expect( output ).toEqual( expectOutput );
Expand Down Expand Up @@ -642,7 +670,7 @@ describe( 'bin/eslint-changed.js', () => {
fixableWarningCount: 0,
source: 'var x = 1;\n',
suppressedMessages: [],
usedDeprecatedRules: [],
usedDeprecatedRules,
},
{
filePath: path.join( tmpdir, 'modified.js' ),
Expand Down Expand Up @@ -670,7 +698,7 @@ describe( 'bin/eslint-changed.js', () => {
fixableWarningCount: 0,
source: 'var x = \'Hello\';\nx += ", world!";\nconsole.log( x );\n',
suppressedMessages: [],
usedDeprecatedRules: [],
usedDeprecatedRules,
},
];
expect( output ).toEqual( expectOutput );
Expand Down Expand Up @@ -712,7 +740,7 @@ describe( 'bin/eslint-changed.js', () => {
fixableWarningCount: 0,
source: "var x = 'Hello, world!';\n\n\n\n\n\n\n\n\n\n\n\nconsole.log( x )\n",
suppressedMessages: [],
usedDeprecatedRules: [],
usedDeprecatedRules,
},
{
filePath: path.join( tmpdir, '2.js' ),
Expand Down Expand Up @@ -747,7 +775,7 @@ describe( 'bin/eslint-changed.js', () => {
fixableWarningCount: 0,
source: "var y = 'Hello, world!';\n\n\n\n\n\n\n\n\n\n\n\nconsole.log( x )\n",
suppressedMessages: [],
usedDeprecatedRules: [],
usedDeprecatedRules,
},
];
expect( output ).toEqual( expectOutput );
Expand Down Expand Up @@ -801,7 +829,7 @@ describe( 'bin/eslint-changed.js', () => {
fixableWarningCount: 0,
source: "var y = 'Hello, world!';\n\n\n\n\n\n\n\n\n\n\n\nconsole.log( x )\n",
suppressedMessages: [],
usedDeprecatedRules: [],
usedDeprecatedRules,
},
{
filePath: path.join( tmpdir, '3.js' ),
Expand All @@ -825,7 +853,7 @@ describe( 'bin/eslint-changed.js', () => {
fixableWarningCount: 0,
source: "var y = 'Hello, world!';\n\n\n\n\n\n\n\n\n\n\n\nconsole.log( x )\n",
suppressedMessages: [],
usedDeprecatedRules: [],
usedDeprecatedRules,
},
];
expect( output ).toEqual( expectOutput );
Expand Down Expand Up @@ -882,7 +910,7 @@ describe( 'bin/eslint-changed.js', () => {
fixableWarningCount: 0,
source: "var y = 'Hello, world!';\n\n\n\n\n\n\n\n\n\n\n\nconsole.log( x )\n",
suppressedMessages: [],
usedDeprecatedRules: [],
usedDeprecatedRules,
},
];
expect( output ).toEqual( expectOutput );
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: changed

Updated package dependencies.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: added

Updated `eslint-plugin-es-x` adds additional rules: `es-x/no-arraybuffer-prototype-transfer`, `es-x/no-object-map-groupby`, `es-x/no-promise-withresolvers`, `es-x/no-resizable-and-growable-arraybuffers`, `es-x/no-set-prototype-difference`, `es-x/no-set-prototype-intersection`, `es-x/no-set-prototype-isdisjointfrom`, `es-x/no-set-prototype-issubsetof`, `es-x/no-set-prototype-issupersetof`, `es-x/no-set-prototype-symmetricdifference`, and `es-x/no-set-prototype-union`.
6 changes: 3 additions & 3 deletions projects/js-packages/eslint-config-target-es/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@automattic/eslint-config-target-es",
"version": "2.1.1-alpha",
"version": "2.2.0-alpha",
"description": "ESLint sharable config to activate eslint-plugin-es checks based on browserslist targets.",
"homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/eslint-config-target-es/README.md#readme",
"bugs": {
Expand All @@ -24,8 +24,8 @@
},
"devDependencies": {
"@wordpress/browserslist-config": "6.0.0",
"eslint": "8.51.0",
"eslint-plugin-es-x": "7.2.0",
"eslint": "8.57.0",
"eslint-plugin-es-x": "7.7.0",
"jest": "29.7.0"
},
"peerDependencies": {
Expand Down
25 changes: 24 additions & 1 deletion projects/js-packages/eslint-config-target-es/src/rulesMap.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,32 @@
// Map of eslint-plugin-es-x rules to MDN compat-data paths.
// Values are either a path, an array of paths, true to always enable the rule, or false to always disable it.
module.exports = {
// ?
// ES2024
'no-arraybuffer-prototype-transfer': 'javascript.builtins.ArrayBuffer.transfer',
'no-atomics-waitasync': 'javascript.builtins.Atomics.waitAsync',
'no-object-map-groupby': [
'javascript.builtins.Map.groupBy',
'javascript.builtins.Object.groupBy',
],
'no-promise-withresolvers': 'javascript.builtins.Promise.withResolvers',
'no-regexp-v-flag': 'javascript.builtins.RegExp.unicodeSets',
'no-resizable-and-growable-arraybuffers': [
'javascript.builtins.ArrayBuffer.ArrayBuffer.maxByteLength_option',
'javascript.builtins.ArrayBuffer.maxByteLength',
'javascript.builtins.ArrayBuffer.resizable',
'javascript.builtins.ArrayBuffer.resize',
'javascript.builtins.SharedArrayBuffer.SharedArrayBuffer.maxByteLength_option',
'javascript.builtins.SharedArrayBuffer.grow',
'javascript.builtins.SharedArrayBuffer.growable',
'javascript.builtins.SharedArrayBuffer.maxByteLength',
],
'no-set-prototype-difference': 'javascript.builtins.Set.difference',
'no-set-prototype-intersection': 'javascript.builtins.Set.intersection',
'no-set-prototype-isdisjointfrom': 'javascript.builtins.Set.isDisjointFrom',
'no-set-prototype-issubsetof': 'javascript.builtins.Set.isSubsetOf',
'no-set-prototype-issupersetof': 'javascript.builtins.Set.isSupersetOf',
'no-set-prototype-symmetricdifference': 'javascript.builtins.Set.symmetricDifference',
'no-set-prototype-union': 'javascript.builtins.Set.union',
'no-string-prototype-iswellformed-towellformed': [
'javascript.builtins.String.isWellFormed',
'javascript.builtins.String.toWellFormed',
Expand Down
4 changes: 4 additions & 0 deletions projects/js-packages/image-guide/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
// eslint-disable-next-line import/no-extraneous-dependencies
const loadIgnorePatterns = require( 'jetpack-js-tools/load-eslint-ignore.js' );

module.exports = {
root: true,
extends: [
require.resolve( 'jetpack-js-tools/eslintrc/base' ),
require.resolve( 'jetpack-js-tools/eslintrc/wp-eslint-plugin/recommended' ),
require.resolve( 'jetpack-js-tools/eslintrc/svelte' ),
],
ignorePatterns: loadIgnorePatterns( __dirname ),
parserOptions: {
sourceType: 'module',
tsconfigRootDir: __dirname,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: changed

Updated package dependencies.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fixed
Comment: Add missing `loadIgnorePatterns` in `.eslintrc`.


4 changes: 2 additions & 2 deletions projects/js-packages/image-guide/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
"@rollup/plugin-replace": "5.0.2",
"@rollup/plugin-terser": "0.4.3",
"@rollup/plugin-typescript": "8.3.3",
"@typescript-eslint/parser": "6.7.5",
"eslint": "8.51.0",
"@typescript-eslint/parser": "6.21.0",
"eslint": "8.57.0",
"jest": "29.7.0",
"postcss": "8.4.31",
"rollup": "2.79.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fixed
Comment: Suppress buggy `jsx-a11y/label-has-associated-control` lint.


Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ export function ConfirmationForm( { keyringResult, onComplete, isAdmin }: Confir
<div className={ styles[ 'accounts-list' ] }>
{ accounts.not_connected.map( ( option, index ) => {
return (
// eslint-disable-next-line jsx-a11y/label-has-associated-control -- https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/issues/869
<label key={ option.value } className={ styles[ 'account-label' ] } aria-required>
<input
type="radio"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fixed
Comment: Suppress buggy `jsx-a11y/label-has-associated-control` lint.


2 changes: 2 additions & 0 deletions projects/js-packages/social-logos/src/react/example.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,15 @@ function SocialLogosExample() {
<div className="display-control-group">
<div className="display-control">
<h4>Small icons</h4>
{ /* eslint-disable-next-line jsx-a11y/label-has-associated-control -- https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/issues/869 */ }
<label className="switch">
<input type="checkbox" onChange={ handleSmallIconsToggle } checked={ useSmallIcons } />
<span className="handle"></span>
</label>
</div>
<div className="display-control">
<h4>Icon names</h4>
{ /* eslint-disable-next-line jsx-a11y/label-has-associated-control -- https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/issues/869 */ }
<label className="switch">
<input type="checkbox" onChange={ handleIconNamesToggle } checked={ showIconNames } />
<span className="handle"></span>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: changed

Updated package dependencies.
4 changes: 2 additions & 2 deletions projects/js-packages/svelte-data-sync-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
},
"devDependencies": {
"@automattic/jetpack-webpack-config": "workspace:*",
"@typescript-eslint/parser": "6.7.5",
"eslint": "8.51.0",
"@typescript-eslint/parser": "6.21.0",
"eslint": "8.57.0",
"jest": "29.7.0",
"svelte": "3.58.0",
"tslib": "2.5.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fixed
Comment: Suppress buggy `jsx-a11y/label-has-associated-control` lint.


Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export const EmailForm = ( { shouldShowEmailForm }: EmailFormProps ) => {
{ shouldShowEmailForm && (
<div className="verbum-form__wrapper">
<div className="verbum-form__content">
{ /* eslint-disable-next-line jsx-a11y/label-has-associated-control -- https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/issues/869 */ }
<label className="verbum__label">
<Email />
<input
Expand All @@ -107,6 +108,7 @@ export const EmailForm = ( { shouldShowEmailForm }: EmailFormProps ) => {
/>
</label>

{ /* eslint-disable-next-line jsx-a11y/label-has-associated-control -- https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/issues/869 */ }
<label className="verbum__label">
<Name />
<input
Expand All @@ -128,6 +130,7 @@ export const EmailForm = ( { shouldShowEmailForm }: EmailFormProps ) => {
/>
</label>

{ /* eslint-disable-next-line jsx-a11y/label-has-associated-control -- https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/issues/869 */ }
<label className="verbum__label">
<Website />
<input
Expand Down
5 changes: 5 additions & 0 deletions projects/plugins/boost/changelog/renovate-eslint-packages
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fixed
Comment: E2E tests: Replace discouraged `waitForSelector()`


Loading
Loading