Skip to content
This repository has been archived by the owner on Jun 20, 2019. It is now read-only.

Update dependencies for install #38

Closed
swashata opened this issue Mar 13, 2018 · 8 comments
Closed

Update dependencies for install #38

swashata opened this issue Mar 13, 2018 · 8 comments

Comments

@swashata
Copy link
Contributor

I understand that eslint-config-wordpress is the only package I need to install for eslinting with WordPress standard and not the eslint-plugin-wordpress as the first should have the second as a dependency.

But I think, because the dependency is defined in devDependencies and not within dependencies the eslint-plugin-wordpress never gets installed.

I added eslint-config-wordpress like this (because the one in package repo is outdated.

{
  "name": "wesbos-js-es6",
  "version": "1.0.0",
  "main": "index.js",
  "repository": "git@wpquark.io:swashata/wesbos-js-es6.git",
  "author": "Swashata Ghosh <swashata@wpquark.com>",
  "license": "MIT",
  "private": true,
  "devDependencies": {
    "eslint": "^4.18.2",
    "eslint-config-wordpress": "git://github.com/WordPress-Coding-Standards/eslint-config-wordpress.git#936392374db7bb8403efb99bb8d454519b166947",
    "eslint-plugin-html": "^4.0.2",
    "eslint-plugin-react": "^7.7.0"
  }
}
yarn install --force

But this always complains

ESLint: ENOENT: no such file or directory, open '/Volumes/Development/vagrant/www/es6/public_html/wesbos-js-es6/node_modules/eslint-plugin-wordpress/index.js'. Please see the 'ESLint' output channel for details.

So I update the package.json and link the dependency manually by

{
  "name": "wesbos-js-es6",
  "version": "1.0.0",
  "main": "index.js",
  "repository": "git@wpquark.io:swashata/wesbos-js-es6.git",
  "author": "Swashata Ghosh <swashata@wpquark.com>",
  "license": "MIT",
  "private": true,
  "devDependencies": {
    "eslint": "^4.18.2",
    "eslint-config-wordpress": "git://github.com/WordPress-Coding-Standards/eslint-config-wordpress.git#936392374db7bb8403efb99bb8d454519b166947",
    "eslint-plugin-html": "^4.0.2",
    "eslint-plugin-react": "^7.7.0",
    "eslint-plugin-wordpress": "git://github.com/WordPress-Coding-Standards/eslint-plugin-wordpress.git#a5fdd5177c747562ddc3b03e069fcbf131632490"
  }
}

and now this works as expected.

Is it the intended behavior or is there something wrong?

@ntwb
Copy link
Member

ntwb commented Mar 13, 2018

Thanks for the detailed issue @swashata, I think this is a Yarn specific issue to be honest (if it was also npm I'd have expected similar reported issues)

Currently eslint-plugin-wordpress is only used in devDependencies so that the codebase here in this eslint-config-wordpress repo can use some of the planned rule enhancements included in eslint-plugin-wordpress

There is also quite possibly some incompatibility between the versions you are using, the v2.0.0 release of eslint-config-wordpress is not outdated, it is the current and recommended version to use.

With all that said, later today I'll be releasing some new versions of both the packages in question which will resolve this issue anyway (I believe)

@ntwb ntwb closed this as completed Mar 13, 2018
@swashata
Copy link
Contributor Author

Great. I will be waiting for the release.

Just to clarify, if I use eslint-config-wordpress from npm,

"devDependencies": {
    "eslint": "^4.18.2",
    "eslint-config-wordpress": "^2.0.0",
    "eslint-plugin-html": "^4.0.2",
    "eslint-plugin-react": "^7.7.0"
  }

there was some other error, like ~/.rules not found. I don't remember the error exactly, but I think it was related to WordPress-Coding-Standards/eslint-plugin-wordpress#106

@ntwb
Copy link
Member

ntwb commented Mar 14, 2018

Theoretically the release of eslint-config-wordpress will be version "2.1.0", so the semver range you have of "^2.0.0" will cover the release

@swashata
Copy link
Contributor Author

Great...

@swashata
Copy link
Contributor Author

@ntwb I just want to let you know that I was wrong with the ~/.rules not found error. I really messed up before while getting the error. Basically within the project, I had eslint-config-wordpress and within .eslintrc.js file, I had wordpress in the plugins directive. But I didn't install eslint-plugin-wordpress so it was yelling at me for (obviously) not finding the eslint-plugin-wordpress.

I understand why I was wrong. Now I have set things up with VSCode to automatically fix possible errors and formatting on save. Do you think I can send a PR with documentation for the same?

@ntwb
Copy link
Member

ntwb commented Mar 14, 2018

Thanks for the update @swashata... It's pretty easy to do, I've got myself confused a couple of times in the past 24 hours 😏

A PR with those docs would be fanastic 😄

@swashata
Copy link
Contributor Author

Alright. One last thing. Should the docs go into README or a separate folder like docs/vscode-setup.md docs/eslint-setup.md etc.

@ntwb
Copy link
Member

ntwb commented Mar 14, 2018

This option docs/vscode-setup.md sounds good for now 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants