Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add restricted globals package #2286

Merged
merged 10 commits into from
Jan 14, 2018
Merged

Add restricted globals package #2286

merged 10 commits into from
Jan 14, 2018

Conversation

sidoshi
Copy link
Contributor

@sidoshi sidoshi commented May 20, 2017

Add restricted globals in a separate package.

@@ -0,0 +1 @@
node_modules
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we have it in top level gitignore?

console.log(name)
}
}
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use this example:

function printStatus(stats) {
  console.log(status);
}

@@ -0,0 +1,60 @@
module.exports = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add use strict and standard license header.

@@ -0,0 +1,21 @@
{
"name": "eslint-restricted-globals",
"version": "0.1.1",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make it 1.0

@@ -0,0 +1,187 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove the lock here.

@@ -0,0 +1,21 @@
{
"name": "eslint-restricted-globals",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's call it confusing-browser-globals.

let globals = require('./');

it('should return an Array of globals', function() {
assert.strictEqual(globals.constructor, Array);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's instead test that it contains event as a sanity check.

"description": "A list of confusing globals that should be restricted to be used as globals",
"main": "index.js",
"scripts": {
"test": "mocha"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make sure this test runs on our CI.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how to do this. 😕

@@ -0,0 +1,42 @@
# eslint-restricted-globals [![npm](https://img.shields.io/npm/v/eslint-restricted-globals.svg?style=plastic)](https://www.npmjs.com/package/eslint-restricted-globals) [![npm](https://img.shields.io/npm/l/eslint-restricted-globals.svg?style=plastic)](https://www.npmjs.com/package/eslint-restricted-globals)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to update this too.

## Install

```
$ npm install --save eslint-restricted-globals
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and this

For eg:
```js
function logStats(stats) {
console.log(status)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two spaces please.

var restrictedGlobals = require('eslint-restricted-globals')

module.exports = {
rules: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use two spaces for indentation.

Add this in your eslint config in rules property:

```js
var restrictedGlobals = require('eslint-restricted-globals')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use semicolons.

let globals = require('./');

it('should return an Array of globals', function() {
assert.strictEqual(globals.constructor, Array);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: please use Array.isArray() instead.

@gaearon gaearon added this to the 1.0.2 milestone May 20, 2017
@gaearon gaearon modified the milestones: 1.0.x, 1.0.2 May 20, 2017
@@ -1,11 +1,11 @@
# eslint-restricted-globals [![npm](https://img.shields.io/npm/v/eslint-restricted-globals.svg?style=plastic)](https://www.npmjs.com/package/eslint-restricted-globals) [![npm](https://img.shields.io/npm/l/eslint-restricted-globals.svg?style=plastic)](https://www.npmjs.com/package/eslint-restricted-globals)
# eslint-restricted-globals
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The title is still old.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, UPDATING.

@@ -4,7 +4,7 @@ let assert = require('assert');
let globals = require('./');

it('should return an Array of globals', function() {
assert.strictEqual(globals.constructor, Array);
assert.strictEqual(Array.isArray(globals), true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, would you mind changing this to use Jest for testing?

We don't use it in integration tests because of some obscure jsdom issue but it would be great to dogfood it in other places.

Copy link
Contributor Author

@sidoshi sidoshi May 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, but I don't know how to work with CI tests.

Copy link
Contributor

@gaearon gaearon May 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just mean that instead of calling mocha you could call jest (and add it to dependencies).

And replace assertions with Jest syntax:

expect(Array.isArray(globals)).toBe(true);

@gaearon gaearon changed the base branch from master to next January 14, 2018 01:16
@gaearon gaearon modified the milestones: 1.0.x, 2.0.0 Jan 14, 2018
@gaearon gaearon merged commit 6f8e9b8 into facebook:next Jan 14, 2018
Timer pushed a commit that referenced this pull request Jan 14, 2018
* Add restricted globals package

* Use new package in eslint-config

* Add eslint-restricted-globals dependency

* Fixes

* Update dependencies

* Update test and README

* Use jest

* tweaks

* Add lint/test to CI

* Fix lint
gaearon pushed a commit that referenced this pull request Jan 14, 2018
* Add restricted globals package

* Use new package in eslint-config

* Add eslint-restricted-globals dependency

* Fixes

* Update dependencies

* Update test and README

* Use jest

* tweaks

* Add lint/test to CI

* Fix lint
gaearon pushed a commit that referenced this pull request Jan 14, 2018
* Add restricted globals package

* Use new package in eslint-config

* Add eslint-restricted-globals dependency

* Fixes

* Update dependencies

* Update test and README

* Use jest

* tweaks

* Add lint/test to CI

* Fix lint
gaearon pushed a commit that referenced this pull request Jan 14, 2018
* Add restricted globals package

* Use new package in eslint-config

* Add eslint-restricted-globals dependency

* Fixes

* Update dependencies

* Update test and README

* Use jest

* tweaks

* Add lint/test to CI

* Fix lint
gaearon pushed a commit that referenced this pull request Jan 14, 2018
* Add restricted globals package

* Use new package in eslint-config

* Add eslint-restricted-globals dependency

* Fixes

* Update dependencies

* Update test and README

* Use jest

* tweaks

* Add lint/test to CI

* Fix lint
Timer pushed a commit to Timer/create-react-app that referenced this pull request Jan 15, 2018
* Add restricted globals package

* Use new package in eslint-config

* Add eslint-restricted-globals dependency

* Fixes

* Update dependencies

* Update test and README

* Use jest

* tweaks

* Add lint/test to CI

* Fix lint
akstuhl pushed a commit to akstuhl/create-react-app that referenced this pull request Mar 15, 2018
* Add restricted globals package

* Use new package in eslint-config

* Add eslint-restricted-globals dependency

* Fixes

* Update dependencies

* Update test and README

* Use jest

* tweaks

* Add lint/test to CI

* Fix lint
@lock lock bot locked and limited conversation to collaborators Jan 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants