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.

Rules redefining: shallow or deep?

See original GitHub issue

What version of ESLint are you using?

2.11.1

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

default

Please show your full configuration:

{
  "extends": [
    "eslint:recommended",
    "airbnb-base"
  ],

  "rules": {
    "eqeqeq": 2,
    "no-console": 0
  }
}

What did you do?..

After reading the documentation about cascading, hierarchy and rules redefining, I wrongly supposed that rules in the user .eslintrc file redefine rules in the extends files as a whole, i.e. if the airbnb-base sets 'no-unused-vars': [2, { 'vars': 'local', 'args': 'after-used' }] and I sets "no-unused-vars": 2 the results will be just "no-unused-vars": 2.

However, the eslint --print-config tests have taught me that I should redefine each option from extends file manually (i.e. the results above will be still "no-unused-vars": [2, { "vars": "local", "args": "after-used" }] if I does not redefine vars and args).

Maybe I’ve missed something in the docs. If I have not, maybe it is worth more clarirfication.

However, I don’t understend how can I cancel array options from extends files rules. So, if airbnb-base sets 'eqeqeq': [2, 'allow-null'], how can I cancel 'allow-null'?

With .eslintrc.json example above and this file:

console.log(undefined == null);

console.log(undefined == 0);

eslint says just:

  3:23  error  Expected '===' and instead saw '=='  eqeqeq

✖ 1 problem (1 error, 0 warnings)

and eslint --print-config inticates that result rule is still

"eqeqeq": [2, "allow-null"]

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:27 (23 by maintainers)

github_iconTop GitHub Comments

9reactions
vsemozhetbytcommented, Jun 10, 2016

@nzakas So is this an intentional merging scheme?

eqeqeq: [2, "allow-null"]
+
eqeqeq: 2
=
eqeqeq: [2, "allow-null"]

while

quotes: [2, "single", "avoid-escape"]'
+
quotes: [2, "single"]
=
quotes: [2, "single"]
6reactions
michaelficarracommented, Jun 10, 2016

So we’ll point users to documentation that tells them there’s no way to do something that is very reasonable to want to do? 😟 I don’t think that makes it much better. We should fix this. It’s a broken design.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Deep Work vs. Shallow Work: 8 Tips to Maximize Productivity
Redefining the hustle of modern worklife is key to unlocking the potential of deep work, and the benefits speak for themselves.
Read more >
What Is Deep Work and How To Practice It (Complete Guide)
Newport's book Deep Work: Rules for Focused Success in a Distracted World, defined deep work as: “Professional activity performed in a state of ......
Read more >
Mind Macros 22: Talent vs. discipline, redefining wrong, and deep ...
"Shallow Work: Noncognitively demanding, logistical-style tasks, often performed while distracted. These efforts tend to not create much new value in the world ...
Read more >
UCLA LAW REVIEW RULES AND STANDARDS
a rule against a standard are extremely common in legal discourse. ... deep value rifts between altruist and individualist outlooks.57 A third view...
Read more >
Compete With Industry Giants By Redefining The Rules - Forbes
In each of these examples, entrepreneurs redefined the rules and the marketplace. Here are four steps you can take to help redefine your ......
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