Skip to content

Commit

Permalink
Merge pull request ember-fastboot#210 from ember-fastboot/add-eslint
Browse files Browse the repository at this point in the history
Add Eslint to this project
  • Loading branch information
kratiahuja committed Dec 19, 2018
2 parents b467f9b + 8128c6b commit cafd96c
Show file tree
Hide file tree
Showing 16 changed files with 624 additions and 180 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test/fixtures
test/helpers
22 changes: 22 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
module.exports = {
'env': {
'browser': true,
'node': true,
'es6': true,
},
'extends': ['eslint:recommended', 'plugin:node/recommended'],
'parserOptions': {
'ecmaVersion': 6
},
'rules': {
'no-console': ['error', { 'allow': ['warn', 'error']}],
'linebreak-style': [
'error',
'unix'
],
'semi': [
'error',
'always'
]
}
};
3 changes: 0 additions & 3 deletions .jshintignore

This file was deleted.

6 changes: 0 additions & 6 deletions .jshintrc

This file was deleted.

10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@
"main": "src/index.js",
"scripts": {
"changelog": "lerna-changelog",
"lint": "node_modules/.bin/eslint src test",
"test": "mocha",
"preversion": "npm test",
"preversion": "npm lint && npm test",
"postversion": "git push origin master --tags"
},
"repository": {
"type": "git",
"url": "git+https://github.com/ember-fastboot/fastboot.git"
},
"engines": {
"node": ">= 6.0.0"
"node": "^6.14.0 || ^8.10.0 || >=9.10.0"
},
"keywords": [
"ember",
Expand All @@ -40,10 +41,13 @@
"chai": "^4.1.0",
"chai-as-promised": "^7.1.1",
"ember-source": "3.2.0",
"eslint": "^5.10.0",
"eslint-plugin-chai-expect": "^2.0.1",
"eslint-plugin-mocha": "^5.2.0",
"eslint-plugin-node": "^8.0.0",
"express": "^4.15.4",
"lerna-changelog": "^0.8.2",
"mocha": "^5.2.0",
"mocha-jshint": "^2.3.1",
"rimraf": "^2.6.2",
"temp": "^0.8.3"
}
Expand Down
4 changes: 2 additions & 2 deletions src/result.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ class Result {
body = HTMLSerializer.serializeChildren(body);

this._head = head;

// Adding script boundary around the body
this._body = `<script type="x/boundary" id="fastboot-body-start"></script>${body}<script type="x/boundary" id="fastboot-body-end"></script>`;
}
Expand All @@ -186,7 +186,7 @@ function insertIntoIndexHTML(html, htmlAttributes, head, body, bodyAttributes) {
let isBodyReplaced = false;
let isHeadReplaced = false;

html = html.replace(/<\!-- EMBER_CLI_FASTBOOT_(HEAD|BODY) -->/g, function(match, tag) {
html = html.replace(/<!-- EMBER_CLI_FASTBOOT_(HEAD|BODY) -->/g, function(match, tag) {
if (tag === 'HEAD' && head && !isHeadReplaced) {
isHeadReplaced = true;
return head;
Expand Down
45 changes: 45 additions & 0 deletions test/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
module.exports = {
plugins: [
'chai-expect',
'mocha'
],
env: {
mocha: true,
},
rules: {
// JSHint "expr", disabled due to chai expect assertions
'no-unused-expressions': 0,

// disabled for easier asserting of file contents
'quotes': 0,

// disabled because describe(), it(), etc. should not use arrow functions
'prefer-arrow-callback': 0,

/*** chai-expect ***/

'chai-expect/missing-assertion': 2,
'chai-expect/terminating-properties': 2,
'chai-expect/no-inner-compare': 2,

/*** mocha ***/

'mocha/no-exclusive-tests': 'error',
'mocha/no-skipped-tests': 'off',
'mocha/no-pending-tests': 'off',
'mocha/handle-done-callback': 'error',
'mocha/no-synchronous-tests': 'off',
'mocha/no-global-tests': 'error',
'mocha/no-return-and-callback': 'error',
'mocha/valid-test-description': 'off',
'mocha/valid-suite-description': 'off',
'mocha/no-sibling-hooks': 'error',
'mocha/no-mocha-arrows': 'error',
'mocha/no-hooks': 'off',
'mocha/no-hooks-for-single-case': 'off',
'mocha/no-top-level-hooks': 'error',
'mocha/no-identical-title': 'error',
'mocha/max-top-level-suites': 'off',
'mocha/no-nested-tests': 'error'
}
};
5 changes: 0 additions & 5 deletions test/.jshintrc

This file was deleted.

2 changes: 0 additions & 2 deletions test/fastboot-dependencies-test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
'use strict';

const expect = require('chai').expect;
const fs = require('fs');
const path = require('path');
const fixture = require('./helpers/fixture-path');
const FastBoot = require('./../src/index');

Expand Down
1 change: 0 additions & 1 deletion test/fastboot-headers-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* jshint expr:true */

var expect = require('chai').expect;
var path = require('path');
var FastBootHeaders = require('./../src/fastboot-headers.js');
var Ember = require('ember-source/dist/ember.debug');

Expand Down
1 change: 0 additions & 1 deletion test/fastboot-info-test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
var expect = require('chai').expect;
var path = require('path');
var FastBootInfo = require('./../src/fastboot-info.js');
var FastBootResponse = require('./../src/fastboot-response.js');
var FastBootRequest = require('./../src/fastboot-request.js');
Expand Down
1 change: 0 additions & 1 deletion test/fastboot-request-test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
var expect = require('chai').expect;
var path = require('path');
var FastBootRequest = require('./../src/fastboot-request.js');

describe("FastBootRequest", function() {
Expand Down
2 changes: 0 additions & 2 deletions test/fastboot-shoebox-test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
'use strict';

const expect = require('chai').expect;
const fs = require('fs');
const path = require('path');
const fixture = require('./helpers/fixture-path');
const FastBoot = require('./../src/index');

Expand Down
3 changes: 1 addition & 2 deletions test/helpers/test-http-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,10 @@ TestHTTPServer.prototype.start = function() {

app.get('/*', server.middleware());

return new RSVP.Promise(function(resolve, reject) {
return new RSVP.Promise(function(resolve) {
var listener = app.listen(options.port, options.host, function() {
var host = listener.address().address;
var port = listener.address().port;
var family = listener.address().family;

self.listener = listener;

Expand Down
1 change: 0 additions & 1 deletion test/jshint-test.js

This file was deleted.

Loading

0 comments on commit cafd96c

Please sign in to comment.