This is true for widely used tools like ESLint and Prettier, too – you can start working with them without installing any plugins. So I'm curious to have info from people using ESLint on Drupal projects : if they ran into the same errors or not, if they needed to install those 2 dependencies.Note: This post was updated in January 2022.Īs you might know, WebStorm supports many technologies out of the box. However, the drupal-bundle, which uses the airbnb-bundle, is quite clear in its documentation that you shouldn't need to : here lies the discrepancy.Īnd the Drupal ESLint documentation is quite "light" on the subject. I think the airbnb-bundle in itself is really clear about the fact that you have to install eslint yourself, as it's declared as a peer-dependency (and you have the npm warning). I'm not sure if it's a problem with the drupal-bundle, or with the way PHPStorm handles ESLint, and I haven't found any info on the web about this. and the same goes for prettier : it's in the drupal-bundle package, but it seems that the airbnb-bundle then looks for it as a neighbour to itself.if we install eslint as a dependency for our project, it installs it as a neighbour to the airbnb-bundle, and then PHPStorm ESLint can find it.so even after setting in PHPStorm the eslint path to the one in the drupal-bundle, I guess it "passes to" the airbnb-bundle and then searches for its peer-dependency (= "neighbour" eslint), but there is none.but eslint and prettier are in the drupal-bundle (= "children" of the drupal-bundle), not installed as dependencies.when we install that drupal-bundle, it installs the airbnb-bundle as another dependency (= "neighbour" to the drupal-bundle).So I'm gonna explain here what I think is going wrong : I also had to install prettier, because even after installing eslint as a dev dependency ( npm install eslint -save-dev), I had the same error for prettier. So it seems that, even though the package documentation says that you don't need to install eslint as a dependency, I had to. You must install peer dependencies yourself.Īnd then I had errors when I opened a JS file, when PHPStorm tried to lint them (even core JS files, for example, core/misc/dialog/dialog.js): Npm WARN requires a peer of 0.11.0 but none is installed. You must install peer dependencies yourself. However, first I ran into warnings, when I did the npm install eslint-config-drupal-bundle -save-dev, such as : npm WARN requires a peer of || ^5.3.0 but none is installed. So here is my problem : I'm using PHPStorm, so I followed the instructions to use ESLint in WebStorm, as they are similar products (see attached screenshot for my PHPStorm configuration). In fact, I don't know if I missed something or if there is really a problem with the bundle, that's why it's more of a support request for the moment, or need of more documentation. I report the issue here as there is apparently no possibility to report an issue on the github repo of that package, but as it's a dedicated package for Drupal, I guess the maintainer is active here also. So to install it on my project, I went to the documentation of that package : It mentions the package "eslint-config-drupal-bundle". There is this page explaining the use of ESLint in Drupal :
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |