question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Schema validation modifies exported config object in .eslintrc.js

See original GitHub issue

Tell us about your environment

  • ESLint Version: 6.7.0
  • Node Version: 12.13.1
  • npm Version: 6.12.1

What parser (default, Babel-ESLint, etc.) are you using? babel-eslint

Please show your full configuration:

Configuration
// .eslintrc.basic.js
module.exports = {
  plugins: [],

  extends: [
    'eslint:all'
  ],

  parser: 'espree',

  parserOptions: {
    ecmaVersion: 7,
    sourceType: 'module'
  },

  settings: {},

  env: {
    es6: true
  },

  rules: {
    'camelcase': ['warn', {properties: 'never'}]
  }
}

// .eslintrc.babel.js
let _basic = require('./.eslintrc.basic');

module.exports = {
  parser: 'babel-eslint',

  parserOptions: {
    sourceType: 'module'
  },

  plugins: [
    'babel'
  ],

  rules: {
    camelcase: 'off',
    'babel/camelcase': _basic.rules.camelcase
  }
};

// .eslintrc.js
module.exports: {
  extends: [
    './.eslintrc.basic.js',
    './.eslintrc.babel.js'
  ]
}

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

N/A
N/A

What did you expect to happen?

I expected no errors.

What actually happened? Please include the actual, raw output from ESLint.

	Configuration for rule "babel/camelcase" is invalid:
	Value {"properties":"never","ignoreDestructuring":false,"ignoreImports":false} should NOT have additional properties.

This happens because of https://github.com/eslint/eslint/pull/12528 adding ignoreImports with default value failse, and because the defaults of camelcase are merged into the same object in .eslintrc.basic.js:rules.camelcase, which is also the same reference in .eslintrc.babel.js:rules.@babel/camelcase.

Are you willing to submit a pull request to fix this bug?

Sure.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:4
  • Comments:26 (17 by maintainers)

github_iconTop GitHub Comments

3reactions
nzakascommented, Nov 27, 2020

I’ll tackle this as part of the new config system.

3reactions
kaicataldocommented, Jun 30, 2020

Reopening this so we can find another solution.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Working with Rules - ESLint - Pluggable JavaScript Linter
Rules may export a schema property, which is a JSON schema format description of a rule's options which will be used by ESLint...
Read more >
Configuration Files - ESLint - Pluggable JavaScript Linter
A sharable configuration is an npm package that exports a configuration object. Make sure that you have installed the package in your project...
Read more >
Migrating to v2.0.0 - ESLint - Pluggable JavaScript Linter
To address: If you are exporting a rule schema that checks severity, you need to make several changes: Remove the severity from the...
Read more >
Configuring ESLint - ESLint - Pluggable JavaScript Linter
ESLint is designed to be flexible and configurable for your use case. You can turn off every rule and run only with basic...
Read more >
Migrating to v6.0.0 - ESLint - Pluggable JavaScript Linter
This guide is intended to walk you through the breaking changes. ... any unknown values in a globals object result in a config...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found