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
See https://github.com/steelsojka/eslint-import-alias
I have the code ready because I needed it for my codebase!
Desired output:
// Before { "~actions/*": ["src/actions/*"], "~ui/*": ["src/components/ui/*"], } // After [ { alias: '~actions', matcher: '^src\/actions' }, { alias: '~ui', matcher: '^src\/components\/ui' }, ]
It should look something like this:
const { toArray } = require('../../utils') // @see https://github.com/steelsojka/eslint-import-alias#configure function callback (name, [path], config, options) { return { alias: name.replace('/*', ''), matcher: '^' + path.replace('/*', '').replaceAll('/', '\\/').replaceAll(/\.([a-zA-Z]+)/g, '\\.$1'), } } module.exports = function (config, options) { return toArray(callback, config, options) }
And the test:
module.exports = [ function () { const expected = [ { alias: '@', matcher: '^' }, { alias: '@packages', matcher: '^..\\/packages' }, { alias: '@classes', matcher: '^classes' }, { alias: '@app', matcher: '^app' }, { alias: '@data', matcher: '^app\\/data' }, { alias: '@settings', matcher: '^app\\/settings\\.js' }, { alias: '@services', matcher: '^app\\/services' }, { alias: '@views', matcher: '^app\\/views' } ] return { expected } }, ]
Let me know if you're interested in me adding the plugin + docs to the codebase!
The text was updated successfully, but these errors were encountered:
Hello! Thanks for the contribution.
My next task is to refactor the the library to typescript, so let me check in again after that's done 🙏
Sorry, something went wrong.
No branches or pull requests
See https://github.com/steelsojka/eslint-import-alias
I have the code ready because I needed it for my codebase!
Desired output:
It should look something like this:
And the test:
Let me know if you're interested in me adding the plugin + docs to the codebase!
The text was updated successfully, but these errors were encountered: