2
I’ve taken several times package.json
libraries "@types/..."
in "dependencies"
instead of "devDependencies"
.
It is that they were installed without adding the parameter -D
during the yarn add
. Mistakes happen and it’s completely normal.
Some devs end up installing the dependency incorrectly and it gets annoying to keep requiring them over and over again to take this care.
VS Code here does not display any warning message when it is like this.
Then it would be possible to program a test in VS Code to check for dependencies "@types/..."
who are in "dependencies"
but they should be "devDependencies"
using Typescript?
And if there are libraries that are in the wrong location, display an alert message on the PROBLEMS console of the VS Code type:
A biblioteca "@types/..." está no local incorreto no "package.json"! Ela deveria estar em "devDependencies" em vez de "dependencies".
A biblioteca "@types/..." está no local incorreto no "package.json"! Ela deveria estar em "devDependencies" em vez de "dependencies".
As the warning message needs to be in English, maybe it could look like this:
The library "@types / ..." is in the wrong location in "package.json"! It should be in "devDependencies" instead of "dependencies".
The library "@types / ..." is in the wrong location in "package.json"! It should be in "devDependencies" instead of "dependencies".
(I’m taking a chance on English! Forgive me! )
If devs do not take this care there can be multiple libraries on the application deploy without need. The deploy gets even slower because of this!
Is it possible to program this? Or does this already exist?
It makes sense to program this in VS Code in order to help devs take this kind of care?
I honestly think this has nothing to do with the purpose of Eslint. As the name says, "Ecmascript Lint". And that, at least in my view, does not seem to me to be the responsibility of the Eslint, since this is not about language Ecmascript (alias Javascript) itself, but yes from ambience development. What seems most appropriate to me is to create a script
postinstall
that runs any script to do this check. Another possibility is to delegate this to something like an IC, but then it seems to me a certain exaggeration.– Luiz Felipe
@Luizfelipe Really you’re right! Thank you! Eslint is not for checking JSON files. Eslint is a static code analysis tool to identify problematic patterns found in Javascript code. I will edit the question statement by removing the term "Eslint". All right?
– Deividson Damasio