id-blacklist catches calls to Number
See original GitHub issueTell us about your environment
- ESLint Version: 6.1.0
- Node Version: 10.16.3
- npm Version: 6.13.0
What parser (default, Babel-ESLint, etc.) are you using? @typescript-eslint/parser
Please show your full configuration:
Configuration
module.exports = {
"env": {
"browser": true,
"es6": true,
"node": true
},
"extends": [],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "tsconfig.json",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint",
"@typescript-eslint/tslint",
"import",
"s2-app"
],
"rules": {
"s2-app/no-template-literals": 1,
"s2-app/no-first": 1,
"strict": [
2,
"safe"
],
"no-var": "error",
"prefer-const": "error",
"no-shadow": [
"error",
{
"hoist": "all"
}
],
"no-shadow-restricted-names": [
2
],
"@typescript-eslint/no-unused-vars": [
2,
{
"vars": "all",
"args": "after-used"
}
],
"no-use-before-define": [
0,
"nofunc"
],
"comma-dangle": [
2,
"always-multiline"
],
"no-cond-assign": "off",
"no-console": [
"error",
{
"allow": [
"dirxml",
"warn",
"error",
"dir",
"timeLog",
"assert",
"clear",
"count",
"countReset",
"group",
"groupCollapsed",
"groupEnd",
"table",
"Console",
"markTimeline",
"profile",
"profileEnd",
"timeline",
"timelineEnd",
"timeStamp",
"context"
]
}
],
"no-debugger": "error",
"no-alert": [
1
],
"no-constant-condition": [
1
],
"no-dupe-keys": [
2
],
"no-duplicate-case": [
2
],
"no-empty": "error",
"no-ex-assign": [
2
],
"no-extra-boolean-cast": [
0
],
"no-extra-semi": [
2
],
"no-func-assign": [
2
],
"no-inner-declarations": [
2,
"both"
],
"no-invalid-regexp": [
2
],
"no-irregular-whitespace": [
2
],
"no-obj-calls": [
2
],
"no-sparse-arrays": [
2
],
"no-unreachable": [
2
],
"use-isnan": "error",
"block-scoped-var": [
0
],
"consistent-return": [
2
],
"curly": "error",
"default-case": "off",
"dot-notation": "off",
"eqeqeq": [
"error",
"smart"
],
"guard-for-in": "error",
"no-caller": "error",
"no-else-return": [
2
],
"no-eq-null": [
2
],
"no-eval": "error",
"no-extra-bind": [
2
],
"no-fallthrough": "error",
"no-floating-decimal": [
2
],
"no-implied-eval": [
2
],
"no-lone-blocks": [
2
],
"no-loop-func": [
2
],
"no-multi-str": [
2
],
"no-native-reassign": [
2
],
"no-new": [
2
],
"no-new-func": [
2
],
"no-new-wrappers": "error",
"no-octal": [
2
],
"no-octal-escape": [
2
],
"no-param-reassign": [
2
],
"no-proto": [
2
],
"no-redeclare": "error",
"no-return-assign": [
2
],
"no-script-url": [
2
],
"no-self-compare": [
2
],
"no-sequences": [
2
],
"no-throw-literal": [
2
],
"no-with": [
2
],
"radix": "error",
"vars-on-top": [
2
],
"wrap-iife": [
2,
"any"
],
"yoda": [
2
],
"indent": [
2,
2
],
"brace-style": [
2,
"1tbs",
{
"allowSingleLine": true
}
],
"quotes": [
2,
"single",
"avoid-escape"
],
"camelcase": "error",
"comma-spacing": [
2,
{
"before": false,
"after": true
}
],
"comma-style": [
2,
"last"
],
"eol-last": "error",
"func-names": [
0
],
"key-spacing": [
2,
{
"beforeColon": false,
"afterColon": true
}
],
"keyword-spacing": [
2
],
"max-len": [
"error",
{
"code": 150
}
],
"new-cap": [
2,
{
"newIsCap": true,
"capIsNew": false,
"properties": true
}
],
"no-multiple-empty-lines": "error",
"no-nested-ternary": [
2
],
"no-new-object": [
2
],
"no-spaced-func": [
2
],
"no-trailing-spaces": "error",
"no-extra-parens": [
2,
"functions"
],
"no-underscore-dangle": "error",
"no-warning-comments": [
0
],
"object-curly-spacing": [
2,
"always"
],
"one-var": [
"error",
"never"
],
"padded-blocks": [
2,
"never"
],
"semi": [
2,
"always"
],
"semi-spacing": [
2,
{
"before": false,
"after": true
}
],
"space-before-blocks": [
2
],
"space-before-function-paren": [
2,
{
"anonymous": "always",
"named": "never",
"asyncArrow": "always"
}
],
"space-infix-ops": [
2
],
"spaced-comment": "error",
"@typescript-eslint/adjacent-overload-signatures": "error",
"@typescript-eslint/ban-types": "error",
"@typescript-eslint/class-name-casing": "error",
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/explicit-member-accessibility": [
"error",
{
"accessibility": "no-public"
}
],
"@typescript-eslint/indent": "off",
"@typescript-eslint/interface-name-prefix": "error",
"@typescript-eslint/member-delimiter-style": ["error", {
"multiline": {
"delimiter": "semi",
"requireLast": true
},
"singleline": {
"delimiter": "semi",
"requireLast": false
}
}],
"@typescript-eslint/member-ordering": "error",
"@typescript-eslint/no-empty-function": "error",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-inferrable-types": "error",
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-non-null-assertion": "error",
"@typescript-eslint/no-require-imports": "off",
"@typescript-eslint/no-use-before-declare": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/prefer-namespace-keyword": "error",
"@typescript-eslint/quotes": [
"error",
"single"
],
"@typescript-eslint/restrict-plus-operands": "off",
"@typescript-eslint/semi": [
"error",
"always"
],
"@typescript-eslint/triple-slash-reference": "error",
"@typescript-eslint/type-annotation-spacing": "error",
"arrow-parens": [
"off",
"as-needed"
],
"capitalized-comments": "error",
"constructor-super": "error",
"id-blacklist": [
"error",
"any",
"Number",
"number",
"String",
"string",
"Boolean",
"boolean",
"Undefined",
"undefined"
],
"id-match": "error",
"import/no-default-export": "error",
"import/order": "off",
"linebreak-style": "off",
"max-classes-per-file": [
"error",
1
],
"max-lines": "off",
"new-parens": "error",
"no-bitwise": "error",
"no-duplicate-imports": "error",
"no-invalid-this": "error",
"no-null/no-null": "off",
"no-unsafe-finally": "error",
"no-unused-expressions": "error",
"no-unused-labels": "error",
"prefer-arrow/prefer-arrow-functions": "off",
"unicorn/filename-case": [
"error",
{
"case": "kebabCase"
}
],
"@typescript-eslint/tslint/config": [
"error",
{
"rules": {
"ban": [
true,
{
"name": "Boolean",
"message": "Use '!!' to determine a value's truthy value."
}
],
"component-class-suffix": true,
"component-selector": [
true,
"element",
[
"ps"
],
"kebab-case"
],
"directive-class-suffix": true,
"directive-selector": [
true,
"attribute",
[
"ps"
],
"kebab-case"
],
"import-destructuring-spacing": true,
"jsdoc-format": true,
"max-interfaces-per-file": [
true,
1
],
"no-analytics-on-ng-tags": true,
"no-attribute-parameter-decorator": true,
"no-event-id-on-ng-tags": true,
"no-forward-ref": true,
"no-input-rename": true,
"no-mergeable-namespace": true,
"no-output-rename": true,
"one-line": [
true,
"check-catch",
"check-else",
"check-finally",
"check-open-brace",
"check-whitespace"
],
"origin-ordered-imports": true,
"rxjs-no-unsafe-catch": true,
"rxjs-no-unsafe-first": true,
"rxjs-no-unsafe-switchmap": true,
"rxjs-no-unsafe-takeuntil": true,
"trailing-comma": [
true,
{
"multiline": "never",
"singleline": "never"
}
],
"typedef": [
true,
"call-signature"
],
"use-input-property-decorator": true,
"use-life-cycle-interface": true,
"use-output-property-decorator": true,
"use-pipe-transform-interface": true,
"whitespace": [
true,
"check-branch",
"check-decl",
"check-operator",
"check-module",
"check-separator",
"check-type"
]
}
}
]
},
"settings": {}
};
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
isSessionOverrideProvided(): boolean {
return !isNaN(Number.parseInt(this.sessionForm.value.accessCount, 10));
}
Run via VSCode ESLint plugin, should be something like:
eslint ./src/**/*.ts -c .eslintrc.js
VSCode ESLint settings:
{
"eslint.lintTask.options": "./src/**/*.ts",
"eslint.lintTask.enable": true,
"eslint.options": {
"configFile": ".eslintrc.js"
},
"eslint.validate": [
"javascript",
"typescript"
],
"eslint.enable": true
}
What did you expect to happen?
The call to Number.parseInt()
would not be caught by the ESLint id-blacklist
rule.
What actually happened? Please include the actual, raw output from ESLint.
The call to Number.parseInt()
is caught by eslint - Identifier 'Number' is blacklisted.
Are you willing to submit a pull request to fix this bug? No
Issue Analytics
- State:
- Created 4 years ago
- Reactions:6
- Comments:25 (16 by maintainers)
Top Results From Across the Web
using regex in call id blacklist (how do you deal with ... - 3CX
Hello Forum, We are reciving telephone scam calls from a foreign ... digit numbers, you could add a second rule(with 11 dots) to...
Read more >Rule id-blacklist - ESLint - Pluggable JavaScript linter | Js中文网
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >id-denylist - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >disallow specified identifiers (id-blacklist) - Breword 文档集合
This rule was deprecated in ESLint v7.5.0 and replaced by the id-denylist rule.
Read more >Call Blocking and Blacklisting Numbers: Why should you do it ...
The number of spam calls is increasing every day. ... It captures audio and screen activity associated with phone calls.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It seems the “ban-keywords” option in the TSLint “variable-name” rule should actually be translated to a combination of ESLint rules:
With these results enabled, it gives me the expected result and works equivalent to the TSLint rule.
.eslintrc.js
index.ts
This is probably an issue with the tslint-to-eslint-config scripts.
But “id-blacklist” is giving me strange behaviour as well, if I change the eslint rules to have the “id-blacklist” rule, then suddenly perfectly valid code is flagged as an error.
.eslintrc.js
index.ts
Suddenly, using
undefined
in the code is not OK anymore, but I never useundefined
as an identifier, only as a value.It seems that “id-blacklist” is too aggressive in its flagging, and not a correct translation of the “ban-keywords” option in the TSLint “variable-name” rule.
Reopening since this is likely a bug we should fix.