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
8 changes: 0 additions & 8 deletions .eslintignore

This file was deleted.

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

This file was deleted.

4 changes: 0 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,12 @@ updates:
patterns: ['@wordpress/*']
dependency-type: 'production'
ignore:
- dependency-name: 'eslint' # eslint@>=9.x.x blocked by https://github.com/WordPress/gutenberg/issues/64782
update-types: ['version-update:semver-major']
- dependency-name: 'react' # react@>=19.x.x blocked by https://github.com/WordPress/gutenberg/issues/71336
update-types: ['version-update:semver-major']
- dependency-name: 'react-dom' # react@>=19.x.x blocked by https://github.com/WordPress/gutenberg/issues/71336
update-types: ['version-update:semver-major']
- dependency-name: 'jquery' # jquery@>=4.x.x blocked by https://core.trac.wordpress.org/ticket/60478
update-types: ['version-update:semver-major']
- dependency-name: 'eslint-plugin-react-refresh' # eslint-plugin-react-refresh@>=0.5.x requires eslint@>=9.x.x, blocked by https://github.com/WordPress/gutenberg/issues/64782
update-types: ['version-update:semver-minor']

- package-ecosystem: 'bundler'
directory: '/'
Expand Down
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ See `docs/code/local-wordpress.md` for detailed setup instructions and troublesh

The project follows WordPress coding standards for JavaScript:

- **ESLint**: Uses `@wordpress/eslint-plugin/recommended` configuration
- **ESLint**: Flat config in `eslint.config.js`, extending `@wordpress/eslint-plugin`'s `recommended` config. Its `test-playwright` config applies to `e2e/` except the `*.test.js` files, which are vitest unit tests rather than Playwright specs.
- **Prettier**: Uses `@wordpress/prettier-config` for code formatting

### Function Ordering Convention
Expand Down
2 changes: 1 addition & 1 deletion bin/prep-translations.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ function hasValidTranslations( locale ) {
const content = fs.readFileSync( filePath, 'utf8' );
const translations = JSON.parse( content );
return translations && typeof translations === 'object';
} catch ( err ) {
} catch {
return false;
}
}
Expand Down
23 changes: 0 additions & 23 deletions e2e/.eslintrc.cjs

This file was deleted.

81 changes: 81 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/**
* External dependencies
*/
import { defineConfig, globalIgnores } from 'eslint/config';
import wordpress from '@wordpress/eslint-plugin';
import reactRefresh from 'eslint-plugin-react-refresh';
import globals from 'globals';

export default defineConfig( [
globalIgnores( [
// Flat config, unlike eslintrc, does not ignore dot directories, so the
// SwiftPM build directory has to be named explicitly.
'.build/',
'android/',
'build/',
'dist/',
'e2e/test-results/',
'ios/',
'playwright-report/',
'vendor/',
] ),
{
files: [ '**/*.{js,jsx,cjs,mjs}' ],
extends: [ wordpress.configs.recommended ],
languageOptions: {
globals: globals.browser,
},
settings: {
'import/resolver': {
// The WordPress config registers only the TypeScript resolver,
// which honors `exports` and so resolves neither the
// `@wordpress/block-editor` subpaths added in `patches/`, whose
// targets omit the `.mjs` extension, nor
// `@wordpress/preferences-persistence`, whose `types` condition
// names build output it does not publish. The node resolver
// ignores `exports` and resolves both.
node: {
extensions: [ '.js', '.jsx', '.mjs', '.cjs' ],
},
},
},
plugins: {
'react-refresh': reactRefresh,
},
rules: {
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
},
{
files: [ 'e2e/**/*.js' ],
// Unit tests sit alongside the specs but run under vitest, whose `it()`
// blocks the Playwright rules do not recognize as tests.
ignores: [ 'e2e/**/*.test.js' ],
extends: [ wordpress.configs[ 'test-playwright' ] ],
rules: {
// Discourage deprecated Playwright APIs in favor of locators, aligned
// with the upstream Gutenberg ESLint configuration.
'no-restricted-syntax': [
'error',
{
selector: 'CallExpression[callee.property.name="$"]',
message:
'`$` is discouraged, please use `locator` instead.',
},
{
selector: 'CallExpression[callee.property.name="$$"]',
message:
'`$$` is discouraged, please use `locator` instead.',
},
{
selector:
'CallExpression[callee.object.name="page"][callee.property.name="waitForTimeout"]',
message: 'Prefer page.locator instead.',
},
],
},
},
] );
Loading
Loading