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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

putout fails with error if .eslintrc.js specifies an eslint plugin that is installed locally #9

Closed
sgilroy opened this issue Sep 3, 2019 · 2 comments

Comments

@sgilroy
Copy link

sgilroy commented Sep 3, 2019

If putout is installed globally (as recommended, via npm i putout -g) but eslint and a plugin, such as eslint-plugin-prettier are installed locally (via npm i eslint eslint-plugin-prettier --save-dev) and enabled in the .eslintrc.js file, attempting to run putout will fail.

Example .eslintrc.js file (must exist in the current working directory):

'use strict';

module.exports = {
    env: {
        node: true,
        es6: true,
        browser: true
    },
    plugins: ['prettier'],
    extends: ['eslint:recommended']
};

Command tested: putout --fix source.js. Note that the error does not occur when --fix is not specified (such as putout source.js).

Example of the error:

Error: Cannot find module 'eslint-plugin-prettier'
    at Function.Module._resolveFilename (module.js:548:15)
    at Function.Module._load (module.js:475:25)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
    at loadPlugin (/Users/sgilroy/.nvm/versions/node/v8.15.0/lib/node_modules/putout/lib/eslint.js:26:12)
    at /Users/sgilroy/.nvm/versions/node/v8.15.0/lib/node_modules/putout/lib/eslint.js:36:25
    at getLinter (/Users/sgilroy/.nvm/versions/node/v8.15.0/lib/node_modules/putout/lib/eslint.js:57:28)
    at module.exports (/Users/sgilroy/.nvm/versions/node/v8.15.0/lib/node_modules/putout/lib/eslint.js:85:36)
    at /Users/sgilroy/.nvm/versions/node/v8.15.0/lib/node_modules/putout/lib/process-file.js:77:38
    at Array.map (<anonymous>)

Project to use to reproduce the problem:
eslint-plugin-error.zip

Workaround: install the eslint plugin globally npm i eslint-plugin-prettier -g.

@coderaiser
Copy link
Owner

You right, when we talk about eslint support would be much better to install putout locally.
Could you please update the docs?

@coderaiser coderaiser added the question Further information is requested label Sep 6, 2019
@coderaiser coderaiser added bug Something isn't working feature request and removed question Further information is requested bug Something isn't working labels Oct 4, 2019
@coderaiser
Copy link
Owner

Added ability to resolve eslint plugins paths in putout v6.12 🎉

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

No branches or pull requests

2 participants