eslint-plugin-import-x
eslint-plugin-import-x copied to clipboard
different behavior with npm and pnpm
Setup
$ mkdir /tmp/test && cd "$_"
$ npm init -y
$ npm i -D @playwright/[email protected] [email protected] [email protected]
$ jq '.scripts += {"lint":"eslint ."}' package.json >.tmp && mv .tmp package.json
$ cat <<'EOF' >eslint.config.mjs
import { flatConfigs as importConfigs } from "eslint-plugin-import-x";
export default [importConfigs.recommended];
EOF
$ cat <<'EOF' >playwright.config.mjs
import { defineConfig } from '@playwright/test';
export default defineConfig({});
EOF
npm
Run lint:
$ npm run lint
> [email protected] lint
> eslint .
With npm there will be no error.
pnpm
Get rid of npm stuff and install pnpm stuff …
$ rm -rf node_modules package-lock.json
$ pnpm --silent install
Run lint:
$ pnpm run lint
> [[email protected]](mailto:[email protected]) lint /private/tmp/test
> eslint .
/private/tmp/test/playwright.config.mjs
1:10 error defineConfig not found in '@playwright/test' import-x/named
✖ 1 problem (1 error, 0 warnings)
ELIFECYCLE Command failed with exit code 1.
With pnpm there is an error.
https://playwright.dev/docs/test-configuration
I skipped providing a working playwright setup because it would just clutter this PR.