gulp-eslint-new 1.9.0 → 2.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.
package/README.md CHANGED
@@ -1,11 +1,12 @@
1
1
  # gulp-eslint-new · [![npm version][npm badge]][npm URL]
2
2
 
3
- > A [gulp](https://gulpjs.com/) plugin to lint code with [ESLint](https://eslint.org/) 8
3
+ > A [gulp](https://gulpjs.com/) plugin to lint code with [ESLint](https://eslint.org/) 8 and 9.
4
4
 
5
5
  ## Installation
6
6
 
7
- Make sure that you are using a version of Node.js [supported by ESLint 8](https://eslint.org/docs/user-guide/getting-started#prerequisites).
8
- For TypeScript support, you need TypeScript 4.2 or later.
7
+ Make sure that you are using a version of Node.js supported by your version of ESLint.
8
+ See prerequisites for [ESLint 8](https://eslint.org/docs/v8.x/use/getting-started#prerequisites) and [ESLint 9](https://eslint.org/docs/latest/use/getting-started#prerequisites).
9
+ For TypeScript support, you need TypeScript 4.6 or later.
9
10
 
10
11
  To install gulp-eslint-new, [use](https://docs.npmjs.com/cli/install) [npm](https://docs.npmjs.com/about-npm):
11
12
 
@@ -13,8 +14,8 @@ To install gulp-eslint-new, [use](https://docs.npmjs.com/cli/install) [npm](http
13
14
  npm i -D gulp-eslint-new
14
15
  ```
15
16
 
16
- gulp-eslint-new will also install the latest version of ESLint 8, unless another one is found.
17
- To use a particular version of ESLint 8, install it by yourself.
17
+ gulp-eslint-new will also install the latest version of ESLint 9, unless another one is found.
18
+ To use a particular version of ESLint, install it by yourself.
18
19
  For example, to use ESLint 8.8.0:
19
20
 
20
21
  ```console
@@ -23,13 +24,15 @@ npm i -D gulp-eslint-new eslint@8.8.0
23
24
 
24
25
  ## Migrating
25
26
 
26
- If you are migrating from [gulp-eslint][gulp-eslint], you probably won't need to change any settings in your gulp task.
27
- gulp-eslint-new can handle most of the options used with gulp-eslint, although some of them are now deprecated in favor of a new name or format.
27
+ If you are migrating from [gulp-eslint][gulp-eslint], you probably won't need to make any substantial changes to your gulp task, as the API is widely compatible.
28
+ Note though that many options have changed: the current options are documented in the [`gulpESLintNew(options)`](#gulpeslintnewoptions) section.
28
29
 
29
- Anyway, since gulp-eslint-new uses ESLint 8 while gulp-eslint sticks to ESLint 6, you may need to make some changes to your project to address incompatibilities between the versions of ESLint.
30
- You can find more information at the links below.
30
+ Also note that gulp-eslint-new is designed to work with ESLint 8 or 9, whereas the latest release of gulp-eslint only supports ESLint 6: you will need to update your project to address breaking changes in ESLint.
31
+ You can follow the links below for more information.
31
32
  * [Breaking changes for users from ESLint 6 to ESLint 7](https://eslint.org/docs/user-guide/migrating-to-7.0.0#breaking-changes-for-users)
32
- * [Breaking changes for users from ESLint 7 to ESLint 8](https://eslint.org/docs/user-guide/migrating-to-8.0.0#breaking-changes-for-users)
33
+ * [Breaking changes for users from ESLint 7 to ESLint 8](https://eslint.org/docs/user-guide/migrate-to-8.0.0#breaking-changes-for-users)
34
+ * [Breaking changes for users from ESLint 8 to ESLint 9](https://eslint.org/docs/user-guide/migrate-to-9.0.0#breaking-changes-for-users)
35
+
33
36
 
34
37
  ## Usage
35
38
 
@@ -102,10 +105,12 @@ See the linked content for details about each option.
102
105
  * [`overrideConfig`][linting options]
103
106
  * [`overrideConfigFile`][linting options]
104
107
  * [`plugins`][linting options]
105
- * [`reportUnusedDisableDirectives`][linting options]
106
- * [`resolvePluginsRelativeTo`][linting options] (not in flat config)
107
- * [`rulePaths`][linting options] (not in flat config)
108
- * [`useEslintrc`][linting options] (not in flat config)
108
+ * [`reportUnusedDisableDirectives`][legacy linting options] (not in flat config)
109
+ * [`resolvePluginsRelativeTo`][legacy linting options] (not in flat config)
110
+ * [`ruleFilter`][linting options] (flat config only)
111
+ * [`rulePaths`][legacy linting options] (not in flat config)
112
+ * [`stats`][linting options] (flat config only)
113
+ * [`useEslintrc`][legacy linting options] (not in flat config)
109
114
 
110
115
  **Autofix options**
111
116
  * [`fix`](#optionsfix)
@@ -121,14 +126,16 @@ See the linked content for details about each option.
121
126
 
122
127
  Type: `"eslintrc" | "flat" | null`
123
128
 
124
- Newer versions of ESLint introduce a [new type of configuration](https://eslint.org/docs/user-guide/configuring/configuration-files-new) based on file `eslint.config.js`.
125
- Starting with gulp-eslint-new 1.7 it is possible to use the new configuration by setting the option `configType` to `"flat"`.
129
+ ESLint supports two types of configuration: a [new config](https://eslint.org/docs/user-guide/configure/configuration-files) type, aka flat config, based on file `eslint.config.*`, and a [legacy config](https://eslint.org/docs/user-guide/configure/configuration-files-deprecated) type, or eslintrc config, based on file `.eslintrc`.
130
+
131
+ In ESLint 8, the default config type is the legacy config, and the new config is partly supported depending on the version of ESLint used.
132
+ To use the the new config with ESLint 8 in gulp-eslint-new, set the option `configType` to `"flat"`.
126
133
 
127
- When using the new configuration, the options `ignorePath`, `resolvePluginsRelativeTo`, `rulePaths` and `useEslintrc` are no longer supported.
128
- Support for the option `reportUnusedDisableDirectives` is removed in ESLint 8.56.
129
- [Legacy options](#legacy-options) are not supported either and will not be mapped to new options.
130
- Also, `ignorePatterns` is supported as a new top-level option, while other options like `baseConfig`, `overrideConfig` and `overrideConfigFile` accept different values.
131
- Refer to [the official documentation](https://eslint.org/docs/user-guide/configuring/configuration-files-new) for a description of all differences from the standard configuration.
134
+ ESLint 9 uses the new config type by default.
135
+ To use the legacy config with ESLint 9 in gulp-eslint-new, set the option `configType` to `"eslintrc"`.
136
+
137
+ The new and legacy config types differ significantly in the available options and their usage.
138
+ Refer to the respective documentation in ESLint for the specifics of each options.
132
139
 
133
140
  ##### `options.cwd`
134
141
 
@@ -187,7 +194,7 @@ Type: `boolean`
187
194
 
188
195
  When `true`, this option will filter warning messages from ESLint results. This mimics the ESLint CLI [`--quiet` option](https://eslint.org/docs/user-guide/command-line-interface#--quiet).
189
196
 
190
- Type: `(message: string, index: number, list: Object[]) => unknown`
197
+ Type: `(message: LintMessage, index: number, list: LintMessage[]) => unknown`
191
198
 
192
199
  When a function is provided, it will be used to filter ESLint result messages, removing any messages that do not return a `true` (or truthy) value.
193
200
 
@@ -200,28 +207,6 @@ When `true`, add a result warning when ESLint ignores a file. Default is `false`
200
207
  This can be used to find files that are needlessly being loaded by `gulp.src`.
201
208
  For example, since ESLint automatically ignores file paths inside a `node_modules` directory but `gulp.src` does not, a gulp task may take seconds longer just reading files from `node_modules`.
202
209
 
203
- #### Legacy Options
204
-
205
- The following legacy options are provided for backward compatibility with [gulp-eslint][gulp-eslint].
206
- Some of them used to be available as top-level options previously, but in current versions of ESLint, they must be specified as child properties of a `baseConfig` or `overrideConfig` object.
207
- When `gulpESLintNew` is passed any legacy options, it will map them automatically as shown in the table to match the new conventions.
208
-
209
- | Legacy option | Migrated to | Notes |
210
- |-------------------|---------------------------------|-|
211
- | `configFile` | `overrideConfigFile` | New option name. |
212
- | `envs` | `overrideConfig.env` | New option name and format. `overrideConfig.env` should be an object as explained in the [documentation](https://eslint.org/docs/user-guide/configuring/language-options#specifying-environments). |
213
- | `extends` | `overrideConfig.extends` | |
214
- | `globals` | `overrideConfig.globals` | The new option format requires `overrideConfig.globals` to be an object as explained in the [documentation](https://eslint.org/docs/user-guide/configuring/language-options#specifying-globals). |
215
- | `ignorePattern` | `overrideConfig.ignorePatterns` | New option name. |
216
- | `parser` | `overrideConfig.parser` | |
217
- | `parserOptions` | `overrideConfig.parserOptions` | |
218
- | `plugins` | `overrideConfig.plugins` | `plugins` as an array of strings is migrated to `overrideConfig.plugins`. By contrast, `plugins` as an object that maps strings to plugin implementations has different semantics and is not migrated. |
219
- | `rules` | `overrideConfig.rules` | |
220
- | `warnFileIgnored` | `warnIgnored` | New option name. |
221
-
222
- If any legacy options are used, `gulpESLintNew` will print a warning.
223
- To remove the warning, replace the legacy options used in your gulp task with the new options.
224
-
225
210
  ### `gulpESLintNew(overrideConfigFile)`
226
211
 
227
212
  Param type: `string`
@@ -444,6 +429,7 @@ This is available to streams that follow the initial gulp-eslint-new stream.
444
429
  The functions [`gulpESLintNew.result`](#gulpeslintnewresultaction) and [`gulpESLintNew.results`](#gulpeslintnewresultsaction) are made available to support extensions and custom handling of ESLint results.
445
430
 
446
431
  [gulp-eslint]: https://github.com/adametry/gulp-eslint
447
- [linting options]: https://eslint.org/docs/developer-guide/nodejs-api#linting
432
+ [legacy linting options]: https://eslint.org/docs/v8.x/integrate/nodejs-api#linting
433
+ [linting options]: https://eslint.org/docs/latest/integrate/nodejs-api#linting
448
434
  [npm badge]: https://img.shields.io/npm/v/gulp-eslint-new?logo=npm
449
435
  [npm URL]: https://www.npmjs.com/package/gulp-eslint-new
package/lib/eslint.d.ts CHANGED
@@ -61,3 +61,5 @@ interface ResultsMeta
61
61
  maxWarnings: number;
62
62
  };
63
63
  }
64
+
65
+ type Severity = Linter.Severity;
@@ -4,7 +4,6 @@ import type { TransformCallback } from 'stream';
4
4
 
5
5
  type Awaitable<T = unknown> = T | Promise<T>;
6
6
 
7
- type ConfigData = eslint.ConfigData;
8
7
  type FlatConfig = eslint.FlatConfig;
9
8
  type ESLintOptions = eslint.ESLintOptions;
10
9
  type LintMessage = eslint.LintMessage;
@@ -142,54 +141,13 @@ declare namespace gulpESLintNew
142
141
  | 'errorOnUnmatchedPattern'
143
142
  | 'extensions'
144
143
  | 'globInputPaths'
145
- | 'plugins'
146
144
  > &
147
145
  {
148
- /** @deprecated Use `overrideConfigFile` instead. */
149
- configFile?: ESLintOptions['overrideConfigFile'];
150
-
151
- /**
152
- * @deprecated
153
- * Use `overrideConfig.env` or `baseConfig.env` instead.
154
- * Note the different option name and format.
155
- */
156
- envs?: string[] | undefined;
157
-
158
- /** @deprecated Use `overrideConfig.extends` or `baseConfig.extends` instead. */
159
- extends?: ConfigData['extends'];
160
-
161
- /**
162
- * @deprecated
163
- * Use `overrideConfig.globals` or `baseConfig.globals` instead. Note the different format.
164
- */
165
- globals?: string[] | undefined;
166
-
167
- /**
168
- * @deprecated
169
- * Use `overrideConfig.ignorePatterns` or `baseConfig.ignorePatterns` instead.
170
- * Note the different option name.
171
- */
172
- ignorePattern?: ConfigData['ignorePatterns'];
173
-
174
- /** @deprecated Use `overrideConfig.parser` or `baseConfig.parser` instead. */
175
- parser?: ConfigData['parser'];
176
-
177
- /** @deprecated Use `overrideConfig.parserOptions` or `baseConfig.parserOptions` instead. */
178
- parserOptions?: ConfigData['parserOptions'];
179
-
180
- plugins?: ESLintOptions['plugins'] | ConfigData['plugins'];
181
-
182
146
  quiet?:
183
147
  | boolean
184
148
  | ((message: LintMessage, index: number, list: LintMessage[]) => unknown)
185
149
  | undefined;
186
150
 
187
- /** @deprecated Use `overrideConfig.rules` or `baseConfig.rules` instead. */
188
- rules?: ConfigData['rules'];
189
-
190
- /** @deprecated Use `warnIgnored` instead. */
191
- warnFileIgnored?: boolean | undefined;
192
-
193
151
  warnIgnored?: boolean | undefined;
194
152
  };
195
153
 
@@ -218,12 +176,18 @@ declare namespace gulpESLintNew
218
176
  | ((message: LintMessage, index: number, list: LintMessage[]) => unknown)
219
177
  | undefined;
220
178
 
179
+ ruleFilter?: ((rule: { ruleId: string; severity: Severity; }) => unknown) | undefined;
180
+
181
+ stats?: boolean | undefined;
182
+
221
183
  warnIgnored?: boolean | undefined;
222
184
  };
223
185
 
224
186
  type LoadedFormatter = eslint.LoadedFormatter;
225
187
 
226
188
  type ResultsMeta = eslint.ResultsMeta;
189
+
190
+ type Severity = eslint.Severity;
227
191
  }
228
192
 
229
193
  declare const gulpESLintNew: gulpESLintNew.GulpESLintNew;
@@ -85,14 +85,6 @@ const warn =
85
85
  (message, gulpWarn = require('fancy-log').warn) =>
86
86
  gulpWarn(`\x1b[1;37m\x1b[40mgulp-eslint-new\x1b[0m \x1b[30m\x1b[43mWARN\x1b[0m\n${message}`);
87
87
 
88
- function formatMigratedOptionWarningLine({ oldName, newName, formatChanged })
89
- {
90
- let line = ` • ${oldName} → ${newName}`;
91
- if (formatChanged)
92
- line += ' (format changed)';
93
- return line;
94
- }
95
-
96
88
  async function lintFile(eslintInfo, file, quiet, warnIgnored)
97
89
  {
98
90
  if (file.isNull())
@@ -106,9 +98,6 @@ async function lintFile(eslintInfo, file, quiet, warnIgnored)
106
98
  let result;
107
99
  if (await eslint.isPathIgnored(filePath))
108
100
  {
109
- // Note: ESLint doesn't adjust file paths relative to an ancestory .eslintignore path.
110
- // E.g., If ../.eslintignore has "foo/*.js", ESLint will ignore ./foo/*.js, instead of
111
- // ../foo/*.js.
112
101
  if (!warnIgnored)
113
102
  return;
114
103
  // Warn that gulp.src is needlessly reading files that ESLint ignores.
@@ -139,24 +128,7 @@ async function lintFile(eslintInfo, file, quiet, warnIgnored)
139
128
  module.exports = exports =
140
129
  options =>
141
130
  {
142
- const { ESLint, eslintOptions, gulpWarn, migratedOptions, quiet, warnIgnored } =
143
- organizeOptions(options);
144
- {
145
- const migratedOptionCount = migratedOptions.length;
146
- if (migratedOptionCount)
147
- {
148
- const migratedOptionWarningText =
149
- migratedOptions.map(formatMigratedOptionWarningLine).join('\n');
150
- const messageIntro =
151
- migratedOptionCount > 1 ?
152
- 'The following top-level options passed to gulpESLintNew() have been migrated' :
153
- 'The following top-level option passed to gulpESLintNew() has been migrated';
154
- const message =
155
- `${messageIntro}:\n${migratedOptionWarningText}\nSee ${makeNPMLink('legacy-options')
156
- } for more information.`;
157
- warn(message, gulpWarn);
158
- }
159
- }
131
+ const { ESLint, eslintOptions, quiet, warnIgnored } = organizeOptions(options);
160
132
  const eslint = new ESLint(eslintOptions);
161
133
  const { cwd, fix } = eslintOptions;
162
134
  const eslintInfo = { cwd, eslint, fix };
package/lib/util.js CHANGED
@@ -19,7 +19,7 @@
19
19
  const { normalize, relative } = require('path');
20
20
  const { Transform } = require('stream');
21
21
 
22
- const ESLINT_KEY = Symbol('ESLint');
22
+ const ESLINT_PKG = Symbol('ESLint package name');
23
23
  const GULP_DEST_KEY = Symbol('require("vinyl-fs").dest');
24
24
  const GULP_WARN_KEY = Symbol('require("fancy-log").warn');
25
25
 
@@ -58,6 +58,13 @@ const hasOwn = Function.prototype.call.bind(Object.prototype.hasOwnProperty);
58
58
  */
59
59
  const isErrorMessage = ({ severity }) => severity > 1;
60
60
 
61
+ function isEslintrcESLintConstructor({ name, version })
62
+ {
63
+ const { satisfies } = require('semver');
64
+
65
+ return name === 'ESLint' === satisfies(version, '8');
66
+ }
67
+
61
68
  /**
62
69
  * Determine if a message is a fatal error.
63
70
  *
@@ -92,7 +99,7 @@ const isObject = value => Object(value) === value;
92
99
  */
93
100
  const isWarningMessage = ({ severity }) => severity === 1;
94
101
 
95
- exports.ESLINT_KEY = ESLINT_KEY;
102
+ exports.ESLINT_PKG = ESLINT_PKG;
96
103
  exports.GULP_DEST_KEY = GULP_DEST_KEY;
97
104
  exports.GULP_WARN_KEY = GULP_WARN_KEY;
98
105
 
@@ -111,12 +118,13 @@ const isInNodeModulesRegExp = /(?<![^/\\])node_modules[/\\]/u;
111
118
  * @returns {LintResult} Result with warning by ignore settings.
112
119
  */
113
120
  exports.createIgnoreResult =
114
- (filePath, baseDir, { name: eslintName, version: eslintVersion }) =>
121
+ (filePath, baseDir, eslintConstructor) =>
115
122
  {
116
123
  const { ltr } = require('semver');
117
124
  let message;
125
+ const useEslintrcConfig = isEslintrcESLintConstructor(eslintConstructor);
118
126
  const relativePath = relative(baseDir, filePath);
119
- const useEslintrcConfig = eslintName === 'ESLint';
127
+ const eslintVersion = eslintConstructor.version;
120
128
  if (useEslintrcConfig && isHiddenRegExp.test(relativePath))
121
129
  {
122
130
  message =
@@ -264,22 +272,27 @@ const FORBIDDEN_OPTIONS =
264
272
  'errorOnUnmatchedPattern',
265
273
  'extensions',
266
274
  'globInputPaths',
275
+ 'passOnNoPatterns',
267
276
  ];
268
277
 
269
- const requireESLint = (ESLint = require('eslint').ESLint) => ESLint;
278
+ const requireESLint = eslintPkg => require(eslintPkg).ESLint;
270
279
 
271
- function requireFlatESLint(ESLint = require('eslint/use-at-your-own-risk').FlatESLint)
280
+ function requireFlatESLint(eslintPkg)
272
281
  {
273
- if (ESLint == null)
282
+ const { FlatESLint } = require(`${eslintPkg}/use-at-your-own-risk`);
283
+ if (FlatESLint == null)
274
284
  {
275
285
  const message =
276
286
  'The version of ESLint you are using does not support flat config. ' +
277
287
  'To use flat config, upgrade to ESLint 8.21 or later.';
278
288
  throw Error(message);
279
289
  }
280
- return ESLint;
290
+ return FlatESLint;
281
291
  }
282
292
 
293
+ const requireEslintrcESLint =
294
+ eslintPkg => require(`${eslintPkg}/use-at-your-own-risk`).LegacyESLint || require(eslintPkg).ESLint;
295
+
283
296
  /**
284
297
  * Throws an error about invalid options passed to gulp-eslint-new.
285
298
  *
@@ -294,37 +307,8 @@ function throwInvalidOptionError(message)
294
307
  throw error;
295
308
  }
296
309
 
297
- // Adapted from https://github.com/eslint/eslint/blob/v6.8.0/lib/cli-engine/cli-engine.js#L455-L480.
298
- /**
299
- * Convert a string array to a boolean map.
300
- *
301
- * @param {string[] | null} strs - The strings to be mapped.
302
- * @param {boolean} defaultValue - The default value for each property.
303
- * @param {string} displayName - The property name which is used in error message.
304
- * @returns {Object.<string, boolean> | undefined} A boolean map or `undefined`.
305
- */
306
- function toBooleanMap(keys, defaultValue, displayName)
307
- {
308
- if (keys && !Array.isArray(keys))
309
- throwInvalidOptionError(`Option ${displayName} must be an array`);
310
- if (keys && keys.length > 0)
311
- {
312
- return keys.reduce
313
- (
314
- (map, def) =>
315
- {
316
- const [key, value] = def.split(':');
317
- if (key !== '__proto__')
318
- map[key] = value === undefined ? defaultValue : value === 'true';
319
- return map;
320
- },
321
- { },
322
- );
323
- }
324
- }
325
-
326
310
  /**
327
- * Organize, migrate and partially validate the options passed to gulp-eslint-new.
311
+ * Organize and partially validate the options passed to gulp-eslint-new.
328
312
  *
329
313
  * @param {Object.<string | symbol, unknown>} [options] - Options to organize.
330
314
  * @returns {OrganizedOptions} Organized options.
@@ -332,22 +316,18 @@ function toBooleanMap(keys, defaultValue, displayName)
332
316
  * @typedef {Object} OrganizedOptions
333
317
  * @property {Function} [ESLint]
334
318
  * @property {Object.<string, unknown>} eslintOptions
335
- * @property {Function} [gulpWarn]
336
- * @property {Object[]} migratedOptions
337
319
  * @property {boolean | Function} [quiet]
338
320
  * @property {boolean} [warnIgnored]
339
321
  */
340
322
  exports.organizeOptions =
341
323
  (options = { }) =>
342
324
  {
343
- const migratedOptions = [];
344
325
  if (typeof options === 'string')
345
326
  {
346
327
  const organizedOptions =
347
328
  {
348
- ESLint: requireESLint(),
329
+ ESLint: requireESLint('eslint'),
349
330
  eslintOptions: { cwd: process.cwd(), overrideConfigFile: options },
350
- migratedOptions,
351
331
  };
352
332
  return organizedOptions;
353
333
  }
@@ -357,14 +337,7 @@ exports.organizeOptions =
357
337
  throwInvalidOptionError(`Invalid options: ${invalidOptions.join(', ')}`);
358
338
  }
359
339
  const
360
- {
361
- [ESLINT_KEY]: rawESLint,
362
- [GULP_WARN_KEY]: gulpWarn,
363
- configType,
364
- quiet,
365
- warnIgnored,
366
- ...eslintOptions
367
- } =
340
+ { [ESLINT_PKG]: eslintPkg = 'eslint', configType, quiet, warnIgnored, ...eslintOptions } =
368
341
  options;
369
342
  if (configType != null && configType !== 'eslintrc' && configType !== 'flat')
370
343
  throw Error('Option configType must be one of "eslintrc", "flat", null, or undefined');
@@ -378,78 +351,26 @@ exports.organizeOptions =
378
351
  if (type !== 'boolean' && type !== 'undefined')
379
352
  throw Error('Option warnIgnored must be a boolean or undefined');
380
353
  }
381
- const useEslintrcConfig = configType !== 'flat';
382
- const ESLint = (useEslintrcConfig ? requireESLint : requireFlatESLint)(rawESLint);
383
- const organizedOptions =
384
- { ESLint, eslintOptions, gulpWarn, migratedOptions, quiet, warnIgnored };
354
+ let requireFn;
355
+ switch (configType)
356
+ {
357
+ default:
358
+ requireFn = requireESLint;
359
+ break;
360
+ case 'eslintrc':
361
+ requireFn = requireEslintrcESLint;
362
+ break;
363
+ case 'flat':
364
+ requireFn = requireFlatESLint;
365
+ break;
366
+ }
367
+ const ESLint = requireFn(eslintPkg);
368
+ const organizedOptions = { ESLint, eslintOptions, quiet, warnIgnored };
385
369
  {
386
370
  const { cwd } = eslintOptions;
387
371
  eslintOptions.cwd =
388
372
  cwd === undefined ? process.cwd() : typeof cwd === 'string' ? normalize(cwd) : cwd;
389
373
  }
390
- if (useEslintrcConfig)
391
- {
392
- {
393
- const type = typeof eslintOptions.warnFileIgnored;
394
- if (type !== 'boolean' && type !== 'undefined')
395
- throw Error('Option warnFileIgnored must be a boolean or undefined');
396
- }
397
- let { overrideConfig } = eslintOptions;
398
- if (overrideConfig == null)
399
- overrideConfig = { };
400
- if (typeof overrideConfig === 'object')
401
- overrideConfig = eslintOptions.overrideConfig = { ...overrideConfig };
402
- else
403
- overrideConfig = { };
404
- const migrateOption =
405
- function
406
- (
407
- oldName,
408
- newName = oldName,
409
- newOptions = overrideConfig,
410
- needsMigration = hasOwn(eslintOptions, oldName),
411
- convert,
412
- )
413
- {
414
- if (needsMigration)
415
- {
416
- const value = eslintOptions[oldName];
417
- delete eslintOptions[oldName];
418
- {
419
- const newDisplayName =
420
- newOptions === overrideConfig ? `overrideConfig.${newName}` : newName;
421
- const formatChanged = convert != null;
422
- const migratedOption = { oldName, newName: newDisplayName, formatChanged };
423
- migratedOptions.push(migratedOption);
424
- }
425
- newOptions[newName] = convert != null ? convert(value) : value;
426
- }
427
- };
428
- migrateOption('configFile', 'overrideConfigFile', eslintOptions);
429
- migrateOption
430
- (
431
- 'envs',
432
- 'env',
433
- undefined,
434
- undefined,
435
- envs => toBooleanMap(envs, true, 'envs'),
436
- );
437
- migrateOption('extends');
438
- migrateOption
439
- (
440
- 'globals',
441
- undefined,
442
- undefined,
443
- undefined,
444
- globals => toBooleanMap(globals, false, 'globals'),
445
- );
446
- migrateOption('ignorePattern', 'ignorePatterns');
447
- migrateOption('parser');
448
- migrateOption('parserOptions');
449
- migrateOption('plugins', undefined, undefined, Array.isArray(eslintOptions.plugins));
450
- migrateOption('rules');
451
- migrateOption('warnFileIgnored', 'warnIgnored', organizedOptions);
452
- }
453
374
  return organizedOptions;
454
375
  };
455
376
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "gulp-eslint-new",
3
- "version": "1.9.0",
4
- "description": "A gulp plugin to lint code with ESLint 8",
3
+ "version": "2.0.0",
4
+ "description": "A gulp plugin to lint code with ESLint 8 and 9.",
5
5
  "keywords": [
6
6
  "gulpplugin",
7
7
  "eslint",
@@ -18,7 +18,6 @@
18
18
  "lint",
19
19
  "plugin"
20
20
  ],
21
- "homepage": "https://github.com/origin-1/gulp-eslint-new#readme",
22
21
  "license": "MIT",
23
22
  "author": "Adametry",
24
23
  "files": [
@@ -39,35 +38,35 @@
39
38
  "lint": "eslint . --format compact",
40
39
  "test": "mocha --check-leaks test/*.spec.js",
41
40
  "ts-test": "tsc --project test/tsconfig.json",
42
- "version": "git add changelog.md"
41
+ "version": "git add CHANGELOG.md"
43
42
  },
44
43
  "dependencies": {
45
- "@types/eslint": "^8.44.9",
44
+ "@types/eslint": "^8.56.7",
46
45
  "@types/node": ">=12",
47
- "eslint": "8",
46
+ "eslint": "8 || 9",
48
47
  "fancy-log": "^2.0.0",
49
48
  "plugin-error": "^2.0.1",
50
- "semver": "^7.5.4",
49
+ "semver": "^7.6.0",
51
50
  "ternary-stream": "^3.0.0",
52
51
  "vinyl-fs": "^4.0.0"
53
52
  },
54
53
  "devDependencies": {
55
- "@eslint/eslintrc": "^2.1.4",
56
- "@eslint/js": "^8.56.0",
57
- "@origin-1/eslint-config": "^0.19.0",
58
- "c8js": "^0.6.0",
54
+ "@eslint/js": "^8.57.0",
55
+ "@origin-1/eslint-config": "^0.23.0",
56
+ "c8js": "^0.6.2",
59
57
  "eslint-8.0": "npm:eslint@8.0",
60
58
  "eslint-8.21": "npm:eslint@8.21",
61
59
  "eslint-8.x": "npm:eslint@8.x",
60
+ "eslint-9.x": "npm:eslint@9.x",
62
61
  "eslint-config-~shareable": "file:test/config",
63
62
  "eslint-formatter-~formatter": "file:test/formatter",
64
- "eslint-plugin-eslint-comments": "^3.2.0",
65
63
  "eslint-plugin-tsdoc": "^0.2.17",
66
- "gulp": "^4.0.2",
64
+ "globals": "^15.0.0",
65
+ "gulp": "^5.0.0",
67
66
  "mocha": "^9.2.2",
68
- "typescript": "~5.0.4",
69
- "typescript_4.2": "npm:typescript@4.2",
70
- "typescript_5": "npm:typescript@^5.3.3",
67
+ "typescript": "~5.4.4",
68
+ "typescript_4.6": "npm:typescript@4.6",
69
+ "typescript_5": "npm:typescript@5",
71
70
  "vinyl": "^3.0.0"
72
71
  },
73
72
  "engines": {