We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch [email protected] for the project I'm working on.
[email protected]
Here is the diff that solved my problem:
diff --git a/node_modules/eslint-plugin-no-relative-import-paths/index.js b/node_modules/eslint-plugin-no-relative-import-paths/index.js index 430fb5e..c13444e 100644 --- a/node_modules/eslint-plugin-no-relative-import-paths/index.js +++ b/node_modules/eslint-plugin-no-relative-import-paths/index.js @@ -15,14 +15,15 @@ function isSameFolder(path) { return path.startsWith("./"); } -function getAbsolutePath(relativePath, context, rootDir) { - return path - .relative( +function getAbsolutePath(relativePath, context, rootDir, prefix) { + return [ + prefix, + ...path.relative( context.getCwd() + (rootDir !== '' ? path.sep + rootDir : ''), path.join(path.dirname(context.getFilename()), relativePath) ) .split(path.sep) - .join("/"); + ].join("/");`` } const message = "import statements should have an absolute path"; @@ -35,9 +36,10 @@ module.exports = { fixable: "code", }, create: function (context) { - const { allowSameFolder, rootDir } = { + const { allowSameFolder, rootDir, prefix } = { allowSameFolder: context.options[0].allowSameFolder || false, rootDir: context.options[0].rootDir || '', + prefix: context.options[0].prefix || '', }; return { @@ -50,7 +52,7 @@ module.exports = { fix: function (fixer) { return fixer.replaceTextRange( [node.source.range[0] + 1, node.source.range[1] - 1], - getAbsolutePath(path, context, rootDir || '') + getAbsolutePath(path, context, rootDir || '', prefix) ); }, }); @@ -63,7 +65,7 @@ module.exports = { fix: function (fixer) { return fixer.replaceTextRange( [node.source.range[0] + 1, node.source.range[1] - 1], - getAbsolutePath(path, context, rootDir || '') + getAbsolutePath(path, context, rootDir || '', prefix) ); }, });
This issue body was partially generated by patch-package.
The text was updated successfully, but these errors were encountered:
This would be very useful 😍
Sorry, something went wrong.
I was looking to have this feature implemented as well.
No branches or pull requests
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch
[email protected]
for the project I'm working on.Here is the diff that solved my problem:
This issue body was partially generated by patch-package.
The text was updated successfully, but these errors were encountered: