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

console.log causes a "EPERM: operation not permitted, write" in Atom editor #783

Closed
sompylasar opened this issue Aug 23, 2016 · 3 comments
Closed
Labels

Comments

@sompylasar
Copy link

sompylasar commented Aug 23, 2016

The bug has since been reported in several places but the cause is using console.log unsafely in the eslint-plugin-react.

Here's the exception that pops up in Atom:

Error: EPERM: operation not permitted, write
    at Error (native)
    at Object.fs.writeSync (fs.js:706:20)
    at SyncWriteStream.write (fs.js:2064:6)
    at Console.log (console.js:39:16)
    at EventEmitter.Program (__CENSORED__\node_modules\eslint-plugin-react\lib\rules\require-extension.js:103:17)
    at emitOne (events.js:95:20)
    at EventEmitter.emit (events.js:182:7)
    at NodeEventGenerator.enterNode (__CENSORED__\node_modules\eslint\lib\util\node-event-generator.js:40:22)
    at CodePathAnalyzer.enterNode (__CENSORED__\node_modules\eslint\lib\code-path-analysis\code-path-analyzer.js:608:23)
    at CommentEventGenerator.enterNode (__CENSORED__\node_modules\eslint\lib\util\comment-event-generator.js:97:23)

Here's one of the faulty lines:
https://github.com/yannickcr/eslint-plugin-react/blob/v3.16.1/lib/rules/jsx-quotes.js#L52

      /* eslint-disable no-console */
      console.log('The react/jsx-quotes rule is deprecated. Please use the jsx-quotes rule instead.');
      /* eslint-enable no-console */
      isWarnedForDeprecation = true;

There are more occurences of this pattern:
https://github.com/yannickcr/eslint-plugin-react/blob/e84af68a3bf48c9a34f14e73a8b4dc1ed7488bab/lib/rules/require-extension.js#L103

        /* eslint-disable no-console */
        console.log('The react/require-extension rule is deprecated. Please ' +
                    'use the import/extensions rule from eslint-plugin-import instead.');
        /* eslint-enable no-console */
        isWarnedForDeprecation = true;

https://github.com/yannickcr/eslint-plugin-react/search?utf8=%E2%9C%93&q=console.log&type=Code

Please consider wrapping console.log in a try..catch or removing it entirely, because the eslint plugin is supposed to run in a multitude of environments without errors, but implying a valid console is an unreasonably strict requirement.

@ljharb
Copy link
Member

ljharb commented Aug 23, 2016

This is a node module. It is meant to run in node, which has console. It is a perfectly valid requirement. There is no unsafe way to use console methods in a node module.

@sompylasar
Copy link
Author

Reported to Atom core: atom/atom#12504

@ljharb
Copy link
Member

ljharb commented Aug 23, 2016

Thanks, that's the right place to fix it :-)

@ljharb ljharb closed this as completed Aug 23, 2016
@ljharb ljharb added the wontfix label Aug 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants