-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: avoid using bigint literal syntax (#542)
* fix: avoid using bigint literal syntax * simplify * fix: Add custom eslint plugin with no-big-int rule * fix: Migrate .eslintrc.js to flat format eslint.config.mjs * fix(gh): exclude node 12.x, 14.x on macos-latest
- Loading branch information
Showing
7 changed files
with
72 additions
and
25 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }) | ||
} | ||
}, | ||
} | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
}, | ||
}, | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters