Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Linting issue with neutrino v9 #1166

Closed
helfi92 opened this issue Oct 11, 2018 · 6 comments
Closed

Linting issue with neutrino v9 #1166

helfi92 opened this issue Oct 11, 2018 · 6 comments

Comments

@helfi92
Copy link
Member

helfi92 commented Oct 11, 2018

  • What version of Neutrino are you using?
    v9
  • Are you using the Yarn client or the npm client? What version?
    yarn, v1.10.1
  • What version of Node.js are you using?
    v8.10
  • What operating system are you using?
    macOS High Sierra
  • What did you do?
    Attempt to migrate to neutrino v9
  • What did you expect to happen?
    yarn start shows the same linting errors as yarn lint
  • What actually happened, contrary to your expectations?
    yarn start shows linting errors but yarn lint shows no errors.

Running yarn start or yarn lint with console.log(JSON.stringify(neutrino.config.toConfig(), null, 2)); in .neutrinorc.js shows the eslint baseConfig extends property set as:

  extends: [
    "/Users/haali/Documents/Mozilla/projects/taskcluster-web/node_modules/eslint-config-airbnb/index.js",
    "eslint-config-prettier",
    "plugin:react/recommended"
  ],

However, when running eslint --print-config ., the extends field is set as:

  "extends": [
    "/Users/haali/Documents/Mozilla/projects/taskcluster-web/node_modules/eslint-config-airbnb-base/rules/best-practices.js",
    "/Users/haali/Documents/Mozilla/projects/taskcluster-web/node_modules/eslint-config-airbnb-base/rules/errors.js",
    "/Users/haali/Documents/Mozilla/projects/taskcluster-web/node_modules/eslint-config-airbnb-base/rules/node.js",
    "/Users/haali/Documents/Mozilla/projects/taskcluster-web/node_modules/eslint-config-airbnb-base/rules/style.js",
    "/Users/haali/Documents/Mozilla/projects/taskcluster-web/node_modules/eslint-config-airbnb-base/rules/variables.js",
    "/Users/haali/Documents/Mozilla/projects/taskcluster-web/node_modules/eslint-config-airbnb-base/rules/es6.js",
    "/Users/haali/Documents/Mozilla/projects/taskcluster-web/node_modules/eslint-config-airbnb-base/rules/imports.js",
    "/Users/haali/Documents/Mozilla/projects/taskcluster-web/node_modules/eslint-config-airbnb-base/index.js",
    "/Users/haali/Documents/Mozilla/projects/taskcluster-web/node_modules/eslint-config-airbnb-base/rules/strict.js",
    "/Users/haali/Documents/Mozilla/projects/taskcluster-web/node_modules/eslint-config-airbnb/rules/react.js",
    "/Users/haali/Documents/Mozilla/projects/taskcluster-web/node_modules/eslint-config-airbnb/rules/react-a11y.js",
    "/Users/haali/Documents/Mozilla/projects/taskcluster-web/node_modules/eslint-config-airbnb/index.js",
    "eslint-config-prettier",
    "plugin:react/recommended"
  ]

I wonder if there's a merging issue somewhere. Here's the branch where I'm doing the migration: taskcluster/taskcluster-web#157

@edmorley edmorley added the bug label Oct 11, 2018
@edmorley edmorley added this to the v9 milestone Oct 11, 2018
@edmorley
Copy link
Member

Hi! Yeah it's possible there is a bug.

However it's worth noting that:

What would be useful would be to have the full output of

  • yarn neutrino --inspect --mode production (just the eslint section)
  • node -p "require('./.eslintrc.js')"
  • a sampling of the errors reported in yarn start but not by yarn lint

@helfi92
Copy link
Member Author

helfi92 commented Oct 11, 2018

yarn neutrino --inspect --mode production: https://gist.github.com/helfi92/e8e12dd92f12a24ea168056d7ff0fb66
node -p "require('./.eslintrc.js')": https://gist.github.com/helfi92/620ef914c5d3adc976021765477007d1

@helfi92
Copy link
Member Author

helfi92 commented Oct 11, 2018

@helfi92
Copy link
Member Author

helfi92 commented Oct 12, 2018

A sample of errors reported in yarn start: https://gist.github.com/helfi92/d40f2da45f34ad4d8b85195fe211fe6c.

@edmorley
Copy link
Member

I'll take a look soon, just deep in a few other bits at the moment.

The env field is structured a bit differently. Is this expected?

Yeah the schema for .eslintrc.js config is different from that accepted by ESLint's API (which is what eslint-loader has to use). See:
https://github.com/eslint/eslint/blob/master/conf/config-schema.js
https://eslint.org/docs/developer-guide/nodejs-api#cliengine

@edmorley
Copy link
Member

A sample of errors reported in yarn start: https://gist.github.com/helfi92/d40f2da45f34ad4d8b85195fe211fe6c.

All of those errors are in .jsx files.

The PR's lint command uses:

$ yarn lint
yarn run v1.12.0
$ eslint --cache --format codeframe --ext mjs,js src test
...

ie: --ext mjs,js needs to be --ext mjs,jsx,js.

See:
https://master.neutrinojs.org/migration-guide/#neutrino-v8-to-v9

  • neutrino lint can typically be replaced with eslint --cache --format codeframe --ext mjs,jsx,js src.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants