Closed Nexucis closed 4 years ago
I dont use lint so much, I have my preferred style and I dont impose code styles. For example depending on actual code I change my code style inside same codebase if for no other reason for better visual and conceptual purposes. Thus eslint is NOT a tool I use.
I would prefer to make NPM integration myself. Let me thiink..
Thanks for your answer :).
Regarding lint in general speaking, it's not just about the code style. Lint can also analyze your code to find weird behavior, possible bugs, unnecessary if else condition, security issue ...etc. And then lint is just matter of convention afterall in order to make your code easier to read by others ^^.
Concerning ESLint particularly, well I thought it was a good idea since it is the lint choose by the Javascript and Typescript community in order to have similar convention between both community.
But if you don't want to use it, I can remove it, it's not a big deal.
Finally regarding NPM itself, if you want to do it I can understand that as well :). It is just for the moment I have some time to do it, and maybe it won't be the case next week. So I thought it will be nice to speed up a bit the migration :).
Shall I close the PR ?
I am aware of lint functionality and dont use it on purpose. I mix code-styles on purpose and lint cannot handle that case. So unless I am in a project with other people that lint needs to be used, I myself dont use it.
Yes close the PR, I will do NPM integration myself. Do you need codemirror-grammar on npm or editor-grammar as well? I will integrate codemirror-grammar, because editor-grammar is used as submodule and I am not sure I want to export it as independent project.
Hope this is not causing you trouble, else you can simply fork and export it in your account
Thank you nevertheless!
I just need codemirror-grammar on npm :). But well I started by this one since everything is using this one ^^.
I already tried to import the minify js file of codemirror-grammar but it seems it is blocked by Angular somehow with this lovely warning message:
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
So I'm hoping it will work a bit better when importing it through NPM ^^.
Your message I think is not related to codemirror-grammar per-se as other people have sucessfuly imported it in their own projects using react or angular. Maybe it is the way you try to import it. It has no dependencies by itself, so I doubt the warnign is about the library per se. It can be used in your project as is.
In any case I will add npm integration the sooner I can, but I still think the warning is not about the library itself.
Check this issue and solution therein for importing codemirror-grammar addon
Great thanks for the tips ! I will try that as soon as possible!
@Nexucis In addition to the previous answer and the way to define local modules in a npm project. There iare ways to make external pure js libraries conform to typescript structure, simply by adding the missing type defintions. This can be as simple as adding one line of typescript code to a custom file with .d.ts
extension or as complex as reading the source and adding exact type defintions that also enable proper autocompletion in IDEs that support typescript.
Note: It is possible that in near future I will add typescript type definitions to all my pure js projects, as a way to be more compatible with typescript projects. But for now you can do this yourself, no hassle.
To learn how to do this read following articles (very easy). https://www.credera.com/blog/technology-solutions/typescript-adding-custom-type-definitions-for-existing-libraries/ https://www.detroitlabs.com/blog/2018/02/28/adding-custom-type-definitions-to-a-third-party-library/
These suggestions should resolve the issue here as well.
So to summarise:
Of course at some point I myself will both add some projects on npm and add missing typescript types (while leaving the source code in pure js as is) simply to lift some difficulties, but untill I do that myself you can do it yourself
Thanks @foo123 for the different suggestion. As you can see here, I indeed succeeded to integrate and use the grammar lib for codemirror.
I personnaly just don't lilke to copy/past some lib and version it on my own side, specially when there is a dependency manager that handle this kind of problem properly.
@Nexucis of course I need to get some of my projects on npm (and composer, pip etc..) :) Unitll that time, which I hope to be near, glad you managed to fix the issue
Hello,
I initialized the different package.json file in order later to be able to get this lib through npm :).
As you may noticed, I put eslint as well and if you are agree to use it:
(linked to the issue https://github.com/foo123/codemirror-grammar/issues/14)