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

Chore: First ES6 refactoring (refs #6407) #6570

Merged
merged 1 commit into from Jul 18, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions .eslintrc.yml
Expand Up @@ -2,6 +2,10 @@ root: true

env:
node: true
es6: true

parserOptions:
ecmaVersion: 6

extends:
"./packages/eslint-config-eslint/default.yml"
6 changes: 3 additions & 3 deletions Makefile.js
Expand Up @@ -688,13 +688,13 @@ target.browserify = function() {
generateRulesIndex(TEMP_DIR);

// 5. browserify the temp directory
nodeCLI.exec("browserify", "-x espree", TEMP_DIR + "eslint.js", "-o", BUILD_DIR + "eslint.js", "-s eslint");
nodeCLI.exec("browserify", "-x espree", TEMP_DIR + "eslint.js", "-o", BUILD_DIR + "eslint.js", "-s eslint", "-t [ babelify --presets [ es2015 ] ]");

// 6. Browserify espree
nodeCLI.exec("browserify", "-r espree", "-o", TEMP_DIR + "espree.js");

// 7. Concatenate the two files together
cat(TEMP_DIR + "espree.js", BUILD_DIR + "eslint.js").to(BUILD_DIR + "eslint.js");
// 7. Concatenate Babel polyfill, Espree, and ESLint files together
cat("./node_modules/babel-polyfill/dist/polyfill.js", TEMP_DIR + "espree.js", BUILD_DIR + "eslint.js").to(BUILD_DIR + "eslint.js");

// 8. remove temp directory
rm("-r", TEMP_DIR);
Expand Down
20 changes: 10 additions & 10 deletions lib/config/environments.js
Expand Up @@ -14,7 +14,7 @@ var envs = require("../../conf/environments");
// Private
//------------------------------------------------------------------------------

var environments = Object.create(null);
var environments = new Map();

/**
* Loads the default environments.
Expand All @@ -23,7 +23,7 @@ var environments = Object.create(null);
*/
function load() {
Object.keys(envs).forEach(function(envName) {
environments[envName] = envs[envName];
environments.set(envName, envs[envName]);
});
}

Expand All @@ -36,15 +36,15 @@ load();

module.exports = {

load: load,
load,

/**
* Gets the environment with the given name.
* @param {string} name The name of the environment to retrieve.
* @returns {Object?} The environment object or null if not found.
*/
get: function(name) {
return environments[name] || null;
get(name) {
return environments.get(name) || null;
},

/**
Expand All @@ -53,8 +53,8 @@ module.exports = {
* @param {Object} env The environment settings.
* @returns {void}
*/
define: function(name, env) {
environments[name] = env;
define(name, env) {
environments.set(name, env);
},

/**
Expand All @@ -63,7 +63,7 @@ module.exports = {
* @param {string} pluginName The name of the plugin.
* @returns {void}
*/
importPlugin: function(plugin, pluginName) {
importPlugin(plugin, pluginName) {
if (plugin.environments) {
Object.keys(plugin.environments).forEach(function(envName) {
this.define(pluginName + "/" + envName, plugin.environments[envName]);
Expand All @@ -75,8 +75,8 @@ module.exports = {
* Resets all environments. Only use for tests!
* @returns {void}
*/
testReset: function() {
environments = Object.create(null);
testReset() {
environments = new Map();
load();
Copy link
Contributor

Choose a reason for hiding this comment

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

Could call this.load(); here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Or if you feel this is confusing here, use Environments.load();

}
};
3 changes: 1 addition & 2 deletions lib/rules/no-unmodified-loop-condition.js
Expand Up @@ -9,8 +9,7 @@
// Requirements
//------------------------------------------------------------------------------

var Map = require("es6-map"),
Traverser = require("../util/traverser"),
var Traverser = require("../util/traverser"),
astUtils = require("../ast-utils");

//------------------------------------------------------------------------------
Expand Down
1 change: 0 additions & 1 deletion lib/rules/prefer-const.js
Expand Up @@ -9,7 +9,6 @@
// Requirements
//------------------------------------------------------------------------------

var Map = require("es6-map");
var lodash = require("lodash");

//------------------------------------------------------------------------------
Expand Down
4 changes: 3 additions & 1 deletion package.json
Expand Up @@ -40,7 +40,6 @@
"concat-stream": "^1.4.6",
"debug": "^2.1.1",
"doctrine": "^1.2.2",
"es6-map": "^0.1.3",
"escope": "^3.6.0",
"espree": "^3.1.6",
"estraverse": "^4.2.0",
Expand Down Expand Up @@ -71,6 +70,9 @@
"user-home": "^2.0.0"
},
"devDependencies": {
"babel-polyfill": "^6.9.1",
"babel-preset-es2015": "^6.9.0",
"babelify": "^7.3.0",
"beefy": "^2.0.0",
"brfs": "0.0.9",
"browserify": "^12.0.1",
Expand Down