Skip to content

Commit

Permalink
Allow experimental Node.js features
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Jul 28, 2024
1 parent 46a91e0 commit 3eb8436
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/options-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ const buildXOConfig = options => config => {
if (options.nodeVersion) {
config.baseConfig.rules['n/no-unsupported-features/es-builtins'] ??= ['error', {version: options.nodeVersion}];
config.baseConfig.rules['n/no-unsupported-features/es-syntax'] ??= ['error', {version: options.nodeVersion, ignores: ['modules']}];
config.baseConfig.rules['n/no-unsupported-features/node-builtins'] ??= ['error', {version: options.nodeVersion}];
config.baseConfig.rules['n/no-unsupported-features/node-builtins'] ??= ['error', {version: options.nodeVersion, allowExperimental: true}];
}

if (options.space && !options.prettier) {
Expand Down
4 changes: 2 additions & 2 deletions test/options-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ test('buildConfig: nodeVersion: >=6', t => {
config.baseConfig.rules['n/no-unsupported-features/es-syntax'],
['error', {version: '>=6', ignores: ['modules']}],
);
t.deepEqual(config.baseConfig.rules['n/no-unsupported-features/node-builtins'], ['error', {version: '>=6'}]);
t.deepEqual(config.baseConfig.rules['n/no-unsupported-features/node-builtins'], ['error', {version: '>=6', allowExperimental: true}]);
});

test('buildConfig: nodeVersion: >=8', t => {
Expand All @@ -267,7 +267,7 @@ test('buildConfig: nodeVersion: >=8', t => {
config.baseConfig.rules['n/no-unsupported-features/es-syntax'],
['error', {version: '>=8', ignores: ['modules']}],
);
t.deepEqual(config.baseConfig.rules['n/no-unsupported-features/node-builtins'], ['error', {version: '>=8'}]);
t.deepEqual(config.baseConfig.rules['n/no-unsupported-features/node-builtins'], ['error', {version: '>=8', allowExperimental: true}]);
});

test('mergeWithPrettierConfig: use `singleQuote`, `trailingComma`, `bracketSpacing` and `bracketSameLine` from `prettier` config if defined', t => {
Expand Down

0 comments on commit 3eb8436

Please sign in to comment.