-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
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
Feat: Create js
alias for root/app/js
#403
Conversation
Issue #77 Found the best explanation here: https://webpack.js.org/configuration/resolve/#resolvealias With this setting, all files and folders in js can now be referenced with the js alias, e.g. a module app/js/module.js should be imported in index.js as js/module.js. app/js/foo/hello.js should be imported in index.js as js/foo/hello.js.
path.resolve is necessary to make the alias work.
Lint should now use the same alias/path from webpack, i.e. js=root/app/js. parserOptions : {requireConfigFile: false} This was set to false because reading modules from the aliased path get an error about no babel config found. import/no-extranesous-dependencies: warn I had a path with a space in the folders, and that triggerd an error that I should install the folder via npm i folder-name.
This allows the use of js/ when refering to js scripts in app/js.
This is possible because of eslint-import-resolver-webpack.
Unfortunately I found some issues when testing this PR. Steps to reproduce:
This results in the following error (made slightly clearer after upgrading to ESLint 8.29.0):
It seems to be an issue with Possible solutions:
It is unlikely that we'll do (1) soon, so I'm archiving this PR as |
Changes
Closes #77
How to test
app/js
or subdirectories inapp/js
.app/js
usingjs
alias. E.g. if module is inapp/js
, usejs/name_of_module
; if module is inapp/js/dir
, usejs/dir/name_of_module
.rhino::lint_js()
andrhino::build_js()
should work.