Skip to content

Commit 1bb23e4

Browse files
committed
Merge pull request #56 from codeclimate/will/eslintrc
Add app's eslintrc
2 parents f3ca402 + 8f83ddb commit 1bb23e4

File tree

3 files changed

+39
-19
lines changed

3 files changed

+39
-19
lines changed

.eslintrc

+19
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,25 @@
33
"node": true
44
},
55
"rules": {
6+
"brace-style": [2, "1tbs", { "allowSingleLine": true }],
7+
"comma-dangle": [2, "never"],
8+
"comma-style": [2, "first", { exceptions: {ArrayExpression: true, ObjectExpression: true} }],
9+
"curly": 2,
10+
"eqeqeq": [2, "allow-null"],
11+
"no-shadow-restricted-names": 2,
12+
"no-undef": 2,
13+
"no-use-before-define": 2,
14+
"radix": 2,
15+
"semi": 2,
16+
"space-infix-ops": 2,
617
"strict": 0
18+
},
19+
"globals": {
20+
"AnalysisView": true,
21+
"PollingView": true,
22+
"Prism": true,
23+
"Spinner": true,
24+
"Timer": true,
25+
"moment": true
726
}
827
}

bin/eslint.js

+14-14
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,18 @@ var checks = require("../lib/checks");
1818

1919
// a wrapper for emitting perf timing
2020
function runWithTiming(name, fn) {
21-
var start = new Date(),
22-
rv = fn(),
23-
duration = (new Date() - start) / 1000;
21+
var start = new Date()
22+
, rv = fn()
23+
, duration = (new Date() - start) / 1000;
2424
console.error("eslint.timing." + name + ": " + duration + "s");
2525
return rv;
2626
}
2727

28+
function contentBody(check) {
29+
var content = docs.get(check) || "For more information visit ";
30+
return content + "Source: http://eslint.org/docs/rules/\n";
31+
}
32+
2833
function buildIssueJson(message, path) {
2934
// ESLint doesn't emit a ruleId in the
3035
// case of a fatal error (such as an invalid
@@ -60,11 +65,6 @@ function buildIssueJson(message, path) {
6065
return JSON.stringify(issue);
6166
}
6267

63-
function contentBody(check) {
64-
var content = docs.get(check) || "For more information visit ";
65-
return content + "Source: http://eslint.org/docs/rules/\n";
66-
}
67-
6868
function isFileWithMatchingExtension(file, extensions) {
6969
var stats = fs.lstatSync(file);
7070
var extension = "." + file.split(".").pop();
@@ -79,7 +79,7 @@ function isFileIgnoredByLibrary(file) {
7979
var path = file.replace(/^\/code\//, "");
8080
var ignored = cli.isPathIgnored(path);
8181
if (ignored) {
82-
output = "File `" + path + "` ignored because of your .eslintignore file." + "\n";
82+
var output = "File `" + path + "` ignored because of your .eslintignore file." + "\n";
8383
process.stderr.write(output);
8484
}
8585
return ignored;
@@ -94,7 +94,7 @@ function prunePathsWithinSymlinks(paths) {
9494
return paths.filter(function(path) {
9595
var withinSymlink = false;
9696
symlinks.forEach(function(symlink) {
97-
if (path.indexOf(symlink) == 0) {
97+
if (path.indexOf(symlink) === 0) {
9898
withinSymlink = true;
9999
}
100100
});
@@ -193,10 +193,10 @@ var analysisFiles = runWithTiming("buildFileList", function() {
193193
});
194194

195195
function analyzeFiles() {
196-
var batchNum = 0,
197-
batchSize = 1,
198-
batchFiles,
199-
batchReport;
196+
var batchNum = 0
197+
, batchSize = 1
198+
, batchFiles
199+
, batchReport;
200200

201201
while(analysisFiles.length > 0) {
202202
batchFiles = analysisFiles.splice(0, batchSize);

lib/checks.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -110,17 +110,18 @@ var checkCategoryMapping = {
110110
};
111111

112112
var categories = function(checkName) {
113-
return [checkCategoryMapping[checkName] || "Style"]
113+
return [checkCategoryMapping[checkName] || "Style"];
114114
};
115115

116116
var remediationPoints = function(checkName, message) {
117117
if (checkName === "complexity") {
118118
// (@base_cost + (overage * @cost_per))*1_000_000
119119
// cost_per: 0.1, base: 1
120-
var costPer = 100000,
121-
points = 1000000,
122-
threshold = 10, // TODO: Get this from the eslintrc
123-
overage, complexity;
120+
var costPer = 100000
121+
, points = 1000000
122+
, threshold = 10 // TODO: Get this from the eslintrc
123+
, overage
124+
, complexity;
124125

125126
complexity = message.message.match(/complexity of (\d+)/)[1];
126127
overage = complexity - threshold;

0 commit comments

Comments
 (0)