Skip to content

Commit

Permalink
Version 2.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
zaggino committed Jul 30, 2016
1 parent daab912 commit e2c2aa3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 14 deletions.
36 changes: 23 additions & 13 deletions domain.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,28 @@
return require((eslintPath || 'eslint') + '/package.json').version;
}

try {
cli = getCli();
currentVersion = getEslintVersion();
} catch (err) {
logError(err);
function refreshEslintCli(eslintPath, opts) {
try {
currentVersion = getEslintVersion(eslintPath);
// brackets can't work with 3.x right now
if (/^3/.test(currentVersion)) {
var notSupportedVersion = currentVersion;
eslintPath = path.resolve(__dirname, 'node_modules', 'eslint');
currentVersion = getEslintVersion(eslintPath);
logError(
'Detected eslint version 3.x (' + notSupportedVersion +
'), falling back to default eslint ' + currentVersion
);
}
cli = getCli(eslintPath, opts);
} catch (err) {
logError(err);
}

}

refreshEslintCli();

function uniq(arr) {
return arr.reduce(function (result, item) {
if (result.indexOf(item) === -1) {
Expand All @@ -52,7 +67,8 @@
if (dirPath.match(/(\\|\/)$/)) {
dirPath = dirPath.slice(0, -1);
}
return process.platform === 'win32' ? dirPath.replace(/\//g, '\\') : dirPath;
var dir = process.platform === 'win32' ? dirPath.replace(/\//g, '\\') : dirPath;
return path.resolve(dir, 'node_modules');
}

function _setProjectRoot(projectRoot, prevProjectRoot) {
Expand Down Expand Up @@ -117,13 +133,7 @@
require('module').Module._initPaths();

// console.log('ESLint NODE_PATH', process.env.NODE_PATH);

try {
cli = getCli(eslintPath, opts);
currentVersion = getEslintVersion(eslintPath);
} catch (err) {
logError(err);
}
refreshEslintCli(eslintPath, opts);
}

require('enable-global-packages').on('ready', function () {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "brackets-eslint",
"version": "2.5.0",
"version": "2.6.0",
"description": "Adds ESLint support to Brackets",
"keywords": [
"brackets-extension",
Expand Down

0 comments on commit e2c2aa3

Please sign in to comment.