-
Notifications
You must be signed in to change notification settings - Fork 153
Expand file tree
/
Copy patheslint.config.js
More file actions
70 lines (67 loc) · 1.64 KB
/
eslint.config.js
File metadata and controls
70 lines (67 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/**
* ESLint flat config.
*
* Extends the shared configuration shipped with `@wordpress/scripts` (which is
* based on the WordPress coding standards) and layers the project-specific
* tweaks on top.
*/
/**
* External dependencies
*/
const globals = require( 'globals' );
// @ts-ignore -- No declaration file for this module.
const wpScriptsConfig = require( '@wordpress/scripts/config/eslint.config.cjs' );
// Build tooling, CLI scripts, and root-level config files — Node CommonJS,
// not browser code. Used both to exclude these from the browser-globals block
// and as the target of the dedicated Node tooling override below.
const nodeToolingFiles = [
'bin/**/*.js',
'tools/**/*.js',
'*.config.js',
'.*.js',
];
module.exports = [
...wpScriptsConfig,
{
// Ignore patterns in addition to those provided by @wordpress/scripts.
ignores: [ 'dist/', '**/*.min.js' ],
},
{
// Browser globals for client-side scripts (everything but the Node tooling below).
files: [ '**/*.js' ],
ignores: nodeToolingFiles,
languageOptions: {
globals: {
...globals.browser,
},
},
},
{
// Node-based build tooling and CLI scripts (CommonJS).
files: nodeToolingFiles,
languageOptions: {
sourceType: 'commonjs',
globals: {
...globals.node,
},
},
rules: {
'no-console': 'off',
},
},
{
files: [ '**/*.js' ],
rules: {
'jsdoc/valid-types': 'off',
'import/no-unresolved': [
'error',
{
// `@octokit/rest` is an ESM-only package referenced solely from
// JSDoc `@typedef` imports in `bin/plugin`, which the import
// resolver cannot follow.
ignore: [ '@octokit/rest' ],
},
],
},
},
];