@wordpress/eslint-plugin 24.6.1-next.v.202604091042.0 → 25.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/README.md +64 -19
  2. package/configs/babel-parser-compat.js +69 -0
  3. package/configs/custom.js +37 -28
  4. package/configs/es5.js +100 -93
  5. package/configs/esnext.js +61 -53
  6. package/configs/i18n.js +24 -13
  7. package/configs/index.js +15 -1
  8. package/configs/jsdoc.js +80 -77
  9. package/configs/jshint.js +18 -16
  10. package/configs/jsx-a11y.js +24 -18
  11. package/configs/react.js +68 -39
  12. package/configs/recommended-with-formatting.js +51 -35
  13. package/configs/recommended.js +40 -29
  14. package/configs/test-e2e.js +18 -10
  15. package/configs/test-playwright.js +6 -3
  16. package/configs/test-unit.js +15 -8
  17. package/eslintrc/index.js +173 -0
  18. package/index.js +46 -2
  19. package/package.json +25 -20
  20. package/rules/__tests__/components-no-missing-40px-size-prop.js +5 -3
  21. package/rules/__tests__/components-no-unsafe-button-disabled.js +5 -3
  22. package/rules/__tests__/data-no-store-string-literals.js +77 -37
  23. package/rules/__tests__/dependency-group.js +1 -1
  24. package/rules/__tests__/i18n-ellipsis.js +1 -1
  25. package/rules/__tests__/i18n-hyphenated-range.js +1 -1
  26. package/rules/__tests__/i18n-no-collapsible-whitespace.js +1 -1
  27. package/rules/__tests__/i18n-no-flanking-whitespace.js +1 -1
  28. package/rules/__tests__/i18n-no-placeholders-only.js +1 -1
  29. package/rules/__tests__/i18n-no-variables.js +1 -1
  30. package/rules/__tests__/i18n-text-domain.js +1 -2
  31. package/rules/__tests__/i18n-translator-comments.js +1 -1
  32. package/rules/__tests__/no-base-control-with-label-without-id.js +5 -3
  33. package/rules/__tests__/no-dom-globals-in-constructor.js +9 -5
  34. package/rules/__tests__/no-dom-globals-in-module-scope.js +10 -33
  35. package/rules/__tests__/no-dom-globals-in-react-cc-render.js +9 -5
  36. package/rules/__tests__/no-dom-globals-in-react-fc.js +9 -5
  37. package/rules/__tests__/no-ds-tokens.js +8 -6
  38. package/rules/__tests__/no-global-active-element.js +1 -1
  39. package/rules/__tests__/no-global-get-selection.js +1 -1
  40. package/rules/__tests__/no-i18n-in-save.js +5 -3
  41. package/rules/__tests__/no-setting-ds-tokens.js +7 -5
  42. package/rules/__tests__/no-unguarded-get-range-at.js +1 -1
  43. package/rules/__tests__/no-unknown-ds-tokens.js +5 -3
  44. package/rules/__tests__/no-unmerged-classname.js +5 -3
  45. package/rules/__tests__/no-unsafe-wp-apis.js +1 -1
  46. package/rules/__tests__/no-unused-vars-before-return.js +5 -3
  47. package/rules/__tests__/no-wp-process-env.js +1 -1
  48. package/rules/__tests__/react-no-unsafe-timeout.js +1 -1
  49. package/rules/__tests__/use-recommended-components.js +1 -3
  50. package/rules/__tests__/valid-sprintf.js +1 -1
  51. package/rules/__tests__/wp-global-usage.js +1 -1
  52. package/rules/no-setting-ds-tokens.js +1 -1
package/configs/jsdoc.js CHANGED
@@ -2,6 +2,7 @@
2
2
  * External dependencies
3
3
  */
4
4
  const globals = require( 'globals' );
5
+ const jsdocPlugin = require( 'eslint-plugin-jsdoc' );
5
6
 
6
7
  /**
7
8
  * The temporary list of types defined in Gutenberg which are allowed to avoid
@@ -72,83 +73,85 @@ const typescriptUtilityTypes = [
72
73
  'false',
73
74
  ];
74
75
 
75
- module.exports = {
76
- extends: [ 'plugin:jsdoc/recommended' ],
77
- settings: {
78
- jsdoc: {
79
- preferredTypes: {
80
- object: 'Object',
81
- },
82
- tagNamePreference: {
83
- returns: 'return',
84
- yields: 'yield',
76
+ module.exports = [
77
+ jsdocPlugin.configs[ 'flat/recommended' ],
78
+ {
79
+ settings: {
80
+ jsdoc: {
81
+ preferredTypes: {
82
+ object: 'Object',
83
+ },
84
+ tagNamePreference: {
85
+ returns: 'return',
86
+ yields: 'yield',
87
+ },
85
88
  },
86
89
  },
90
+ rules: {
91
+ 'jsdoc/no-defaults': 'off',
92
+ 'jsdoc/no-undefined-types': [
93
+ 'error',
94
+ {
95
+ definedTypes: [
96
+ // Required to reference browser types because we don't have the `browser` environment enabled for the project.
97
+ // Here we filter out all browser globals that don't begin with an uppercase letter because those
98
+ // generally refer to window-level event listeners and are not a valid type to reference (e.g. `onclick`).
99
+ ...Object.keys( globals.browser ).filter( ( k ) =>
100
+ /^[A-Z]/.test( k )
101
+ ),
102
+ ...typescriptUtilityTypes,
103
+ ...temporaryWordPressInternalTypes,
104
+ ...temporaryExternalTypes,
105
+ 'void',
106
+ 'React',
107
+ ],
108
+ },
109
+ ],
110
+ 'jsdoc/require-jsdoc': 'off',
111
+ 'jsdoc/require-param-description': 'off',
112
+ 'jsdoc/require-returns': 'off',
113
+ 'jsdoc/require-yields': 'off',
114
+ 'jsdoc/tag-lines': [
115
+ 1,
116
+ 'any',
117
+ {
118
+ startLines: null,
119
+ endLines: 0,
120
+ applyToEndTag: false,
121
+ },
122
+ ],
123
+ 'jsdoc/no-multi-asterisks': [
124
+ 'error',
125
+ { preventAtMiddleLines: false },
126
+ ],
127
+ 'jsdoc/check-access': 'error',
128
+ 'jsdoc/check-alignment': 'error',
129
+ 'jsdoc/check-line-alignment': [
130
+ 'error',
131
+ 'always',
132
+ {
133
+ tags: [ 'param', 'arg', 'argument', 'property', 'prop' ],
134
+ preserveMainDescriptionPostDelimiter: true,
135
+ },
136
+ ],
137
+ 'jsdoc/check-param-names': 'error',
138
+ 'jsdoc/check-property-names': 'error',
139
+ 'jsdoc/check-tag-names': 'error',
140
+ 'jsdoc/check-types': 'error',
141
+ 'jsdoc/check-values': 'off',
142
+ 'jsdoc/empty-tags': 'error',
143
+ 'jsdoc/implements-on-classes': 'error',
144
+ 'jsdoc/require-param': 'error',
145
+ 'jsdoc/require-param-name': 'error',
146
+ 'jsdoc/require-param-type': 'error',
147
+ 'jsdoc/require-property': 'error',
148
+ 'jsdoc/require-property-description': 'error',
149
+ 'jsdoc/require-property-name': 'error',
150
+ 'jsdoc/require-property-type': 'error',
151
+ 'jsdoc/require-returns-check': 'error',
152
+ 'jsdoc/require-returns-description': 'error',
153
+ 'jsdoc/require-returns-type': 'error',
154
+ 'jsdoc/valid-types': 'error',
155
+ },
87
156
  },
88
- rules: {
89
- 'jsdoc/no-defaults': 'off',
90
- 'jsdoc/no-undefined-types': [
91
- 'error',
92
- {
93
- definedTypes: [
94
- // Required to reference browser types because we don't have the `browser` environment enabled for the project.
95
- // Here we filter out all browser globals that don't begin with an uppercase letter because those
96
- // generally refer to window-level event listeners and are not a valid type to reference (e.g. `onclick`).
97
- ...Object.keys( globals.browser ).filter( ( k ) =>
98
- /^[A-Z]/.test( k )
99
- ),
100
- ...typescriptUtilityTypes,
101
- ...temporaryWordPressInternalTypes,
102
- ...temporaryExternalTypes,
103
- 'void',
104
- 'React',
105
- ],
106
- },
107
- ],
108
- 'jsdoc/require-jsdoc': 'off',
109
- 'jsdoc/require-param-description': 'off',
110
- 'jsdoc/require-returns': 'off',
111
- 'jsdoc/require-yields': 'off',
112
- 'jsdoc/tag-lines': [
113
- 1,
114
- 'any',
115
- {
116
- startLines: null,
117
- endLines: 0,
118
- applyToEndTag: false,
119
- },
120
- ],
121
- 'jsdoc/no-multi-asterisks': [
122
- 'error',
123
- { preventAtMiddleLines: false },
124
- ],
125
- 'jsdoc/check-access': 'error',
126
- 'jsdoc/check-alignment': 'error',
127
- 'jsdoc/check-line-alignment': [
128
- 'error',
129
- 'always',
130
- {
131
- tags: [ 'param', 'arg', 'argument', 'property', 'prop' ],
132
- preserveMainDescriptionPostDelimiter: true,
133
- },
134
- ],
135
- 'jsdoc/check-param-names': 'error',
136
- 'jsdoc/check-property-names': 'error',
137
- 'jsdoc/check-tag-names': 'error',
138
- 'jsdoc/check-types': 'error',
139
- 'jsdoc/check-values': 'off',
140
- 'jsdoc/empty-tags': 'error',
141
- 'jsdoc/implements-on-classes': 'error',
142
- 'jsdoc/require-param': 'error',
143
- 'jsdoc/require-param-name': 'error',
144
- 'jsdoc/require-param-type': 'error',
145
- 'jsdoc/require-property': 'error',
146
- 'jsdoc/require-property-description': 'error',
147
- 'jsdoc/require-property-name': 'error',
148
- 'jsdoc/require-property-type': 'error',
149
- 'jsdoc/require-returns-check': 'error',
150
- 'jsdoc/require-returns-description': 'error',
151
- 'jsdoc/require-returns-type': 'error',
152
- 'jsdoc/valid-types': 'error',
153
- },
154
- };
157
+ ];
package/configs/jshint.js CHANGED
@@ -1,17 +1,19 @@
1
- module.exports = {
2
- rules: {
3
- curly: 'error',
4
- eqeqeq: 'error',
5
- 'no-caller': 'error',
6
- 'no-cond-assign': [ 'error', 'except-parens' ],
7
- 'no-eq-null': 'error',
8
- 'no-irregular-whitespace': 'error',
9
- 'no-trailing-spaces': 'error',
10
- 'no-undef': 'error',
11
- 'no-unused-expressions': 'error',
12
- 'no-unused-vars': [ 'error', { ignoreRestSiblings: true } ],
13
- 'one-var': [ 'error', 'always' ],
14
- quotes: [ 'error', 'single' ],
15
- 'wrap-iife': [ 'error', 'any' ],
1
+ module.exports = [
2
+ {
3
+ rules: {
4
+ curly: 'error',
5
+ eqeqeq: 'error',
6
+ 'no-caller': 'error',
7
+ 'no-cond-assign': [ 'error', 'except-parens' ],
8
+ 'no-eq-null': 'error',
9
+ 'no-irregular-whitespace': 'error',
10
+ 'no-trailing-spaces': 'error',
11
+ 'no-undef': 'error',
12
+ 'no-unused-expressions': 'error',
13
+ 'no-unused-vars': [ 'error', { ignoreRestSiblings: true } ],
14
+ 'one-var': [ 'error', 'always' ],
15
+ quotes: [ 'error', 'single' ],
16
+ 'wrap-iife': [ 'error', 'any' ],
17
+ },
16
18
  },
17
- };
19
+ ];
@@ -1,19 +1,25 @@
1
- module.exports = {
2
- extends: [ 'plugin:jsx-a11y/recommended' ],
3
- plugins: [ 'jsx-a11y' ],
4
- rules: {
5
- // False positives with `render` props (e.g. `<Text render={ <h1 /> }>…</Text>`).
6
- // See https://github.com/WordPress/gutenberg/issues/76501
7
- 'jsx-a11y/heading-has-content': 'off',
8
- 'jsx-a11y/label-has-associated-control': [
9
- 'error',
10
- {
11
- assert: 'htmlFor',
12
- },
13
- ],
14
- 'jsx-a11y/media-has-caption': 'off',
15
- 'jsx-a11y/no-noninteractive-tabindex': 'off',
16
- 'jsx-a11y/role-has-required-aria-props': 'off',
17
- 'jsx-quotes': 'error',
1
+ /**
2
+ * External dependencies
3
+ */
4
+ const jsxA11yPlugin = require( 'eslint-plugin-jsx-a11y' );
5
+
6
+ module.exports = [
7
+ jsxA11yPlugin.flatConfigs.recommended,
8
+ {
9
+ rules: {
10
+ // False positives with `render` props (e.g. `<Text render={ <h1 /> }>…</Text>`).
11
+ // See https://github.com/WordPress/gutenberg/issues/76501
12
+ 'jsx-a11y/heading-has-content': 'off',
13
+ 'jsx-a11y/label-has-associated-control': [
14
+ 'error',
15
+ {
16
+ assert: 'htmlFor',
17
+ },
18
+ ],
19
+ 'jsx-a11y/media-has-caption': 'off',
20
+ 'jsx-a11y/no-noninteractive-tabindex': 'off',
21
+ 'jsx-a11y/role-has-required-aria-props': 'off',
22
+ 'jsx-quotes': 'error',
23
+ },
18
24
  },
19
- };
25
+ ];
package/configs/react.js CHANGED
@@ -1,45 +1,74 @@
1
- module.exports = {
2
- extends: [ 'plugin:react/recommended' ],
3
- parserOptions: {
4
- ecmaFeatures: {
5
- jsx: true,
1
+ /**
2
+ * External dependencies
3
+ */
4
+ const { fixupPluginRules } = require( '@eslint/compat' );
5
+ const reactPlugin = require( 'eslint-plugin-react' );
6
+ const reactHooksPlugin = require( 'eslint-plugin-react-hooks' );
7
+
8
+ /**
9
+ * Internal dependencies
10
+ */
11
+ const wpRules = require( '../rules' );
12
+
13
+ const wpPlugin = { rules: wpRules };
14
+
15
+ const fixedReactPlugin = fixupPluginRules( reactPlugin );
16
+
17
+ module.exports = [
18
+ {
19
+ plugins: {
20
+ react: fixedReactPlugin,
6
21
  },
22
+ rules: reactPlugin.configs.flat.recommended.rules,
23
+ languageOptions: reactPlugin.configs.flat.recommended.languageOptions,
7
24
  },
8
- settings: {
9
- react: {
10
- version: 'detect',
25
+ {
26
+ plugins: {
27
+ '@wordpress': wpPlugin,
28
+ 'react-hooks': reactHooksPlugin,
11
29
  },
12
- },
13
- plugins: [ '@wordpress', 'react', 'react-hooks' ],
14
- rules: {
15
- '@wordpress/no-unused-vars-before-return': [
16
- 'error',
17
- {
18
- excludePattern: '^use',
19
- },
20
- ],
21
- 'react/display-name': 'off',
22
- 'react/jsx-curly-spacing': [
23
- 'error',
24
- {
25
- when: 'always',
26
- children: true,
30
+ languageOptions: {
31
+ parserOptions: {
32
+ ecmaFeatures: {
33
+ jsx: true,
34
+ },
27
35
  },
28
- ],
29
- 'react/jsx-equals-spacing': 'error',
30
- 'react/jsx-indent': [ 'error', 'tab' ],
31
- 'react/jsx-indent-props': [ 'error', 'tab' ],
32
- 'react/jsx-key': 'error',
33
- 'react/jsx-tag-spacing': 'error',
34
- 'react/no-children-prop': 'off',
35
- 'react/prop-types': 'off',
36
- 'react/react-in-jsx-scope': 'off',
37
- 'react-hooks/exhaustive-deps': [
38
- 'warn',
39
- {
40
- additionalHooks: '^(useSelect|useSuspenseSelect)$',
36
+ },
37
+ settings: {
38
+ react: {
39
+ version: 'detect',
41
40
  },
42
- ],
43
- 'react-hooks/rules-of-hooks': 'error',
41
+ },
42
+ rules: {
43
+ '@wordpress/no-unused-vars-before-return': [
44
+ 'error',
45
+ {
46
+ excludePattern: '^use',
47
+ },
48
+ ],
49
+ 'react/display-name': 'off',
50
+ 'react/jsx-curly-spacing': [
51
+ 'error',
52
+ {
53
+ when: 'always',
54
+ children: true,
55
+ },
56
+ ],
57
+ 'react/jsx-equals-spacing': 'error',
58
+ 'react/jsx-indent': [ 'error', 'tab' ],
59
+ 'react/jsx-indent-props': [ 'error', 'tab' ],
60
+ 'react/jsx-key': 'error',
61
+ 'react/jsx-tag-spacing': 'error',
62
+ 'react/no-children-prop': 'off',
63
+ 'react/prop-types': 'off',
64
+ 'react/react-in-jsx-scope': 'off',
65
+ 'react-hooks/exhaustive-deps': [
66
+ 'warn',
67
+ {
68
+ additionalHooks: '^(useSelect|useSuspenseSelect)$',
69
+ },
70
+ ],
71
+ 'react-hooks/rules-of-hooks': 'error',
72
+ },
44
73
  },
45
- };
74
+ ];
@@ -1,38 +1,54 @@
1
- const config = {
2
- extends: [
3
- require.resolve( './jsx-a11y.js' ),
4
- require.resolve( './custom.js' ),
5
- require.resolve( './react.js' ),
6
- require.resolve( './esnext.js' ),
7
- require.resolve( './i18n.js' ),
8
- ],
9
- plugins: [ 'import' ],
10
- env: {
11
- node: true,
12
- },
13
- globals: {
14
- window: true,
15
- document: true,
16
- SCRIPT_DEBUG: 'readonly',
17
- wp: 'readonly',
18
- },
19
- settings: {
20
- 'import/extensions': [ '.js', '.jsx' ],
21
- 'import/resolver': {
22
- typescript: true,
1
+ /**
2
+ * External dependencies
3
+ */
4
+ const globals = require( 'globals' );
5
+ const { fixupPluginRules } = require( '@eslint/compat' );
6
+ const importPlugin = fixupPluginRules( require( 'eslint-plugin-import' ) );
7
+
8
+ /**
9
+ * Internal dependencies
10
+ */
11
+ const jsxA11yConfig = require( './jsx-a11y' );
12
+ const customConfig = require( './custom' );
13
+ const reactConfig = require( './react' );
14
+ const esnextConfig = require( './esnext' );
15
+ const i18nConfig = require( './i18n' );
16
+
17
+ module.exports = [
18
+ ...jsxA11yConfig,
19
+ ...customConfig,
20
+ ...reactConfig,
21
+ ...esnextConfig,
22
+ ...i18nConfig,
23
+ {
24
+ plugins: {
25
+ import: importPlugin,
23
26
  },
24
- },
25
- rules: {
26
- 'import/no-extraneous-dependencies': [
27
- 'error',
28
- {
29
- peerDependencies: true,
27
+ languageOptions: {
28
+ globals: {
29
+ ...globals.node,
30
+ window: 'writable',
31
+ document: 'writable',
32
+ SCRIPT_DEBUG: 'readonly',
33
+ wp: 'readonly',
30
34
  },
31
- ],
32
- 'import/no-unresolved': 'error',
33
- 'import/default': 'warn',
34
- 'import/named': 'warn',
35
+ },
36
+ settings: {
37
+ 'import/extensions': [ '.js', '.jsx' ],
38
+ 'import/resolver': {
39
+ typescript: true,
40
+ },
41
+ },
42
+ rules: {
43
+ 'import/no-extraneous-dependencies': [
44
+ 'error',
45
+ {
46
+ peerDependencies: true,
47
+ },
48
+ ],
49
+ 'import/no-unresolved': 'error',
50
+ 'import/default': 'warn',
51
+ 'import/named': 'warn',
52
+ },
35
53
  },
36
- };
37
-
38
- module.exports = config;
54
+ ];
@@ -3,52 +3,63 @@
3
3
  */
4
4
  const { cosmiconfigSync } = require( 'cosmiconfig' );
5
5
 
6
- /**
7
- * WordPress dependencies
8
- */
9
-
10
6
  /**
11
7
  * Internal dependencies
12
8
  */
13
9
  const { isPackageInstalled } = require( '../utils' );
10
+ const recommendedWithFormattingConfig = require( './recommended-with-formatting' );
14
11
 
15
- const config = {
16
- extends: [ require.resolve( './recommended-with-formatting.js' ) ],
17
- };
12
+ const config = [ ...recommendedWithFormattingConfig ];
18
13
 
19
14
  if ( isPackageInstalled( 'prettier' ) ) {
20
- config.extends.push( 'plugin:prettier/recommended' );
15
+ const eslintPluginPrettier = require( 'eslint-plugin-prettier' );
16
+ const eslintConfigPrettier = require( 'eslint-config-prettier' );
21
17
 
22
18
  const { config: localPrettierConfig } =
23
19
  cosmiconfigSync( 'prettier' ).search() || {};
24
20
  const defaultPrettierConfig = require( '@wordpress/prettier-config' );
25
21
  const prettierConfig = { ...defaultPrettierConfig, ...localPrettierConfig };
26
- config.rules = {
27
- 'prettier/prettier': [ 'error', prettierConfig ],
28
- // Prettier _disables_ this rule, but we want it!
29
- // See https://github.com/prettier/eslint-config-prettier?tab=readme-ov-file#curly
30
- // > This rule requires certain options.
31
- // > …
32
- // > If you like this rule, it can be used just fine with Prettier as long as you don’t use the "multi-line" or "multi-or-nest" option.
33
- curly: [ 'error', 'all' ],
34
- };
22
+
23
+ config.push( eslintConfigPrettier, {
24
+ plugins: {
25
+ prettier: eslintPluginPrettier,
26
+ },
27
+ rules: {
28
+ ...eslintConfigPrettier.rules,
29
+ 'prettier/prettier': [ 'error', prettierConfig ],
30
+ // Prettier _disables_ this rule, but we want it!
31
+ // See https://github.com/prettier/eslint-config-prettier?tab=readme-ov-file#curly
32
+ // > This rule requires certain options.
33
+ // > …
34
+ // > If you like this rule, it can be used just fine with Prettier as long as you don't use the "multi-line" or "multi-or-nest" option.
35
+ curly: [ 'error', 'all' ],
36
+ },
37
+ } );
35
38
  }
36
39
 
37
40
  if ( isPackageInstalled( 'typescript' ) ) {
38
- config.settings = {
39
- 'import/resolver': {
40
- typescript: {
41
- extensions: [ '.js', '.jsx', '.ts', '.tsx' ],
41
+ const tseslint = require( 'typescript-eslint' );
42
+
43
+ config.push(
44
+ tseslint.configs.eslintRecommended,
45
+ {
46
+ settings: {
47
+ 'import/resolver': {
48
+ typescript: {
49
+ extensions: [ '.js', '.jsx', '.ts', '.tsx' ],
50
+ },
51
+ },
42
52
  },
53
+ ignores: [ '**/*.d.ts' ],
43
54
  },
44
- };
45
- config.extends.push( 'plugin:@typescript-eslint/eslint-recommended' );
46
- config.ignorePatterns = [ '**/*.d.ts' ];
47
- config.plugins = [ '@typescript-eslint' ];
48
- config.overrides = [
49
55
  {
50
56
  files: [ '**/*.ts', '**/*.tsx' ],
51
- parser: '@typescript-eslint/parser',
57
+ languageOptions: {
58
+ parser: tseslint.parser,
59
+ },
60
+ plugins: {
61
+ '@typescript-eslint': tseslint.plugin,
62
+ },
52
63
  rules: {
53
64
  'no-duplicate-imports': 'off',
54
65
  'import/no-duplicates': 'error',
@@ -75,8 +86,8 @@ if ( isPackageInstalled( 'typescript' ) ) {
75
86
  'import/default': 'off',
76
87
  'import/named': 'off',
77
88
  },
78
- },
79
- ];
89
+ }
90
+ );
80
91
  }
81
92
 
82
93
  module.exports = config;
@@ -1,11 +1,19 @@
1
- module.exports = {
2
- extends: [ 'plugin:jest/recommended' ],
3
- env: {
4
- browser: true,
1
+ /**
2
+ * External dependencies
3
+ */
4
+ const globals = require( 'globals' );
5
+ const jestPlugin = require( 'eslint-plugin-jest' );
6
+
7
+ module.exports = [
8
+ jestPlugin.configs[ 'flat/recommended' ],
9
+ {
10
+ languageOptions: {
11
+ globals: {
12
+ ...globals.browser,
13
+ browser: 'readonly',
14
+ page: 'readonly',
15
+ wp: 'readonly',
16
+ },
17
+ },
5
18
  },
6
- globals: {
7
- browser: 'readonly',
8
- page: 'readonly',
9
- wp: 'readonly',
10
- },
11
- };
19
+ ];
@@ -1,3 +1,6 @@
1
- module.exports = {
2
- extends: [ 'plugin:playwright/recommended' ],
3
- };
1
+ /**
2
+ * External dependencies
3
+ */
4
+ const playwrightPlugin = require( 'eslint-plugin-playwright' );
5
+
6
+ module.exports = [ playwrightPlugin.configs[ 'flat/recommended' ] ];
@@ -1,9 +1,16 @@
1
- module.exports = {
2
- extends: [ 'plugin:jest/recommended' ],
3
- rules: {
4
- 'jest/expect-expect': [
5
- 'error',
6
- { assertFunctionNames: [ 'expect', 'measurePerformance' ] },
7
- ],
1
+ /**
2
+ * External dependencies
3
+ */
4
+ const jestPlugin = require( 'eslint-plugin-jest' );
5
+
6
+ module.exports = [
7
+ jestPlugin.configs[ 'flat/recommended' ],
8
+ {
9
+ rules: {
10
+ 'jest/expect-expect': [
11
+ 'error',
12
+ { assertFunctionNames: [ 'expect', 'measurePerformance' ] },
13
+ ],
14
+ },
8
15
  },
9
- };
16
+ ];