Skip to content

Commit 5607f3a

Browse files
committed
[Refactor] Avoid superfluous calls and code
1 parent 112a0bf commit 5607f3a

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

Diff for: src/core/importType.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,14 @@ function isRelativeToSibling(name) {
7272
}
7373

7474
function typeTest(name, settings, path) {
75-
if (isAbsolute(name, settings, path)) { return 'absolute' }
75+
if (isAbsolute(name)) { return 'absolute' }
7676
if (isBuiltIn(name, settings, path)) { return 'builtin' }
7777
if (isInternalModule(name, settings, path)) { return 'internal' }
7878
if (isExternalModule(name, settings, path)) { return 'external' }
7979
if (isScoped(name, settings, path)) { return 'external' }
80-
if (isRelativeToParent(name, settings, path)) { return 'parent' }
81-
if (isIndex(name, settings, path)) { return 'index' }
82-
if (isRelativeToSibling(name, settings, path)) { return 'sibling' }
80+
if (isRelativeToParent(name)) { return 'parent' }
81+
if (isIndex(name)) { return 'index' }
82+
if (isRelativeToSibling(name)) { return 'sibling' }
8383
return 'unknown'
8484
}
8585

Diff for: src/rules/no-unused-modules.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ module.exports = {
355355

356356
exportCount.delete(EXPORT_ALL_DECLARATION)
357357
exportCount.delete(IMPORT_NAMESPACE_SPECIFIER)
358-
if (missingExports && exportCount.size < 1) {
358+
if (exportCount.size < 1) {
359359
// node.body[0] === 'undefined' only happens, if everything is commented out in the file
360360
// being linted
361361
context.report(node.body[0] ? node.body[0] : node, 'No exports found')

Diff for: src/rules/order.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ function makeNewlinesBetweenReport (context, imported, newlinesBetweenImports) {
340340
context.report({
341341
node: previousImport.node,
342342
message: 'There should be at least one empty line between import groups',
343-
fix: fixNewLineAfterImport(context, previousImport, currentImport),
343+
fix: fixNewLineAfterImport(context, previousImport),
344344
})
345345
} else if (currentImport.rank === previousImport.rank
346346
&& emptyLinesBetween > 0

Diff for: utils/resolve.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ function relative(modulePath, sourceFile, settings) {
6464
function fullResolve(modulePath, sourceFile, settings) {
6565
// check if this is a bonus core module
6666
const coreSet = new Set(settings['import/core-modules'])
67-
if (coreSet != null && coreSet.has(modulePath)) return { found: true, path: null }
67+
if (coreSet.has(modulePath)) return { found: true, path: null }
6868

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

0 commit comments

Comments
 (0)