Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Merge requests
  • !1840

Forbid using window properties as global variables

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/sidoshi/add-custom-globals into master Mar 17, 2017
  • Overview 31
  • Commits 3
  • Pipelines 0
  • Changes 4

Created by: sidoshi

All the properties of window object such as name, self, and status are considered to be global variables because of having browser env in eslint config. As a result this variables are ignored by eslint for errors such as no-unused-vars when someone uses this variables in their code without the intent of using them as a global variable.

To solve this we'd have to remove browser env from eslint config and add a list of global variables that are more commonly used. Other window properties are not considered global and requires window. qualifier.

I have added a list of all variables that I think are commonly used as globals in browser env. Please guide if I have missed something.

How did I test this? I created a new app with npm run create-react-app test-app npm start Added console.log(status) to index.js file And it showed error in terminal that status is not defined. (As expected)

But text-editors (Atom) won't show this as it requires eslint-config-react-app to be installed globally and hence it becomes necessary to update that package globally for this to work.

closes #1834 (closed)

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/sidoshi/add-custom-globals