Skip to content

Commit

Permalink
⬆️ Upgrade JavaScript dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
sjmatta committed Jun 18, 2016
1 parent 21388fc commit 136d684
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 21 deletions.
5 changes: 2 additions & 3 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"extends": "airbnb/base",
"extends": "airbnb-base",
"parser": "babel-eslint",
"rules": {
"id-length": 0,
"no-console": 0,
"no-console": 0
}
}
23 changes: 13 additions & 10 deletions lib/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
'use babel';
/* globals atom */

import { CompositeDisposable } from 'atom';
import { CompositeDisposable } from 'atom'; // eslint-disable-line import/no-unresolved
import { install } from 'atom-package-deps';
import { find, exec, rangeFromLineNumber } from 'atom-linter';
import { parseString } from 'xml2js';
import promisify from 'es6-promisify'; // turns callback APIs into promise APIs
import fs from 'fs';
Expand All @@ -24,7 +26,7 @@ export default {
this.javaPath = javaPath;
return javaPath;
});
require('atom-package-deps').install('linter-cflint', true);
install('linter-cflint');
atom.config.unset('linter-cflint.cflintPath');
},

Expand All @@ -33,7 +35,6 @@ export default {
},

provideLinter() {
const helpers = require('atom-linter');
return {
name: 'cflint',
grammarScopes: [
Expand All @@ -55,7 +56,7 @@ export default {

// find (optional) .cflintrc
const filePath = textEditor.getPath().trim();
const cflintConfig = helpers.find(filePath, '.cflintrc');
const cflintConfig = find(filePath, '.cflintrc');
let configData = null;
if (cflintConfig !== null) {
configData = await promisify(fs.readFile)(cflintConfig);
Expand All @@ -64,7 +65,8 @@ export default {
// parse .cflintrc
const configJson = configData !== null ? json.parse(configData, null, true) : {};
const rules = _(configJson.rules).pickBy(value => value === 0).keys()
.map(rule => rule.replace(/-/g, '_').toUpperCase()).value();
.map(rule => rule.replace(/-/g, '_').toUpperCase())
.value();

// execute CFLint.jar with -stdin
const packagePath = atom.packages.resolvePackagePath('linter-cflint').trim();
Expand All @@ -78,7 +80,7 @@ export default {
'-xml',
'-excludeRule', rules,
];
let xmlResult = await helpers.exec(javaPath, javaArgs, {
let xmlResult = await exec(javaPath, javaArgs, {
stdin: textEditor.getText(),
stdio: 'pipe',
stream: 'stdout',
Expand Down Expand Up @@ -112,17 +114,18 @@ export default {
type: issue.$.severity === 'ERROR' ? 'Error' : 'Warning',
html: `<span class="badge badge-flexible">${id}</span> ${message}`,
line: parseInt(issue.location[0].$.line, 10) - 1,
range: helpers.rangeFromLineNumber(textEditor, line - 1, column),
range: rangeFromLineNumber(textEditor, line - 1, column),
};
}).sortBy(['type', 'line']).value();
}).sortBy(['type', 'line'])
.value();
return messages;
}

// wrap doLint in a try/catch and handle errors
try {
return await doLint();
} catch (err) {
console.error(err);
console.error(err); // eslint-disable-line
let message = `An unexpected error occured with linter-cflint. See the
debug log for details.`;
if (err.message === 'PARSE_ERROR') {
Expand All @@ -133,7 +136,7 @@ export default {
}
atom.notifications.addError(message, { dismissable: true });
}
return true;
return [];
},
};
},
Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"repository": "https://github.com/ditinc/linter-cflint.git",
"license": "MIT",
"engines": {
"atom": ">0.50.0"
"atom": ">1.8.0"
},
"providedServices": {
"linter": {
Expand All @@ -17,22 +17,22 @@
}
},
"dependencies": {
"atom-linter": "4.5.1",
"atom-linter": "5.0.2",
"atom-package-deps": "4.0.1",
"comment-json": "1.1.3",
"es6-promisify": "3.0.0",
"es6-promisify": "4.1.0",
"find-java-home": "0.1.2",
"lodash": "4.5.1",
"lodash": "4.13.1",
"xml2js": "0.4.16"
},
"package-deps": [
"linter",
"language-cfml"
],
"devDependencies": {
"babel-eslint": "5.0.0",
"eslint": "2.2.0",
"eslint-config-airbnb": "6.0.2",
"eslint-plugin-react": "4.1.0"
"babel-eslint": "6.0.4",
"eslint": "2.13.0",
"eslint-config-airbnb-base": "3.0.1",
"eslint-plugin-import": "1.8.1"
}
}

0 comments on commit 136d684

Please sign in to comment.