Skip to content

Commit 7cad1f1

Browse files
committed
fix(lint): Manually resolve final lint issues
1 parent aa0604a commit 7cad1f1

File tree

8 files changed

+30
-26
lines changed

8 files changed

+30
-26
lines changed

core/lib/annotation_exporter.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ const annotations_exporter = function(pl) {
3535
oldAnnotations = oldAnnotations.replace('};', '}');
3636

3737
try {
38-
var oldAnnotationsJSON = JSON.parse(oldAnnotations);
38+
const oldAnnotationsJSON = JSON.parse(oldAnnotations);
39+
return oldAnnotationsJSON.comments;
3940
} catch (ex) {
4041
logger.error(
4142
`There was an error parsing JSON for ${
@@ -44,7 +45,6 @@ const annotations_exporter = function(pl) {
4445
);
4546
return [];
4647
}
47-
return oldAnnotationsJSON.comments;
4848
}
4949

5050
/**

core/lib/exportData.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
const eol = require('os').EOL;
44
const path = require('path');
5-
const _ = require('lodash');
65

76
const ae = require('./annotation_exporter');
87

core/lib/get.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,33 @@ const logger = require('./log');
44

55
module.exports = function(partialName, patternlab) {
66
//look for exact partial matches
7-
for (var i = 0; i < patternlab.patterns.length; i++) {
7+
for (let i = 0; i < patternlab.patterns.length; i++) {
88
if (patternlab.patterns[i].patternPartial === partialName) {
99
return patternlab.patterns[i];
1010
}
1111
}
1212

1313
//else look by verbose syntax
14-
for (var i = 0; i < patternlab.patterns.length; i++) {
14+
for (let j = 0; j < patternlab.patterns.length; j++) {
1515
switch (partialName) {
16-
case patternlab.patterns[i].relPath:
17-
return patternlab.patterns[i];
18-
case patternlab.patterns[i].verbosePartial:
19-
return patternlab.patterns[i];
16+
case patternlab.patterns[j].relPath:
17+
return patternlab.patterns[j];
18+
case patternlab.patterns[j].verbosePartial:
19+
return patternlab.patterns[j];
2020
}
2121
}
2222

2323
//return the fuzzy match if all else fails
24-
for (var i = 0; i < patternlab.patterns.length; i++) {
25-
let partialParts = partialName.split('-'),
26-
partialType = partialParts[0],
27-
partialNameEnd = partialParts.slice(1).join('-');
24+
for (let k = 0; k < patternlab.patterns.length; k++) {
25+
const partialParts = partialName.split('-');
26+
const partialType = partialParts[0];
27+
const partialNameEnd = partialParts.slice(1).join('-');
2828

2929
if (
30-
patternlab.patterns[i].patternPartial.split('-')[0] === partialType &&
31-
patternlab.patterns[i].patternPartial.indexOf(partialNameEnd) > -1
30+
patternlab.patterns[k].patternPartial.split('-')[0] === partialType &&
31+
patternlab.patterns[k].patternPartial.indexOf(partialNameEnd) > -1
3232
) {
33-
return patternlab.patterns[i];
33+
return patternlab.patterns[k];
3434
}
3535
}
3636
logger.warning(

core/lib/loadPattern.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,9 @@ module.exports = function(relPath, patternlab) {
114114
}
115115

116116
//look for a json file for this template
117+
let jsonFilename;
117118
try {
118-
var jsonFilename = path.resolve(
119+
jsonFilename = path.resolve(
119120
patternsPath,
120121
currentPattern.subdir,
121122
currentPattern.fileName
@@ -136,8 +137,9 @@ module.exports = function(relPath, patternlab) {
136137
}
137138

138139
//look for a listitems.json file for this template
140+
let listJsonFileName;
139141
try {
140-
var listJsonFileName = path.resolve(
142+
listJsonFileName = path.resolve(
141143
patternsPath,
142144
currentPattern.subdir,
143145
currentPattern.fileName + '.listitems'

core/lib/parseLink.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,18 @@ const logger = require('./log');
66
const getPartial = require('./get');
77

88
module.exports = function(patternlab, obj, key) {
9-
let linkRE, dataObjAsString, linkMatches;
10-
119
//check for 'link.patternPartial'
12-
linkRE = /(?:'|")(link\.[A-z0-9-_]+)(?:'|")/g;
10+
const linkRE = /(?:'|")(link\.[A-z0-9-_]+)(?:'|")/g;
1311

1412
//stringify the passed in object
13+
let dataObjAsString;
1514
dataObjAsString = JSON.stringify(obj);
1615
if (!dataObjAsString) {
1716
return obj;
1817
}
1918

2019
//find matches
21-
linkMatches = dataObjAsString.match(linkRE);
20+
const linkMatches = dataObjAsString.match(linkRE);
2221

2322
if (linkMatches) {
2423
for (let i = 0; i < linkMatches.length; i++) {

core/lib/plugin_manager.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ const plugin_manager = function(config, configPath) {
2626
path.join(process.cwd(), 'node_modules', pluginName)
2727
);
2828
logger.debug(`Attempting to load plugin from ${pluginPath}`);
29+
let pluginDirStats;
2930
try {
30-
var pluginDirStats = fs.statSync(pluginPath);
31+
pluginDirStats = fs.statSync(pluginPath);
3132
} catch (ex) {
3233
logger.warning(`${pluginName} not found, use npm to install it first.`);
3334
logger.warning(`${pluginName} not loaded.`);

core/lib/pseudopattern_hunter.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,14 @@ pseudopattern_hunter.prototype.find_pseudopatterns = function(
3838
);
3939

4040
//we want to do everything we normally would here, except instead read the pseudoPattern data
41+
let variantFileFullPath;
42+
let variantFileData;
4143
try {
42-
var variantFileFullPath = path.resolve(
44+
variantFileFullPath = path.resolve(
4345
paths.source.patterns,
4446
pseudoPatterns[i]
4547
);
46-
var variantFileData = fs.readJSONSync(variantFileFullPath);
48+
variantFileData = fs.readJSONSync(variantFileFullPath);
4749
} catch (err) {
4850
logger.warning(
4951
`There was an error parsing pseudopattern JSON for ${

core/lib/starterkit_manager.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ const starterkit_manager = function(config) {
2424
)
2525
);
2626
logger.debug('Attempting to load starterkit from', kitPath);
27+
let kitDirStats;
2728
try {
28-
var kitDirStats = fs.statSync(kitPath);
29+
kitDirStats = fs.statSync(kitPath);
2930
} catch (ex) {
3031
logger.warning(
3132
`${starterkitName} not found, use npm to install it first.`

0 commit comments

Comments
 (0)