Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve Peer Dependancy Range #310

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mattwatsoncodes
Copy link

@mattwatsoncodes mattwatsoncodes commented Aug 4, 2023

Attempts to address #301 through the implementation of #252.

Using the method outlined in this comment: #301 (comment) I added the rules to the index.js file, removed eslint-config-react-app as a dependancy and added plugin:react/recommended to eslint extends property.

Please note: This is my first attempt at working with npm packages, so conscious that this may not be correct, so submitting this in order to gather feedback and learning.

TESTING (and points of note)

I tested locally by running npm pack --pack-destination ~ which output the plugin as a zip file: humanmade-eslint-config-1.3.0.tgz

Then I edited a project to place this local file within the devDependancies of that projects package.json like so:

 "devDependencies": {
    "@humanmade/eslint-config": "file:~/humanmade-eslint-config-1.3.0.tgz",
    ...

Also because I could not get the script npx install-peerdeps --dev @humanmade/eslint-config@latest to install from my local file I installed the peerDependancies like so:

npm install --save-dev babel-eslint eslint-plugin-flowtype eslint-plugin-import eslint-plugin-jsdoc eslint-plugin-jsx-a11y eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-sort-destructure-keys 

and then ran

npm install

Once this was done I could check the linting in my project by running:

./node_modules/.bin/eslint -c ./node_modules/@humanmade/eslint-config/index.js path/to/my-file.js

Which runs and appears to work successfully 馃コ

However note that in the documentation it states that I should be able to run:

./node_modules/.bin/eslint -c @humanmade/eslint-config path/to/my-file.js

However in my tests @humanmade/eslint-config could not be found without the prefix of ./node_modules/ and also if you point at the folder instead of the index.js (or the .eslintrc) file, you get the error Error: Cannot read config file.

I put this down to the setup of my test project, as I know you can set aliases for node_modules, but if something needs adjusting so we can use this syntax I'm all ears.

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

Successfully merging this pull request may close these issues.

None yet

1 participant