[Pkg-javascript-commits] [ltx] 398/469: use eslint

Jonas Smedegaard dr at jones.dk
Wed Aug 31 13:03:31 UTC 2016


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository ltx.

commit 2704707b550acc2b3f9fd5f8bd87af0a76481702
Author: Sonny Piers <sonny at fastmail.net>
Date:   Thu Sep 10 13:32:44 2015 +0200

    use eslint
---
 .gitignore => .eslintignore |  0
 .eslintrc                   | 36 ++++++++++++++++++++++++++++++++++++
 .gitignore                  |  7 +++++++
 .jshintrc                   | 34 ----------------------------------
 .npmignore                  |  5 +++--
 .travis.yml                 |  3 +++
 Gruntfile.js                | 44 --------------------------------------------
 benchmark.js                |  6 +++---
 lib/DOMElement.js           |  2 +-
 lib/Element.js              |  2 +-
 lib/Parser.js               |  2 +-
 lib/escape.js               |  2 +-
 lib/index.js                |  2 +-
 lib/parse.js                |  2 +-
 lib/parsers/easysax.js      |  2 +-
 lib/parsers/index.js        |  4 ++--
 lib/parsers/ltx.js          |  2 +-
 lib/parsers/node-expat.js   |  2 +-
 lib/parsers/node-xml.js     |  2 +-
 lib/parsers/sax.js          |  2 +-
 package.json                | 12 +++++-------
 test/dom-element-test.js    |  4 ++--
 test/element-test.js        |  4 ++--
 test/parse-test.js          |  2 +-
 test/unicode-test.js        |  2 +-
 25 files changed, 76 insertions(+), 109 deletions(-)

diff --git a/.gitignore b/.eslintignore
similarity index 100%
copy from .gitignore
copy to .eslintignore
diff --git a/.eslintrc b/.eslintrc
new file mode 100644
index 0000000..9d8907c
--- /dev/null
+++ b/.eslintrc
@@ -0,0 +1,36 @@
+root: true
+
+# http://eslint.org/docs/user-guide/configuring.html#extending-configuration-files
+extends:
+  - eslint:recommended
+
+# http://eslint.org/docs/user-guide/configuring.html#specifying-environments
+env:
+  node: true
+
+# http://eslint.org/docs/rules/
+rules:
+  # http://eslint.org/docs/rules/#possible-errors
+  no-console: 0
+  valid-jsdoc: 0
+  no-unexpected-multiline: 2
+
+  # http://eslint.org/docs/rules/#best-practices
+
+
+  # http://eslint.org/docs/rules/#strict-mode
+  strict: [2, global]
+
+  # http://eslint.org/docs/rules/#variables
+
+
+  # http://eslint.org/docs/rules/#nodejs
+
+
+  # http://eslint.org/docs/rules/#stylistic-issues
+  camelcase: 2
+  comma-spacing: 2
+  eqeqeq: 2
+  indent: [2, 4]
+  new-cap: 2
+  semi: [2, never]
diff --git a/.gitignore b/.gitignore
index a430685..9cdead9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,10 @@
 node_modules/
 
+!.editorconfig
+!.eslintignore
+!.eslintrc
+!.gitignore
+!.npmignore
+!.travis.yml
+
 ltx.js
diff --git a/.jshintrc b/.jshintrc
deleted file mode 100644
index 33b958e..0000000
--- a/.jshintrc
+++ /dev/null
@@ -1,34 +0,0 @@
-{
-    "asi": true,
-    "camelcase": true,
-    "eqeqeq": true,
-    "eqnull": true,
-    "globalstrict": true,
-    "immed": true,
-    "indent": 4,
-    "latedef": "nofunc",
-    "laxcomma": true,
-    "maxparams": 4,
-    "maxdepth": 3,
-    "maxstatements": 20,
-    "maxcomplexity": 8,
-    "maxlen": 120,
-    "newcap": true,
-    "noarg": true,
-    "noempty": true,
-    "nonew": true,
-    "quotmark": "single",
-    "undef": true,
-    "unused": true,
-    "strict": true,
-    "trailing": true,
-
-    "node": true,
-
-    "predef": [
-      "define", "module", "require",
-      "before", "beforeEach", "describe", "it",
-      "after", "window"
-  ]
-
-}
diff --git a/.npmignore b/.npmignore
index ea77ae3..1d9cf36 100644
--- a/.npmignore
+++ b/.npmignore
@@ -1,10 +1,11 @@
 test/
 
 .editorconfig
+.eslintignore
+.eslintrc
 .gitignore
-.jshintrc
 .npmignore
 .travis.yml
+
 benchmark.js
 CONTRIBUTING.md
-Gruntfile.js
diff --git a/.travis.yml b/.travis.yml
index acb8cdf..b1deb34 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -16,3 +16,6 @@ addons:
 before_install:
   # npm shipped with Node.js 0.8 doesn't support carret so let's update it
   - 'if [ "$TRAVIS_NODE_VERSION" == "0.8" ]; then npm i -g npm; fi'
+
+before_script:
+  - npm install -g browserify
diff --git a/Gruntfile.js b/Gruntfile.js
deleted file mode 100644
index d788282..0000000
--- a/Gruntfile.js
+++ /dev/null
@@ -1,44 +0,0 @@
-'use strict';
-
-module.exports = function(grunt) {
-
-    grunt.initConfig({
-        pkg: grunt.file.readJSON('package.json'),
-        jshint: {
-            allFiles: ['*.js', 'lib/**/*.js', 'test/**/*.js'],
-            options: {
-                jshintrc: '.jshintrc',
-            }
-        },
-        browserify: {
-            dist: {
-                files: {
-                    'ltx.js': ['./lib/index.js']
-                },
-                options: {
-                    debug: grunt.cli.options.debug
-                }
-            }
-        },
-        clean: ['ltx.js'],
-        vows: {
-            all: {
-                options: {
-                    reporter: 'spec',
-                    coverage: 'json'
-                },
-                src: ['test/**/*.js']
-            }
-        }
-    })
-
-    // Load the plugins
-    grunt.loadNpmTasks('grunt-contrib-jshint')
-    grunt.loadNpmTasks('grunt-browserify')
-    grunt.loadNpmTasks('grunt-contrib-clean')
-    grunt.loadNpmTasks('grunt-vows')
-
-    // Configure tasks
-    grunt.registerTask('default', ['test'])
-    grunt.registerTask('test', ['clean', 'vows', 'jshint', 'browserify'])
-}
diff --git a/benchmark.js b/benchmark.js
index 75df1da..4955663 100644
--- a/benchmark.js
+++ b/benchmark.js
@@ -6,7 +6,7 @@ var parsers = require('./lib/parsers')
 
 var XML = [
     '<message to="foo at bar" from="bar at to" type="chat" id="foobar">',
-        '<body>Where there is love there is life.</body>',
+    '<body>Where there is love there is life.</body>',
     '</message>'
 ].join('')
 
@@ -19,9 +19,9 @@ parsers.forEach(function(Parser) {
 })
 
 suite.on('cycle', function(event) {
-  console.log(event.target.toString())
+    console.log(event.target.toString())
 })
 .on('complete', function() {
-  console.log('Fastest is ' + this.filter('fastest').pluck('name'))
+    console.log('Fastest is ' + this.filter('fastest').pluck('name'))
 })
 .run({'async': true})
diff --git a/lib/DOMElement.js b/lib/DOMElement.js
index b8a57e3..df6fb7f 100644
--- a/lib/DOMElement.js
+++ b/lib/DOMElement.js
@@ -1,4 +1,4 @@
-'use strict';
+'use strict'
 
 var inherits = require('inherits')
   , Element = require('./Element')
diff --git a/lib/Element.js b/lib/Element.js
index e2dcf1c..62328d4 100644
--- a/lib/Element.js
+++ b/lib/Element.js
@@ -1,4 +1,4 @@
-'use strict';
+'use strict'
 
 var escape = require('./escape')
 var escapeXML = escape.escapeXML
diff --git a/lib/Parser.js b/lib/Parser.js
index a57a388..908c555 100644
--- a/lib/Parser.js
+++ b/lib/Parser.js
@@ -1,4 +1,4 @@
-'use strict';
+'use strict'
 
 var EventEmitter = require('events').EventEmitter
 var inherits = require('inherits')
diff --git a/lib/escape.js b/lib/escape.js
index 7479fc0..f0b4d3e 100644
--- a/lib/escape.js
+++ b/lib/escape.js
@@ -1,4 +1,4 @@
-'use strict';
+'use strict'
 
 module.exports.escapeXML = function escapeXML(s) {
     return s.
diff --git a/lib/index.js b/lib/index.js
index 2f82b99..0791e95 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -1,4 +1,4 @@
-'use strict';
+'use strict'
 
 var parse = require('./parse')
 var Parser = require('./Parser')
diff --git a/lib/parse.js b/lib/parse.js
index 3722dd6..bbb0243 100644
--- a/lib/parse.js
+++ b/lib/parse.js
@@ -1,4 +1,4 @@
-'use strict';
+'use strict'
 
 var Parser = require('./Parser')
 
diff --git a/lib/parsers/easysax.js b/lib/parsers/easysax.js
index c6c6440..b02d346 100644
--- a/lib/parsers/easysax.js
+++ b/lib/parsers/easysax.js
@@ -1,4 +1,4 @@
-'use strict';
+'use strict'
 
 var inherits = require('inherits')
   , EventEmitter = require('events').EventEmitter
diff --git a/lib/parsers/index.js b/lib/parsers/index.js
index e1c9ef8..650e247 100644
--- a/lib/parsers/index.js
+++ b/lib/parsers/index.js
@@ -1,4 +1,4 @@
-'use strict';
+'use strict'
 
 module.exports = [
     // 'easysax',
@@ -7,5 +7,5 @@ module.exports = [
     'node-xml',
     'sax'
 ].map(function(name) {
-  return require('./' + name)
+    return require('./' + name)
 })
diff --git a/lib/parsers/ltx.js b/lib/parsers/ltx.js
index 8ba5a00..e392e33 100644
--- a/lib/parsers/ltx.js
+++ b/lib/parsers/ltx.js
@@ -1,4 +1,4 @@
-'use strict';
+'use strict'
 
 var inherits = require('inherits')
   , EventEmitter = require('events').EventEmitter
diff --git a/lib/parsers/node-expat.js b/lib/parsers/node-expat.js
index b5ac3b1..2d9448a 100644
--- a/lib/parsers/node-expat.js
+++ b/lib/parsers/node-expat.js
@@ -1,4 +1,4 @@
-'use strict';
+'use strict'
 
 var inherits = require('inherits')
   , EventEmitter = require('events').EventEmitter
diff --git a/lib/parsers/node-xml.js b/lib/parsers/node-xml.js
index 86b112b..5c68ee5 100644
--- a/lib/parsers/node-xml.js
+++ b/lib/parsers/node-xml.js
@@ -1,4 +1,4 @@
-'use strict';
+'use strict'
 
 var inherits = require('inherits')
   , EventEmitter = require('events').EventEmitter
diff --git a/lib/parsers/sax.js b/lib/parsers/sax.js
index d96991c..71fc192 100644
--- a/lib/parsers/sax.js
+++ b/lib/parsers/sax.js
@@ -1,4 +1,4 @@
-'use strict';
+'use strict'
 
 var inherits = require('inherits')
   , EventEmitter = require('events').EventEmitter
diff --git a/package.json b/package.json
index 62cd867..a613dcf 100644
--- a/package.json
+++ b/package.json
@@ -33,12 +33,7 @@
   "devDependencies": {
     "benchmark": "^1.0.0",
     "easysax": "^0.1.14",
-    "grunt": "^0.4.5",
-    "grunt-browserify": "^4.0.1",
-    "grunt-cli": "^0.1.13",
-    "grunt-contrib-clean": "^0.6.0",
-    "grunt-contrib-jshint": "^0.11.3",
-    "grunt-vows": "^0.4.2",
+    "eslint": "^1.3.1",
     "microtime": "^2.0.0",
     "node-expat": "^2.3.9",
     "node-xml": "^1.0.2",
@@ -46,7 +41,10 @@
     "vows": "^0.8.1"
   },
   "scripts": {
-    "test": "./node_modules/.bin/grunt test"
+    "webify": "browserify -s ltx lib/index.js -o ltx.js",
+    "unit": "./node_modules/.bin/vows --spec",
+    "lint": "./node_modules/.bin/eslint .",
+    "test": "npm run unit && npm run lint && npm run webify"
   },
   "dependencies": {
     "inherits": "^2.0.1"
diff --git a/test/dom-element-test.js b/test/dom-element-test.js
index c6c3324..3f7c645 100644
--- a/test/dom-element-test.js
+++ b/test/dom-element-test.js
@@ -1,4 +1,4 @@
-'use strict';
+'use strict'
 
 var vows = require('vows')
   , assert = require('assert')
@@ -50,6 +50,6 @@ parsers.forEach(function(Parser) {
                 assert.equal(e.childNodes[0], 'foo')
                 assert.equal(e.childNodes[1], c)
             }
-        },
+        }
     }).export(module)
 })
diff --git a/test/element-test.js b/test/element-test.js
index a5f4721..05c7617 100644
--- a/test/element-test.js
+++ b/test/element-test.js
@@ -1,4 +1,4 @@
-'use strict';
+'use strict'
 
 var vows = require('vows')
   , assert = require('assert')
@@ -184,7 +184,7 @@ vows.describe('ltx').addBatch({
             assert.equal(orig.getChildText('content'), 'foo')
             assert.equal(clone.children[0].name, 'description')
             assert.equal(clone.getChildText('description'), 'foobar')
-        },
+        }
     },
     'children': {
         'getChildren': function() {
diff --git a/test/parse-test.js b/test/parse-test.js
index ff723c4..8ae10b2 100644
--- a/test/parse-test.js
+++ b/test/parse-test.js
@@ -1,4 +1,4 @@
-'use strict';
+'use strict'
 
 var vows = require('vows')
   , assert = require('assert')
diff --git a/test/unicode-test.js b/test/unicode-test.js
index c5865d7..0123000 100644
--- a/test/unicode-test.js
+++ b/test/unicode-test.js
@@ -1,4 +1,4 @@
-'use strict';
+'use strict'
 
 var vows = require('vows')
   , assert = require('assert')

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/ltx.git



More information about the Pkg-javascript-commits mailing list