diff --git a/lib/index.js b/lib/index.js index cf3cb00..5353f7b 100644 --- a/lib/index.js +++ b/lib/index.js @@ -11,7 +11,7 @@ const getModulePath = (moduleName, basePath, cartridge, target) => { path.dirname(moduleName), `${basePath}/${cartridge}${target}`, ); - return (relPath.indexOf('.') === -1 ? './' : '') + relPath; + return (!relPath.includes('.') ? './' : '') + relPath; }; module.exports = (babel, { cartridgePath, basePath }) => ({ @@ -26,7 +26,7 @@ module.exports = (babel, { cartridgePath, basePath }) => ({ * @param findCartridge a function to find the cartridge */ const resolve = (findCartridge) => { - const target = imp.source.substring(1); + const target = imp.source.slice(1); const foundCartridge = findCartridge(target); if (foundCartridge) { imp.source = getModulePath(state.file.opts.filename, basePath, foundCartridge, target); diff --git a/package.json b/package.json index 1c01222..38056d3 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "semantic-release": "19.0.3" }, "dependencies": { - "@babel/types": "^7.17.0", + "@babel/types": "^7.18.10", "imports-visitor": "^2.0.0" }, "files": [ @@ -61,7 +61,10 @@ "eslintConfig": { "extends": [ "@jenssimon/base" - ] + ], + "rules": { + "unicorn/prefer-module": "off" + } }, "packageManager": "yarn@3.2.2", "config": { diff --git a/test/cartridges/.eslintrc b/test/cartridges/.eslintrc index a9a1080..cbd1583 100644 --- a/test/cartridges/.eslintrc +++ b/test/cartridges/.eslintrc @@ -2,5 +2,9 @@ "root": true, "extends": [ "@jenssimon/sfcc" - ] + ], + "rules": { + "unicorn/prefer-module": "off", + "unicorn/prefer-spread": "off" + } } diff --git a/yarn.lock b/yarn.lock index eedbb9f..4a79641 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2657,7 +2657,7 @@ __metadata: dependencies: "@babel/core": 7.18.10 "@babel/eslint-parser": 7.18.9 - "@babel/types": ^7.17.0 + "@babel/types": ^7.18.10 "@commitlint/cli": 17.0.3 "@commitlint/config-conventional": 17.0.3 "@jenssimon/eslint-config-base": 6.0.0