Skip to content

Commit

Permalink
[Refactor] Avoid superfluous calls and code
Browse files Browse the repository at this point in the history
  • Loading branch information
brettz9 committed Dec 3, 2019
1 parent 112a0bf commit 5607f3a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/core/importType.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ function isRelativeToSibling(name) {
}

function typeTest(name, settings, path) {
if (isAbsolute(name, settings, path)) { return 'absolute' }
if (isAbsolute(name)) { return 'absolute' }
if (isBuiltIn(name, settings, path)) { return 'builtin' }
if (isInternalModule(name, settings, path)) { return 'internal' }
if (isExternalModule(name, settings, path)) { return 'external' }
if (isScoped(name, settings, path)) { return 'external' }
if (isRelativeToParent(name, settings, path)) { return 'parent' }
if (isIndex(name, settings, path)) { return 'index' }
if (isRelativeToSibling(name, settings, path)) { return 'sibling' }
if (isRelativeToParent(name)) { return 'parent' }
if (isIndex(name)) { return 'index' }
if (isRelativeToSibling(name)) { return 'sibling' }
return 'unknown'
}

Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-unused-modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ module.exports = {

exportCount.delete(EXPORT_ALL_DECLARATION)
exportCount.delete(IMPORT_NAMESPACE_SPECIFIER)
if (missingExports && exportCount.size < 1) {
if (exportCount.size < 1) {
// node.body[0] === 'undefined' only happens, if everything is commented out in the file
// being linted
context.report(node.body[0] ? node.body[0] : node, 'No exports found')
Expand Down
2 changes: 1 addition & 1 deletion src/rules/order.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ function makeNewlinesBetweenReport (context, imported, newlinesBetweenImports) {
context.report({
node: previousImport.node,
message: 'There should be at least one empty line between import groups',
fix: fixNewLineAfterImport(context, previousImport, currentImport),
fix: fixNewLineAfterImport(context, previousImport),
})
} else if (currentImport.rank === previousImport.rank
&& emptyLinesBetween > 0
Expand Down
2 changes: 1 addition & 1 deletion utils/resolve.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function relative(modulePath, sourceFile, settings) {
function fullResolve(modulePath, sourceFile, settings) {
// check if this is a bonus core module
const coreSet = new Set(settings['import/core-modules'])
if (coreSet != null && coreSet.has(modulePath)) return { found: true, path: null }
if (coreSet.has(modulePath)) return { found: true, path: null }

const sourceDir = path.dirname(sourceFile)
, cacheKey = sourceDir + hashObject(settings).digest('hex') + modulePath
Expand Down

0 comments on commit 5607f3a

Please sign in to comment.