question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Decorator: Unexpected use of 'name'. no-restricted-globals

See original GitHub issue

env info

  • ESLint Version: 7.14.0
  • Node Version: 12.13.1
  • npm Version:6.4.10

parser

@typescript-eslint/parser

Configuration
  env: {
    browser: true,
    commonjs: true,
    es6: true,
    node: true,
    mocha: true,
  },
  parser: '@typescript-eslint/parser',
  extends: ['airbnb-base', 'plugin:@typescript-eslint/recommended'],
  globals: {
    expect: false,
  },
  rules: {
    'no-use-before-define': 0,
    'max-classes-per-file': [0, 1],
    '@typescript-eslint/member-delimiter-style': [2, { multiline: { delimiter: 'none' } }],
    '@typescript-eslint/no-use-before-define': [2],
    '@typescript-eslint/explicit-module-boundary-types': 0,
    '@typescript-eslint/ban-types': 0,
  },
Code
export default class CiController extends Base {
  @post('/docker-image/record')
  async createDockerImageRecord(@parseRequest({
    body: {
      name: {
        type: 'string',
        required: true,
      },
      tag: {
        type: 'string',
        required: true,
      },
      jobId: {
        type: 'number',
        required: true,
      },
      pId: {
        type: 'number',
        required: true,
      },
      packageLockStr: {
        type: 'string',
        required: true,
      },
    },
  }) paramters: {
    body: {
      name: string
      tag: string
      jobId: number
      pId: number
      packageLockStr: string
    }
  }): IResult<any> {
    const {
      name,
      tag,
      jobId,
      pId,
      packageLockStr,
    } = paramters.body

  }
}

command

eslint

result

image

What did you expect to happen? This is not declaring a variable. Sholdn’t trigger this rule

What actually happened? Please include the actual, raw output from ESLint. /Users/qiongen/Desktop/red/fe-platform/src/app/controller/ci.ts 96:7 error Unexpected use of ‘name’ no-restricted-globals

✖ 1 problem (1 error, 0 warnings)

Are you willing to submit a pull request to fix this bug?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
JanJakescommented, Jan 22, 2021

Seeing this with ESLint 7.18.0 and @typescript-eslint/parser 4.14.0 (latest version).

0reactions
Edge00commented, Jan 25, 2021

@anikethsaha @mdjermanovic Thanks for helping. since this is a bug with typescript-eslint. i’ll close this issue. Thanks again!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Javascript: Expected result. React: "Unexpected use of 'name ...
js file created by npx create-react-app yields the compiler error Unexpected use of 'name' no-restricted-globals on each line containing the ...
Read more >
Unexpected use of 'name' no-restricted-globals - React.js
I was working on POST request which would create new playlist. I have a weird to me error which I tried to google...
Read more >
Unexpected use of 'name' no-restricted-globals in React
Unexpected use of 'name ' no - restricted - globals in React ,solved.
Read more >
Airbnb JavaScript Style Guide()
3.2 Use computed property names when creating objects with dynamic property names. Why? They allow you to define all the properties of an...
Read more >
Not being able to use MDB React PRO - MDBootstrap
... Unexpected use of 'self' no-restricted-globals Line 390: 'DEBUG' is not defined no-undef Line ... Do not use import syntax to configure webpack...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found