rcorp / standard-project-structure

A mission to improve developer productivity. Automate Everything ™ !
Apache License 2.0
5 stars 3 forks source link

Airbnb ESLint Issues in no-undef and no-unused-expressions #54

Open akshayarise opened 7 years ago

akshayarise commented 7 years ago

I am unable to resolve the below issues , please help :- 1.) no-undef ('describe' is not defined.) no-undef ('it' is not defined.) link is here :- http://eslint.org/docs/rules/no-undef issue coming in this code :-

describe('sendgrid request is executed', () => {
  it(' its response should have executed successfully ', (done) => {
    models.college.school(
      'tUfzJg7U', {
        abhs: {
          college: 'xyz@rediffmail.com',
        },        
      },
      (err, body, response) => {
        expect(response.statusCode).to.equal(202);
        expect(response.statusMessage).to.equal('Accepted');
        expect('body').to.exist;
        done();
      });
  });
});

2.) no-unused-expressions (Expected an assignment or function call and instead saw an expression) link is here:- http://eslint.org/docs/rules/no-unused-expressions issue coming in the below code at line having

expect('body').to.exist;

describe('sendgrid request is executed', () => {
  it(' its response should have executed successfully ', (done) => {
    models.college.school(
      'b7U', {
        from: {
          school: 'abcd@gmail.com',
        },
       },
      (err, body, response) => {
        expect(response.statusCode).to.equal(202);
        expect(response.statusMessage).to.equal('Accepted');
        expect('body').to.exist;
        done();
      });
  });
});
gaurav21r commented 7 years ago

@akshaykumardell12345 Thanks for the bug reports.

For the first point, @riteshe63 Please add another eslintconfig within the \test folder with the mocha environment turned on in the testing generator. http://eslint.org/docs/user-guide/configuring#specifying-environments

For the second point @divya3103 Please note I think there is a possible difference of opinion and we will need to raise an issue @ https://github.com/chaijs/chai

DashmeetArt commented 7 years ago

"no-undef" Issues 1) no-undef ('document' is not defined.) 2) no-undef ('skateDomDiff' is not defined.)

<script>
    document.getElementById('codeView').addEventListener('keyup', () => {
        const oldDom = document.getElementById('html');
        const newDom = document.createElement('div');
        newDom.innerHTML = document.getElementById('codeView').value;
        const instructions = skateDomDiff.diff({
          destination: newDom,
          source: oldDom,
        });
        skateDomDiff.patch(instructions);
    });
  </script>

3) no-undef ('window' is not defined.)

<script>
    window.onload = function defaultValues() {
        document.getElementById('border').style.backgroundColor = 'rgba(0,0,0,0.15)';
        document.getElementById('borderOptions').style.width = '300px';
        document.getElementById('borderOptions').style.visibility = 'visible';
    };
</script>

4) no-undef ('Polymer' is not defined.)

<script>
        Polymer({
          is: 'demo',
          properties: {
</script>

"no-unused-expressions" Issues

1) no-unused-expressions (Expected an assignment or function call and instead saw and expression.)

screen shot 2016-10-27 at 3 58 45 pm