Skip to content

Commit

Permalink
Fix linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
malept committed Dec 17, 2017
1 parent 5eb10d3 commit 9116780
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions src/js/babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default class BabelCompiler extends SimpleCompilerBase {
// installed in it. Instead, we try to load from our entry point's node_modules
// directory (i.e. Grunt perhaps), and if it doesn't work, just keep going.
attemptToPreload(names, prefix) {
if (!names.length) return null
if (!names.length) return null;

const fixupModule = (exp) => {
// NB: Some plugins like transform-decorators-legacy, use import/export
Expand All @@ -34,7 +34,7 @@ export default class BabelCompiler extends SimpleCompilerBase {
x => fixupModule(require.main.require(x)),
x => fixupModule(require(path.join(nodeModulesAboveUs, x))),
x => fixupModule(require(x))
]
];

const possibleNames = (name) => {
let names = [`babel-${prefix}-${name}`];
Expand All @@ -57,20 +57,20 @@ export default class BabelCompiler extends SimpleCompilerBase {

try {
return strategy(possibleName);
} catch(e) {}
} catch(e) {} // eslint-disable-line no-empty

return null;
}, null)
}
}, null);
};

// Pick a loading strategy that finds the first plugin, the same strategy will be
// used to preload all plugins
const selectedStrategy = preloadStrategies.reduce((winner, strategy)=>{
if (winner !== null) return winner;
return preloadPossibleNames(names[0], strategy) === null ? null : strategy;
}, null)
}, null);

return names.map(name => preloadPossibleNames(name, selectedStrategy)).filter((mod) => mod !== null)
return names.map(name => preloadPossibleNames(name, selectedStrategy)).filter((mod) => mod !== null);
}

compileSync(sourceCode, filePath, compilerContext) { // eslint-disable-line no-unused-vars
Expand Down
6 changes: 3 additions & 3 deletions src/js/typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default class TypeScriptCompiler extends SimpleCompilerBase {
};

if (isTsx && options.builtinOpts.hotModuleReload !== false) {
sourceCode = this.addHotModuleLoadingRegistration(sourceCode, filePath, this.getExportsForFile(sourceCode, filePath, options.typescriptOpts));
sourceCode = this.addHotModuleLoadingRegistration(sourceCode, filePath, this.getExportsForFile(sourceCode, filePath));
}

let output = ts.transpileModule(sourceCode, transpileOptions);
Expand Down Expand Up @@ -142,14 +142,14 @@ if (typeof __REACT_HOT_LOADER__ !== 'undefined') {
return tmpl;
}

getExportsForFile(sourceCode, fileName, tsOptions) {
getExportsForFile(sourceCode, fileName) {
let sourceFile = ts.createSourceFile(fileName, sourceCode, ts.ScriptTarget.ES6);
let ret = [];

// Walk the tree to search for classes
let visit = (node) => {
if (!this.isNodeExported(node)) return;

if (node.kind === ts.SyntaxKind.ClassDeclaration || node.kind === ts.SyntaxKind.FunctionDeclaration) {
ret.push(node.name.text);
}
Expand Down

0 comments on commit 9116780

Please sign in to comment.