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.

Proposal: validate eslintrc's properties

See original GitHub issue

Tell us about your environment

  • ESLint Version: 3.17.1
  • Node Version: 7.2.0
  • npm Version: 3.10.9

Please show your full configuration:

module.exports = {
	ecmaVersion: 2017
};

Current behavior

ESLint ignores properties it doesn’t understand

Suggested behavior

ESLint cli prints a notice about the invalid eslintrc

y tho

The config above looks fine, the property name is correct but its position is wrong. It should be like this:

module.exports = {
	parserOptions: {
		ecmaVersion: 2017
	}
};

I was wondering why ESLint wasn’t recognizing my async/await and --debug didn’t mention anything wrong with the config 😦

This didn’t help either, it looked like it was correctly picked up:

$ eslint --print-config index.js
{
  "globals": {},
  "env": {},
  "rules": {},
  "parserOptions": {},
  "ecmaVersion": 2017
}

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:4
  • Comments:15 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
not-an-aardvarkcommented, Mar 18, 2017

@btmills That sounds like a good idea and is worth further discussion. For the purposes of this issue, though, it seems orthogonal to the question of whether ESLint should validate espree’s config (since we can always add a way for parsers to opt-in to schema validation later). For now, I think we should go with the following:

  • Validate top-level properties
  • Do not validate espree’s options from eslint
  • Maybe validate espree’s options from espree, at runtime

There are a few reasons I’m opposed to adding a special case to validate parserOptions when the default parser is used:

  • It couples eslint and espree together. The two projects are maintained by the same team, but they’re different projects. Having to update a schema update in eslint whenever we add an option to espree seems like it would be a code smell, and it would also prevent people from using new espree options until we released a new version of eslint with a schema to allow those options.
  • It adds a capability to the default parser that isn’t possible for any other parsers. This seems like it would go against eslint’s “everything-is-pluggable” philosophy.
1reaction
btmillscommented, Mar 17, 2017

Instead of doing their own error handling, what if parsers could optionally supply a schema for their options?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Setting up ESLint to work with new or proposed JavaScript ...
I'm opting to use @babel/preset-env because it has an easy way to enabled proposals that are shipped in Browsers/Node. Other presets/plugins are ...
Read more >
eslint-config-standard with @babel/plugin-proposal-class ...
I'm setting up eslint with eslint-config-standard. I'm also using babel plugin that @babel/plugin-proposal-class-properties. I tried lint my ...
Read more >
eslint-plugin-proposal - npm
Start using eslint-plugin-proposal in your project by running `npm i eslint-plugin-proposal`. There is 1 other project in the npm registry ...
Read more >
Configuring ESLint - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
Setting up efficient workflows with ESLint, Prettier and ...
By default, ESLint will only check for syntax errors. ... how to interpret the naming convention within the properties to be able to...
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