title: ES6: For Classes to have a Single Definition for Each Method
body: <p>Recently, after a vcs merge gone wrong, we discovered that ES6 classes (at least in NodeJS) allow you to have a method defined twice.  i.e. the below program runs without complaint. </p>
  
  <pre><code>class Test {
    foo() {
      console.log("first one")
    }
  
    foo() {
      console.log("second one")
    }
  }
  const test = new Test;
  test.foo()
  </code></pre>
  
  <p>In our real world example the two method definitions were pretty far apart in the source file and it had us stumped for a while. Is there a way to force ES6 classes in NodeJS to <em>not</em> allow this?  Is there a flag we can run <code>node</code> with that will not allow this, or maybe an es-lint rule?  Or some third thing I'm not thinking of?</p>
  
  <p>We'd basically like something that will prevent our program from running if there's a single class with two methods defined.</p>