coderaiser / putout

🐊 Pluggable and configurable JavaScript Linter, code transformer and formatter, drop-in ESLint superpower replacement πŸ’ͺ with built-in support for js, jsx, typescript, flow, markdown, yaml and json. Write declarative codemods in a simplest possible way 😏
https://putout.cloudcmd.io/
MIT License
698 stars 40 forks source link

Getting error for apply-nullish-coalescing #182

Closed faran-tenovos closed 1 year ago

faran-tenovos commented 1 year ago

After updating to v2 of apply-nullish-coalescing I get the following error. I'm using type module in package.json

Error: require() of ES Module /Some-user/node_modules/.pnpm/@putout+plugin-apply-nullish-coalescing@2.0.0_putout@31.8.4/node_modules/@putout/plugin-apply-nullish-coalescing/lib/apply-nullish-coalescing.js from /some-user/node_modules/.pnpm/putout@31.8.4/node_modules/putout/lib/putout.js not supported

coderaiser commented 1 year ago

How do you use 🐊Putout? CLI, API or ESLint plugin?

If it is ESLint you need this esm preset. If API you need to use asyn version.

faran-tenovos commented 1 year ago

I use it via ESLint

coderaiser commented 1 year ago

You can’t try to update your ESLint config with:

{
    "extends": [
        "plugin:putout/esm"
    ],
    "plugins": [
        "putout"
    ]
}

Is it works for you?

faran-tenovos commented 1 year ago

I moved past forward that error but now I'm getting Error: Avoid 'use strict' in ESM (strict-mode/remove-useless) putout/putout I'm using next.js and need to add 'use client' at top of the client-side components

coderaiser commented 1 year ago

Could you please provide code example?

coderaiser commented 1 year ago

Just fixed with @putout/plugin-strict-mode v8, please re-install 🐊Putout. Is it works for you?

faran-tenovos commented 1 year ago

@coderaiser it works now. Thanks for such quick support.