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

Shell ESLint file incorrectly extends cli-style ESLint config #263

Closed
varl opened this issue Jan 15, 2020 · 1 comment · Fixed by #264
Closed

Shell ESLint file incorrectly extends cli-style ESLint config #263

varl opened this issue Jan 15, 2020 · 1 comment · Fixed by #264
Assignees
Labels

Comments

@varl
Copy link
Contributor

varl commented Jan 15, 2020

I am getting this error using the shell in combination with a custom ESLint configuration.

varl@veronika:~/dev/dhis2/apps/usage-analytics$ yarn start
yarn run v1.21.1
$ d2-app-scripts start
Generating internationalization strings... 
No i18n updates found! 
Bootstrapping local appShell... 
Copying appShell to temporary directory... 
Building app usage-analytics-app... 
 
Starting development server... 
The app usage-analytics-app is now available on port 3000 
 
Error: ESLint configuration in .eslintrc.js is invalid:
        - Property "extends" is the wrong type (expected string but got `[{"extends":["/home/varl/dev/dhis2/apps/usage-analytics/node_modules/@dhis2/cli-style/config/js/eslint-react.config.js"]}]`).
        - Property "extends[0]" is the wrong type (expected string but got `{"extends":["/home/varl/dev/dhis2/apps/usage-analytics/node_modules/@dhis2/cli-style/config/js/eslint-react.config.js"]}`).
        - "extends" should match exactly one schema in oneOf. Value: [{"extends":["/home/varl/dev/dhis2/apps/usage-analytics/node_modules/@dhis2/cli-style/config/js/eslint-react.config.js"]}].

    at validateConfigSchema (/home/varl/dev/dhis2/apps/usage-analytics/node_modules/eslint/lib/shared/config-validator.js:286:15)
[...]
 error Command failed with exit code 1.
 [ERROR] Start script exited with non-zero exit code 
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

The problem is this line: https://github.com/dhis2/app-platform/blob/master/shell/.eslintrc.js#L8

const extendsArray = hasCustomConfig
    ? [require(customConfigFile)]
    : ['react-app']

If changed to:

 const extendsArray = hasCustomConfig
     ? [customConfigFile]
     : ['react-app']

It correctly extends the configuration. ESLint does the require part internally.

Reference: https://eslint.org/docs/developer-guide/shareable-configs

@varl varl self-assigned this Jan 15, 2020
dhis2-bot added a commit that referenced this issue Jan 15, 2020
## [3.1.3](v3.1.2...v3.1.3) (2020-01-15)

### Bug Fixes

* **eslint:** allow eslint to internally require the custom config ([#264](#264)) ([27d6693](27d6693)), closes [#263](#263)
@dhis2-bot
Copy link
Contributor

🎉 This issue has been resolved in version 3.1.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging a pull request may close this issue.

2 participants