Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions .eslintrc.js

This file was deleted.

4 changes: 4 additions & 0 deletions .github/workflows/bundlers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ jobs:
node-version: 12.x
- os: windows-latest
node-version: 14.x
- os: macos-latest
node-version: 12.x
- os: macos-latest
node-version: 14.x
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ jobs:
node-version: 12.x
- os: windows-latest
node-version: 14.x
- os: macos-latest
node-version: 12.x
- os: macos-latest
node-version: 14.x
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
9 changes: 9 additions & 0 deletions eslint-plugin-local/index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use strict'

import nbi from './no-big-int.mjs'

export default {
rules: {
'no-big-int': nbi,
},
}
26 changes: 26 additions & 0 deletions eslint-plugin-local/no-big-int.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
'use strict'

export default {
meta: {
docs: {
description: 'disallow `bigint` syntax',
category: 'ES2020',
recommended: false,
},
fixable: null,
messages: {
forbidden: 'ES2020 `bigint` syntax is forbidden.',
},
schema: [],
type: 'problem',
},
create(context) {
return {
Literal(node) {
if (node.bigint != null) {
context.report({ messageId: 'forbidden', node })
}
},
}
},
}
27 changes: 27 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { FlatCompat } from '@eslint/eslintrc'
const compat = new FlatCompat()

import eslintPluginLocal from './eslint-plugin-local/index.mjs'

export default [
// standard,
...compat.extends('eslint-config-standard'),
{
files: ['**/**.js', '**/**.mjs'],
languageOptions: {
sourceType: 'module',
ecmaVersion: 'latest',
},
plugins: { 'local': eslintPluginLocal },
rules: {
/*
This is inserted to make this compatible with prettier.
Once https://github.com/prettier/prettier/issues/3845 and https://github.com/prettier/prettier/issues/3847 are solved this might be not needed any more.
*/
'space-before-function-paren': 0,
curly: [2, 'all'],
'local/no-big-int': 'error',
},
},
]

4 changes: 2 additions & 2 deletions src/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,8 @@ E(
received = addNumericalSeparator(String(input))
} else if (typeof input === 'bigint') {
received = String(input)

if (input > 2n ** 32n || input < -(2n ** 32n)) {
const limit = BigInt(2) ** BigInt(32)
if (input > limit || input < -limit) {
received = addNumericalSeparator(received)
}

Expand Down
Loading