xo 0.59.0 → 0.59.1

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.
@@ -348,58 +348,58 @@ const buildXOConfig = options => config => {
348
348
  for (const [rule, ruleConfig] of Object.entries(ENGINE_RULES)) {
349
349
  for (const minVersion of Object.keys(ruleConfig).sort(semver.rcompare)) {
350
350
  if (!options.nodeVersion || semver.intersects(options.nodeVersion, `<${minVersion}`)) {
351
- config.baseConfig.rules[rule] = ruleConfig[minVersion];
351
+ config.baseConfig.rules[rule] ??= ruleConfig[minVersion];
352
352
  }
353
353
  }
354
354
  }
355
355
 
356
356
  if (options.nodeVersion) {
357
- config.baseConfig.rules['n/no-unsupported-features/es-builtins'] = ['error', {version: options.nodeVersion}];
358
- config.baseConfig.rules['n/no-unsupported-features/es-syntax'] = ['error', {version: options.nodeVersion, ignores: ['modules']}];
359
- config.baseConfig.rules['n/no-unsupported-features/node-builtins'] = ['error', {version: options.nodeVersion}];
357
+ config.baseConfig.rules['n/no-unsupported-features/es-builtins'] ??= ['error', {version: options.nodeVersion}];
358
+ config.baseConfig.rules['n/no-unsupported-features/es-syntax'] ??= ['error', {version: options.nodeVersion, ignores: ['modules']}];
359
+ config.baseConfig.rules['n/no-unsupported-features/node-builtins'] ??= ['error', {version: options.nodeVersion}];
360
360
  }
361
361
 
362
362
  if (options.space && !options.prettier) {
363
363
  if (options.ts) {
364
- config.baseConfig.rules['@typescript-eslint/indent'] = ['error', spaces, {SwitchCase: 1}];
364
+ config.baseConfig.rules['@typescript-eslint/indent'] ??= ['error', spaces, {SwitchCase: 1}];
365
365
  } else {
366
- config.baseConfig.rules.indent = ['error', spaces, {SwitchCase: 1}];
366
+ config.baseConfig.rules.indent ??= ['error', spaces, {SwitchCase: 1}];
367
367
  }
368
368
 
369
369
  // Only apply if the user has the React plugin
370
370
  if (options.cwd && resolveFrom.silent('eslint-plugin-react', options.cwd)) {
371
371
  config.baseConfig.plugins.push('react');
372
- config.baseConfig.rules['react/jsx-indent-props'] = ['error', spaces];
373
- config.baseConfig.rules['react/jsx-indent'] = ['error', spaces];
372
+ config.baseConfig.rules['react/jsx-indent-props'] ??= ['error', spaces];
373
+ config.baseConfig.rules['react/jsx-indent'] ??= ['error', spaces];
374
374
  }
375
375
  }
376
376
 
377
377
  if (options.semicolon === false && !options.prettier) {
378
378
  if (options.ts) {
379
- config.baseConfig.rules['@typescript-eslint/semi'] = ['error', 'never'];
379
+ config.baseConfig.rules['@typescript-eslint/semi'] ??= ['error', 'never'];
380
380
  } else {
381
- config.baseConfig.rules.semi = ['error', 'never'];
381
+ config.baseConfig.rules.semi ??= ['error', 'never'];
382
382
  }
383
383
 
384
- config.baseConfig.rules['semi-spacing'] = ['error', {
384
+ config.baseConfig.rules['semi-spacing'] ??= ['error', {
385
385
  before: false,
386
386
  after: true,
387
387
  }];
388
388
  }
389
389
 
390
390
  if (options.ts) {
391
- config.baseConfig.rules['unicorn/import-style'] = 'off';
392
- config.baseConfig.rules['node/file-extension-in-import'] = 'off';
391
+ config.baseConfig.rules['unicorn/import-style'] ??= 'off';
392
+ config.baseConfig.rules['node/file-extension-in-import'] ??= 'off';
393
393
 
394
394
  // Disabled because of https://github.com/benmosher/eslint-plugin-import/issues/1590
395
- config.baseConfig.rules['import/export'] = 'off';
395
+ config.baseConfig.rules['import/export'] ??= 'off';
396
396
 
397
397
  // Does not work when the TS definition exports a default const.
398
- config.baseConfig.rules['import/default'] = 'off';
398
+ config.baseConfig.rules['import/default'] ??= 'off';
399
399
 
400
400
  // Disabled as it doesn't work with TypeScript.
401
401
  // This issue and some others: https://github.com/benmosher/eslint-plugin-import/issues/1341
402
- config.baseConfig.rules['import/named'] = 'off';
402
+ config.baseConfig.rules['import/named'] ??= 'off';
403
403
  }
404
404
 
405
405
  config.baseConfig.settings['import/resolver'] = gatherImportResolvers(options);
@@ -444,7 +444,7 @@ const buildPrettierConfig = (options, prettierConfig) => config => {
444
444
  config.baseConfig.extends.push('plugin:prettier/recommended');
445
445
 
446
446
  // The `prettier/prettier` rule reports errors if the code is not formatted in accordance to Prettier
447
- config.baseConfig.rules['prettier/prettier'] = ['error', mergeWithPrettierConfig(options, prettierConfig)];
447
+ config.baseConfig.rules['prettier/prettier'] ??= ['error', mergeWithPrettierConfig(options, prettierConfig)];
448
448
  }
449
449
 
450
450
  return config;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xo",
3
- "version": "0.59.0",
3
+ "version": "0.59.1",
4
4
  "description": "JavaScript/TypeScript linter (ESLint wrapper) with great defaults",
5
5
  "license": "MIT",
6
6
  "repository": "xojs/xo",