Skip to content

Commit

Permalink
Merge pull request #175 from mediamonks/hexadecimal-number-formatting
Browse files Browse the repository at this point in the history
Make grouping optional for all number types except `number`
  • Loading branch information
leroykorterink committed Oct 20, 2023
2 parents 05e0480 + 54001b0 commit 69b1c19
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/eslint-config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,15 @@ module.exports = {
'unicorn/prefer-string-replace-all': 'error',
'unicorn/require-post-message-target-origin': 'error',
// 'unicorn/string-content': 'error',
'unicorn/numeric-separators-style': [
'error',
{
onlyIfContainsSeparator: true,
number: {
onlyIfContainsSeparator: false,
},
},
],

/**
* Import
Expand Down
11 changes: 11 additions & 0 deletions packages/test-eslint-config/numericSeperatorStyle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* eslint-disable no-unused-vars */

const hex1 = 0xff0000;
const hex2 = 0xff_00_00;
const number1 = 100;
const number2 = 1000;
const number3 = 1_000_000;
const number4 = 1.234_56;
const octal1 = 0o7777;
const octal3 = 0o12_7777;
const binary = 0b101010001;

0 comments on commit 69b1c19

Please sign in to comment.