-
Notifications
You must be signed in to change notification settings - Fork 0
Proposal for removing the jquery dependency #1
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
base: develop
Are you sure you want to change the base?
Conversation
* Add init method to Forms and State module so events are attached after window is loaded
selectors = selectors || {}; | ||
|
||
FileInput(selectors.fileInput); | ||
Select(selectors.select); | ||
State(selectors.state); | ||
State.init(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What was the idea here? It passes an object yet the modules expect a string. Left it blank for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is possible to change the selectors for either the FileInput, Select and State. So for instance, in this implementation,
Forms.init({ fileInput: '.someSelector', select: '.someSelector2', state: '.someSelector3' });
These values need to be passed through to the modules accordingly.
Util in uppercase, it's a class name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
Please move the Util helpers to the CastleCSS Core. There will be other libraries using the Util helpers. It's better to put them in the Core to prevent duplicate code.
-
Please implement the '.init()' function for the other modules, to remain consistent. The idea to use an explicit '.init()' function is good:)
I removed the jquery dependency from one of the modules (state). Let me know what you think.
I also added init methods, which means in a dependent project you would use castlecss-forms as follows:
require('castlecss-forms').Forms.init();
or
require('State').init();
I wasn't able to use the ESLint plugin because of the following error:
ERROR in ./js/Select.js Module build failed: Error: Failed to load plugin react: Cannot find module 'eslint-plugin-react' at Function.Module._resolveFilename (module.js:470:15) at Function.Module._load (module.js:418:25) at Module.require (module.js:498:17) at require (internal/module.js:20:19) at Object.load (C:\dev\castlecss-forms\node_modules\eslint\lib\config\plugins.js:129:26) at Array.forEach (native) at Object.loadAll (C:\dev\castlecss-forms\node_modules\eslint\lib\config\plugins.js:151:21) at Object.load (C:\dev\castlecss-forms\node_modules\eslint\lib\config\config-file.js:504:21) at loadConfig (C:\dev\castlecss-forms\node_modules\eslint\lib\config.js:63:33) at getPersonalConfig (C:\dev\castlecss-forms\node_modules\eslint\lib\config.js:84:22) at getLocalConfig (C:\dev\castlecss-forms\node_modules\eslint\lib\config.js:155:32) at Config.getConfig (C:\dev\castlecss-forms\node_modules\eslint\lib\config.js:259:26) at processText (C:\dev\castlecss-forms\node_modules\eslint\lib\cli-engine.js:224:33) at CLIEngine.executeOnText (C:\dev\castlecss-forms\node_modules\eslint\lib\cli-engine.js:754:26) at lint (C:\dev\castlecss-forms\node_modules\eslint-loader\index.js:44:31) at Object.module.exports (C:\dev\castlecss-forms\node_modules\eslint-loader\index.js:181:3)