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

Template .eslintrc.js files no longer set 'root' #973

Closed
edmorley opened this issue Jun 30, 2018 · 2 comments
Closed

Template .eslintrc.js files no longer set 'root' #973

edmorley opened this issue Jun 30, 2018 · 2 comments
Assignees
Labels
Milestone

Comments

@edmorley
Copy link
Member

edmorley commented Jun 30, 2018

#825 was regressed when #852 landed, since root is no longer set in the template files, eg:
https://github.com/mozilla-neutrino/neutrino-dev/blob/e597c615e2c76e9986b6262249e35001a00efc0f/packages/create-project/commands/init/templates/airbnb/.eslintrc.js#L3

To test that this has regressed, change to a directory a couple of levels deeper, and run eg:

node ../../node_modules/eslint/bin/eslint.js --cache --ext js,jsx --report-unused-disable -directives ".*.js" "*.js" . -c ../../.eslintrc.js
Cannot read config file: C:\Users\Ed\src\treeherder\.eslintrc.js
Error: Cannot find module '.neutrinorc.js'
Error: Cannot read config file: C:\Users\Ed\src\treeherder\.eslintrc.js
Error: Cannot find module '.neutrinorc.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:594:15)
    at Function.Module._load (internal/modules/cjs/loader.js:520:25)
    at Module.require (internal/modules/cjs/loader.js:650:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at requireFromRoot (C:\Users\Ed\src\neutrino-dev\packages\neutrino\Neutrino.js:33:10)
    at Neutrino.use (C:\Users\Ed\src\neutrino-dev\packages\neutrino\Neutrino.js:201:16)
    at middleware.use.map.usage (C:\Users\Ed\src\neutrino-dev\packages\neutrino\Neutrino.js:216:44)
    at Array.map (<anonymous>)
    at Neutrino.use (C:\Users\Ed\src\neutrino-dev\packages\neutrino\Neutrino.js:216:26)
    at module.exports (C:\Users\Ed\src\neutrino-dev\packages\neutrino\index.js:21:14)
@edmorley edmorley added the bug label Jun 30, 2018
@edmorley edmorley added this to the v9 milestone Jun 30, 2018
@edmorley edmorley self-assigned this Jun 30, 2018
@edmorley
Copy link
Member Author

@eliperelman, with the current API, to fix this I have to modify the template .eslintrc.js to use:

const neutrino = require('neutrino');

module.exports = neutrino({ use: ['.neutrinorc.js'] }, { root: __dirname }).eslintrc();

It's not ideal to have to repeat the default first argument value of { use: ['.neutrinorc.js'] }.

Any thoughts on how best to change this API?

@eliperelman
Copy link
Member

Maybe merge the options into the first argument?

neutrino({ use: [...], root: ... })

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

No branches or pull requests

2 participants