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

v17 no longer respects env specified in package.json #1814

Open
GaryGSC opened this issue May 24, 2022 · 2 comments
Open

v17 no longer respects env specified in package.json #1814

GaryGSC opened this issue May 24, 2022 · 2 comments

Comments

@GaryGSC
Copy link

GaryGSC commented May 24, 2022

A minimal reproduction is available at the repo garygsc/standardjs-regression, which has two commits.

What version of this package are you using?
There's a regression when switching from 16.0.4 to 17.0.0 that wasn't documented in the changelog.

What operating system, Node.js, and npm version?
OS: ubuntu-latest (20.04.4)
Node.js version: 16.x (v16.15.0, which comes with npm v8.5.5)

What happened?
Standard exited with exit code 1 and the following errors:

standard: Use JavaScript Standard Style (https://standardjs.com)
  /home/runner/work/standardjs-regression/standardjs-regression/index.test.js:1:1: 'describe' is not defined. (no-undef)
  /home/runner/work/standardjs-regression/standardjs-regression/index.test.js:2:3: 'test' is not defined. (no-undef)
  /home/runner/work/standardjs-regression/standardjs-regression/index.test.js:3:5: 'expect' is not defined. (no-undef)

What did you expect to happen?
Because the package.json specified

"standard": {
  "env": {
    "jest": true
  }
}

we expected exit code 0 with no errors, like what happens with standard@16.0.4.

Are you willing to submit a pull request to fix this bug?
Yeah. It looks like standard-engine's the repo that handles creating an ESLint config from the package.json, so this issue might be in the wrong place.

@klaemo
Copy link

klaemo commented May 29, 2022

Looking at the resolve-eslint-config.js code you linked it seems like the config syntax changed slightly to:

"standard": {
  "env": ["jest"]
}

This also fixed it for me locally.

@LinusU
Copy link
Member

LinusU commented May 30, 2022

@klaemo nice find!

Would be happy to accept a PR to improve the documentation

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

No branches or pull requests

3 participants