Skip to content
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
97 changes: 5 additions & 92 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
"IS_GUTENBERG_PLUGIN": true
},
"devDependencies": {
"@eslint/eslintrc": "^3.0.0",
"@types/react": "^18.3.27",
"@types/react-dom": "^18.3.1",
"@typescript/native-preview": "^7.0.0-dev.20260423.1",
Expand All @@ -71,8 +70,7 @@
"@wordpress/vips": "file:./packages/vips",
"concurrently": "^3.5.0",
"cross-env": "^7.0.3",
"eslint": "^10.0.0",
"eslint-formatter-compact": "^9.0.1",
"glob": "^7.1.2",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

glob was added here probably while resolving conflicts. Let us get rid of it in a follow up.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oh! I saw it in merge conflict and thought it was added back, removing it now.

"husky": "^7.0.0",
"lerna": "^9.0.7",
"lint-staged": "^16.4.0",
Expand Down
3 changes: 2 additions & 1 deletion packages/eslint-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@
},
"devDependencies": {
"@types/eslint": "^9",
"@types/estree": "^1.0.5"
"@types/estree": "^1.0.5",
"eslint": "^10.0.0"
},
Comment thread
manzoorwanijk marked this conversation as resolved.
"peerDependencies": {
"@babel/core": ">=7",
Expand Down
2 changes: 0 additions & 2 deletions packages/jest-preset-default/jest-preset.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module.exports = {
moduleNameMapper: {
'\\.(scss|css)$': require.resolve( './scripts/style-mock.js' ),
// See https://github.com/facebook/jest/issues/11100#issuecomment-967161978
'@eslint/eslintrc': '@eslint/eslintrc/dist/eslintrc-universal.cjs',
},
modulePaths: [ '<rootDir>' ],
setupFiles: [ require.resolve( './scripts/setup-globals.js' ) ],
Expand Down
1 change: 0 additions & 1 deletion test/unit/scripts/resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ module.exports = ( path, options ) => {
if (
pkg.name === 'uuid' ||
pkg.name === 'react-colorful' ||
pkg.name === '@eslint/eslintrc' ||
pkg.name === 'expect' ||
pkg.name === 'nanoid' ||
pkg.name?.startsWith( '@wordpress/' )
Expand Down
51 changes: 47 additions & 4 deletions tools/eslint/lint-js.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,45 @@ const args = userArgs.some( ( arg ) =>
: [ '--suppressions-location', SUPPRESSIONS_FILE, ...userArgs ];
const wpScriptsBin = require.resolve( '@wordpress/scripts/bin/wp-scripts.js' );

const FORMAT_FLAGS = [ '-f', '--format' ];

function resolveFormatter( name ) {
if (
name.startsWith( '/' ) ||
name.startsWith( './' ) ||
name.startsWith( '../' ) ||
/^[A-Za-z]:\\/.test( name )
) {
return name;
}
Comment thread
manzoorwanijk marked this conversation as resolved.

for ( const candidate of [ name, `eslint-formatter-${ name }` ] ) {
try {
return require.resolve( candidate, { paths: [ __dirname ] } );
} catch {}
}

throw new Error(
`Formatter "${ name }" not found. Install the corresponding eslint-formatter-<name> package in tools/eslint/ or use a built-in formatter (stylish, json, etc.).`
);
}

const childArgs = args.map( ( arg, index ) => {
if ( FORMAT_FLAGS.includes( args[ index - 1 ] ) ) {
return resolveFormatter( arg );
}

for ( const flag of FORMAT_FLAGS ) {
if ( arg.startsWith( `${ flag }=` ) ) {
return `${ flag }=${ resolveFormatter(
arg.slice( flag.length + 1 )
) }`;
}
}

return arg;
} );

// Detect stale suppressions by scanning the child's output for ESLint's
// own `--prune-suppressions` hint. A small sliding tail buffer is used so
// the child's output can be streamed straight to the user instead of being
Expand All @@ -39,10 +78,14 @@ if (
childEnv.FORCE_COLOR = '1';
}

const child = spawn( process.execPath, [ wpScriptsBin, 'lint-js', ...args ], {
stdio: [ 'inherit', 'pipe', 'pipe' ],
env: childEnv,
} );
const child = spawn(
process.execPath,
[ wpScriptsBin, 'lint-js', ...childArgs ],
{
stdio: [ 'inherit', 'pipe', 'pipe' ],
env: childEnv,
}
);

child.stdout.on( 'data', handleChunk( process.stdout ) );
child.stderr.on( 'data', handleChunk( process.stderr ) );
Expand Down
2 changes: 2 additions & 0 deletions tools/eslint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
"@eslint/js": "^10.0.0",
"@wordpress/eslint-plugin": "file:../../packages/eslint-plugin",
"@wordpress/scripts": "file:../../packages/scripts",
"eslint": "^10.0.0",
"eslint-formatter-compact": "^9.0.1",
"eslint-import-resolver-typescript": "^4.4.4",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-jest": "^28.11.0",
Expand Down
Loading